-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
feat(backup): Support import decryption #58128
Conversation
Codecov Report
@@ Coverage Diff @@
## master #58128 +/- ##
=======================================
Coverage 79.04% 79.05%
=======================================
Files 5135 5135
Lines 223466 223480 +14
Branches 37622 37626 +4
=======================================
+ Hits 176643 176673 +30
+ Misses 41173 41152 -21
- Partials 5650 5655 +5
|
e80a8dd
to
016d82c
Compare
tests/sentry/backup/test_imports.py
Outdated
|
||
tmp_tarball_path = Path(tmp_dir).joinpath("input.tar") | ||
with open(tmp_tarball_path, "wb") as i, open(tmp_pub_key_path, "rb") as p: | ||
i.write(create_encrypted_export_tarball(data, p).getvalue()) |
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.
Is it worth it to have a testcase encrypting an export tarbell without this function create_encrypted_export_tarbell
? Since technically changing the behavior in this function could lead to all these test cases failing.
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.
Good idea, I copied out the logic into this testing method.
src/sentry/backup/helpers.py
Outdated
backup_encryptor = Fernet(data_encryption_key) | ||
encrypted_json_export = backup_encryptor.encrypt(json.dumps(json_export).encode("utf-8")) | ||
|
||
# Encrypt the newly minted DEK using symmetric public key encryption. |
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.
# Encrypt the newly minted DEK using symmetric public key encryption. | |
# Encrypt the newly minted DEK using asymmetric public key encryption. |
The DEK is encrypted with asymmetric encryption. Once encrypted with the public key, it can only be decrypted with the private key.
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.
Good catch, done!
This is the follow up to #58015, adding the corresponding `--decrypt_with` flag to decrypt tarballs at import time. Closes getsentry/team-ospo#207
016d82c
to
73aa12b
Compare
This is the follow up to #58015, adding the corresponding
--decrypt_with
flag to decrypt tarballs at import time.Closes getsentry/team-ospo#207