Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent creation of a duplicate source keypair #6011

Merged
merged 1 commit into from Jun 22, 2021

Conversation

rmol
Copy link
Contributor

@rmol rmol commented Jun 22, 2021

Status

Ready for review

Description of Changes

#5954 introduced a bug causing two keypairs to be generated for new sources: once when they arrived at the lookup page, and the next the first time they submitted something (because all sources have pending=True by default, passing this faulty check). This eliminates the key generation in the source /submit handler. A keypair should never actually need to be generated when submitting, as it happens on the previous /lookup page. Even if a source without a keypair were somehow sitting at /lookup during the upgrade, when they pushed submit, a keypair would be generated when they were redirected back to /lookup.

Testing

  • git checkout develop
  • make dev
  • docker exec -it securedrop-dev-0 bash and in that shell:
    • gpg --homedir /var/lib/securedrop/keys --list-keys -- only the three default sources should be listed.
  • Visit the source interface and create a new source.
  • List the GPG keys again. The new source should have one key.
  • Submit a message, then list keys again -- the source will have a second key.
  • Back in your dev environment, git checkout prevent-dup-source-keys -- the dev server should pick up the changes.
  • In the source interface, log out and create another source. Once at the /lookup page, list keys and confirm the new source has one.
  • Submit a message, list keys, and confirm that no additional key was created for this source.

Deployment

Checklist

If you made changes to the server application code:

  • Linting (make lint) and tests (make test) pass in the development container

If you made non-trivial code changes:

  • I have written a test plan and validated it for this PR

Choose one of the following:

  • I have opened a PR in the docs repo for these changes, or will do so later
  • I would appreciate help with the documentation
  • These changes do not require documentation

@rmol rmol requested a review from a team as a code owner June 22, 2021 19:17
@eloquence eloquence added this to Ready for Review in SecureDrop Team Board Jun 22, 2021
@zenmonkeykstop zenmonkeykstop self-assigned this Jun 22, 2021
Copy link
Contributor

@zenmonkeykstop zenmonkeykstop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran thru test plan in dev, confirmed that a second key is not created in this branch on first or subsequent submissions.

LGTM, good catch! Can be merged if CI passes.

@zenmonkeykstop zenmonkeykstop merged commit bfed762 into develop Jun 22, 2021
SecureDrop Team Board automation moved this from Ready for Review to Done Jun 22, 2021
@rmol rmol deleted the prevent-dup-source-keys branch June 23, 2021 13:41
@rmol rmol mentioned this pull request Jun 23, 2021
39 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants