Commit Graph

189 Commits

Author SHA1 Message Date
leigh-mil
a76f61eb2a Check if view_args is not None to prevent KeyError 2020-02-06 14:08:30 -05:00
leigh-mil
41b2fff774 Add success flash message for revoked portfolio invite and update flash message and translations to be generalized 2020-02-04 16:03:45 -05:00
graham-dds
00a5a98577 Add Mailer class method to email TOs to MSFT 2020-01-31 13:17:00 -05:00
dandds
abd03be806 Store and pull tenant creds from Key Vault.
The tenant ID should be hashed and used as the key for the JSON blob of
relevant creds for any given tenant. Azure CSP interface methods that
need to source creds should call the internal `_source_creds` method,
either with a `tenant_id` or no parameters. That method will source the
creds. If a tenant ID is provided, it will source them from the Key
Vault. If not provided, it will return the default creds for the app
registration in the home tenant.
2020-01-29 10:49:27 -05:00
tomdds
35eea8e31c Merge branch 'staging' into azure-custom-integration 2020-01-24 11:16:11 -05:00
leigh-mil
1bad32bcdb Add success flash message 2020-01-23 16:44:27 -05:00
leigh-mil
31b7e2f589 Create route and domain method for creating a subscription 2020-01-23 16:44:07 -05:00
dandds
944c5d3c9f Forcibly destroy existing session on logout.
To comply with security guidelines, we need to destroy the session when
a user logs out. This means that the session's key in the Redis cache
needs to be deleted. Flask expects to _always_ have a session object. If
the current session object does not exist in the Redis cache, Flask will
reserialize and store it at the end of the request. In order for
session deletion to work, we need to delete the key for the existing
session and then replace the session object with a new, empty one.

This also updates the SessionLimiter class so that the session prefix is
configurable.
2020-01-23 10:31:20 -05:00
leigh-mil
ce70e44590 Update flash messages for portfolio invites to match application invite messages.
Use None instead of an empty string for titles and messages in flash alerts.
2020-01-21 11:57:10 -05:00
leigh-mil
6f85f6de97 Update copy for invite alert messages, CLIN error message, and use translations in flash file 2020-01-21 11:57:10 -05:00
leigh-mil
d154b90c05 Use translations in flash messages 2020-01-17 10:49:05 -05:00
leigh-mil
4f345b462f Add resend invite form/modal, update routes and tests as necessary. 2020-01-17 10:49:05 -05:00
leigh-mil
56c213285f Add route to update portfolio manager perms, add modal form to update in the UI 2020-01-17 10:49:05 -05:00
tomdds
7c22922d6d Create new AliasModel for CSP datalcasses, ignore credentials when converting to dictionary.This will allow all of our dataclasses to convert automatically between python style snake_case and the camelCase that the Azure APIs use. This also allows us to default to that behavior while specifying aliases for any fields as necessary.Additionally, any dataclass including the creds schema will have those creds removed from their dict representation. This can help keep creds out of logs as well as making the dataclasses more consumable for API usage. 2020-01-14 17:16:54 -05:00
dandds
0731b0519c Use simple string formatting for flash messages.
This addresses an SSTI vulnerability in Flask's `render_template_string`
function, which we were using for rendering flash messages. The
implementation I'd built was too complicated, so I removed its reliance
on Jinja template rendering. Instead, all parts of the flash message
should be keys in the translations file. The `flash` wrapper in
`atst.utils.flash` is just a thin wrapper over our `translate` function.
The `translate` function relies on Python string formatting, which does
not evaluate expressions and so isn't vulnerable to SSTI.
2020-01-11 15:27:34 -05:00
dandds
1ab0c26365 Log details about user login and logout.
To satisfy security requirements, we need to explicitly track:

- when a user attempts to log in, successful or not
- when a user logs out
- whether or not the user associated with a request is logged in

The first two are satisfied by extra log statements and the last is a
new boolean field on the JSON logs.
2020-01-10 10:20:35 -05:00
graham-dds
aabedbcac4 Make PoP start and end dates inclusive.
Also removes the clock class.

Makes PoP date ranges inclusive such that a task order with:
-  a start date on or after the current date
and
- an end date on or before the current date
should be considered valid.

This commit also removes the Clock class. This class had two methods as
shortcuts for common uses of pendlum functions. But it wasn't being used
in very many places, and it took up about the same space as

    from pendulum import today()
    ...
    today(tz="UTC").date()

If we want to add this back in, it might be a good idea to extend it for
other time functions we have sprinkled around, like the random date
functions in our tests
2020-01-06 12:29:59 -05:00
leigh-mil
f543602076 Update function name to better reflect what it does 2019-12-18 10:54:18 -05:00
leigh-mil
63a5d9274b Update route to handle error when env names are duplicated 2019-12-18 10:54:17 -05:00
leigh-mil
b927ef1b0e Create utility function for the pattern of committing to the database or raising AlreadyExistsError 2019-12-16 14:39:32 -05:00
leigh-mil
ffbf612290 Update route to catch error when app name uniqueness is violated and display a error message 2019-12-16 14:39:32 -05:00
leigh-mil
78ef47f649 Update TO route helper function to catch error and display flash message when a user tries to save a TO with an existing number.
Update TaskOrderForm so that it converts empty string for number into None, this was causing an issue where new TOs were being saved with an empty string for the number, which violated the unique constraint.
2019-12-13 14:53:58 -05:00
graham-dds
3b265b0eb6 Flash message for insufficient funding 2019-12-10 11:23:53 -05:00
dandds
9ae20b4a2a JSON logging for Celery workers.
This enables JSON logging for Celery workers if the LOG_JSON conig value
is set. It uses the same JsonFormatter class used by the Flask
applications. That class has been updated in two ways:

- It takes a `source` kwarg to define the log source for the formatter.
- The `msg` attribute of the log record is formatted with any arguments
  that may have been passed. This is necessary for Celery to render task
  type, completion time, etc. into the log output.
2019-11-25 10:13:37 -05:00
dandds
e56e0d8619 Log DOD ID for user when available. 2019-11-25 09:47:01 -05:00
leigh-mil
4cba564c97 Catch CSP exceptions and display a flash message with the error 2019-11-22 08:49:16 -05:00
richard-dds
e3c9105270 Fix some LGTM errors 2019-10-31 13:46:04 -04:00
leigh-mil
1eecf19459 Update flash message for resending an invite 2019-10-15 14:35:13 -04:00
graham-dds
8e6a4101ff Update copy in headers / flash 2019-10-14 14:46:00 -04:00
graham-dds
24be9a6a61 Update copy for new app provisioning
- change flashed message for adding members
- use the correct helper text for the app name input
- a few other updates to text in translations
2019-10-14 10:10:22 -04:00
richard-dds
78c4949776 Move sqlalchemy_dumps to atst.utils.json 2019-10-08 16:42:25 -04:00
leigh-mil
4d043363a7 Create route for resending an app invite
Replace ApplicationInvitations._update_status() with revoke() because multiple functions used _update_status() and it was causing app roles to be disabled when they shouldn't have. Now app roles are disabled within the revoke function.
Updated Invitations.resend() to accept user details so the invite info
can be changed in the new invite
2019-10-08 15:59:16 -04:00
graham-dds
4a4e20534f Flashed message after step 1 of app provisioning
- add flash for updating application
- add to route logic
2019-10-08 13:15:28 -04:00
leigh-mil
05aca75679 Fix typo and add flash message for when invite can't be revoked 2019-09-26 09:53:20 -04:00
leigh-mil
a03ff56017 Invites are revokable if they are not expired, and add success flash message 2019-09-26 09:46:24 -04:00
graham-dds
83479f60af Flash messages for saving/ submitting applications 2019-09-24 10:16:39 -04:00
dandds
7bb9400ea7 Update the flash message for when a new application member is added. 2019-09-19 09:34:00 -04:00
leigh-mil
93530e903f Create route for updating app member 2019-09-18 11:16:54 -04:00
dandds
d7478e322a Use Celery instead of RQ.
Celery provides a more robust set of queueing options for both tasks and
worker processes. Updates include:
- infrastructure necessary to run Celery, including celery entrypoint
- backgrounded functions are now imported directly from atst.jobs
- update tests as-needed
- update kubernetes worker pod command
2019-08-29 09:33:47 -04:00
leigh-mil
e35399d8f5 Update route function to revoke CCPO superuser status 2019-08-13 10:32:26 -04:00
leigh-mil
fa83dfe6bd When user not found, redirect to users page and show flash message 2019-08-09 11:08:23 -04:00
leigh-mil
811a498bf4 Finish route for confirming CCPO user, add function to update user's ccpo perms, and add success flash message to template 2019-08-09 10:50:34 -04:00
leigh-mil
8420a78392 Add CREATE_CCPO_USER permission, create context processor for ATAT so user_can and permissions can be used in the template, add placeholder button for adding new CCPO user 2019-08-09 10:50:34 -04:00
George Drummond
9f274a7d1c Script to find unused translations 2019-06-14 09:59:07 -04:00
George Drummond
1821e164b0 Merge pull request #908 from dod-ccpo/clean-up-flash-messages
Delete unused flash messages
2019-06-13 10:34:53 -04:00
George Drummond
3740291662 Delete unused flash messages 2019-06-13 10:11:29 -04:00
dandds
4ba983cbdd Remove unused template filters 2019-06-13 09:51:00 -04:00
dandds
717e996685 Remove unused utilities 2019-06-12 14:54:01 -04:00
dandds
06f4aeb74d Merge pull request #880 from dod-ccpo/to-review-modal
TO Review Submit Modal
2019-06-11 13:10:17 -04:00
George Drummond
c08f14382f Add in success flash message 2019-06-11 11:30:37 -04:00