-
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
Vendor pretty_bad_protocol #6836
Conversation
1e780bc
to
fa00437
Compare
pretty_bad_protocol is unmaintained upstream, not seeing any commits since the 3.1.1 release in August 2018. As part of our shift to Sequoia, we will just need a small part of this library during the migration, so let's fork/vendor it and remove the parts we don't need. This will also let us get rid of the monkey-patching that's accumulated over the years. This is a direct copy of the 3.1.1 source tree: $ wget https://files.pythonhosted.org/packages/84/0d/814c6c96f64f9cfc235fe102024b00ee77d107977e32996c59aed8f27ec0/pretty-bad-protocol-3.1.1.tar.gz $ tar xvf pretty-bad-protocol-3.1.1.tar.gz $ cp -Rv pretty-bad-protocol-3.1.1/pretty_bad_protocol freedomofpress/securedrop/securedrop/ Follow-up commits will reformat it per our coding standards and other necessary fixes. Refs #6807.
First pass in cleaning up outdated things.
Remove code to support Python 2, Windows and old GPG versions.
focal ships with GPG 2.1+, so we don't need to bother checking for older versions.
* ansistrm is only used if logging is enabled, but we never enable it (since SecureDrop has its own logger) so deleted entirely. * Fix undefined variable `message` in error case. * Delete insecure, broken and unused _make_passphrase(). * Raise ValueError instead of incorrect. * Inline _version.py's version number.
Mostly not using "not in" properly and double hash ("##") for comments
We don't need this information available at runtime, so just stick it in a documentation file.
I suspect there's more that we can delete out of pretty_bad_protocol in the future, so for now just make mypy happy by suppressing lack of type information. In some places I inlined or deleted helpers that no longer make sense to have in a Python 3-only world.
The use of a fixed /tmp directory is bad, but a pre-existing issue so we can fix it later after investigating whether we actually use this code path or not.
And just implement them in the code directly now. We still set the `USERNAME` environment variable via encryption.py since there's not really a logical place for it in pretty_bad_protocol. Fixes #6807.
I still need to verify this in staging, but everything else seems to check out. |
okay it's broken in staging/prod >.> debugging... |
I had forgotten to add the new folder to |
stupid me, I didn't add the directory itself to apparmor, just the individual files. Really should get around to scripting this... |
Include the newly added folder in the package and to the AppArmor list.
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 did not expect vendoring pbp to feel good, but this feels good. Great work!
Status
Ready for review
Description of Changes
Vendor pretty_bad_protocol and apply minimal fixes to get it to pass CI. Then remove our monkey patching from EncryptionManager.
Each commit should have a description of what is happening and why.
Fixes #6807.
Testing
How should the reviewer test this PR?
Deployment
Any special considerations for deployment? Just the standard-ish ones.
Checklist
make lint
) and tests (make test
) pass in the development container