Fixes #5378, adds more checks for invalid username #5380
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Status
Ready for review.
Description of Changes
Fixes #5378
In #5284 we made sure that the username
deleted
is not not allowedto be added in the system via the admin section of the journalist web
application. But, one could still edit any existing user and change
the name to
deleted
. Or, an admin can add a new user viamanage.py
in command line.
In PR adds checks to make sure that addiving a new user via
manage.py
will fail if you try to set the username as
deleted
, it also blocksediting any existing username to
deleted
.The PR also includes unit and functional tests.
Testing
make build-debs
make staging
create-dev-data.py
in theapp-staging
vm for 2 journalists accounts.deleted
viamanage.py
, this should fail.journalist
and then try to change the usernamedellsberg
todeleted
, this should flash an error about "Invalid username"Deployment
Any special considerations for deployment? Consider both:
Checklist
If you made changes to the server application code:
make lint
) and tests (make test
) pass in the development containerIf you made changes to
securedrop-admin
:make -C admin test
) pass in the admin development containerIf you made changes to the system configuration:
If you made non-trivial code changes:
If you made changes to documentation:
make docs-lint
) passed locallyIf you added or updated a code dependency:
Choose one of the following: