-
Notifications
You must be signed in to change notification settings - Fork 687
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
Avoid leaking information in GPG key creation and expiration dates #3994
Avoid leaking information in GPG key creation and expiration dates #3994
Conversation
- All source reply keys now have a fixed creation date, which is before any actual sources were using the platform. - Source reply keys no longer expire.
66196dc
to
b971d0e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially this looks good. I tried exporting the public and private key to run them through openssl asn1parse
to inspect everything, but openssl
yells and says that it's invalid ANS1 (yes, checked PEM/DER flags). I'd like someone who remembers how to pick apart the PGP packets to take a look to make sure there's not a date that's embedded in there somewhere that we're not considering.
securedrop/tests/test_crypto_util.py
Outdated
|
||
|
||
def test_reply_keypair_creation_and_expiration_dates(source_app): | ||
# TODO: setup copied from test_genkeypair. DRY? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's ok to not be super DRY about this since unit tests also serve as documentaiton.
@heartsucker Good idea. Have you tried https://github.com/kazu-yamamoto/pgpdump? |
Here's an example
|
@garrettr I haven't seen that. Thanks for the recommendation 😄 |
Tests need to be kicked, but this is good to merge. For whoever merges, we need to open the followup ticket to migrate keys on old instances to erase the expiration date. |
Codecov Report
@@ Coverage Diff @@
## develop #3994 +/- ##
===========================================
+ Coverage 84.67% 84.69% +0.01%
===========================================
Files 43 43
Lines 2760 2763 +3
Branches 299 299
===========================================
+ Hits 2337 2340 +3
Misses 355 355
Partials 68 68
Continue to review full report at Codecov.
|
This looks good to me, @emkll take a peek at this and let me know if you are cool with this change (doesn't need to be a full review, just so you are aware) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the PR @garrettr ! Used pgpdump and confirmed that the creation/expiry dates are working as expected, and no other metadata. #3995 was already opened for follow-up (thanks!).
A couple of comments, for which I will open follow-up tickets:
- Xenial will be using, gnupg 2.1, which uses different format for private key storage (https://gnupg.org/faq/whats-new-in-2.1.html): the metadata of the private key file on disk might need to be modified as well.
- Output of pgpdump made me notice that keys generated have certify/sign/authenticate capabilities, which are not used. Since they are stored in an application-specific keyring that doesn't strike me as an immediate problem however.
Status
Ready for review
Description of Changes
Fixes #3912.
Changes proposed in this pull request:
Testing
I added a unit test,
tests/test_crypto_util.py::test_genkeypair_should_use_obfuscated_creation_and_expiration_dates
.I confirmed the test fails on develop and passes with the changes made in this PR.
Deployment
Any special considerations for deployment? Consider both:
Upgrading existing production instances.
Filed Update existing source reply keys to prevent leaking timing information #3995 to address this issue.
New installs.
No special considerations that I can think of. I don't know of any places where we use the creation/expiration dates of the reply keys in SecureDrop, so I think this should be a fairly low-risk change.
Checklist
If you made changes to the server application code:
make ci-lint
) and tests (make -C securedrop test
) pass in the development containerI was unable to run
make ci-lint
on macOS, got an error:File #3996 to address this issue.