-
Notifications
You must be signed in to change notification settings - Fork 8
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
keys: make AptKeyManager.install_key() more robust #86
Conversation
This commit relaxes the restriction of the provided key contents having only a single (primary) key, and makes AptKeyManager better handle the fact that "gpg import" might print out useful diagnostics messages even if the key contents are imported "successfully". To do this, we capture gpg's output and add a new optional parameter for the desired "target" key fingerprint (the key that we desire to import even if other keys exist in the contents). This fingerprint is used when naming the imported file, and then: 1) If we don't have a desired fingerprint, proceed as before. 2) If we have a desired fingerprint, check for it in the imported file, failing if it's not there. The motivation for this change is that there are keys "in the wild" that generate gpg error messages but still contain a valid, non-expired desired key. This was supported before but regressed when we moved away from apt-key. This commit is the second one on the road to fixing the "multiple keys in the same file" regression.
Codecov Report
@@ Coverage Diff @@
## hotfix/1.1.1 #86 +/- ##
================================================
- Coverage 90.51% 89.94% -0.58%
================================================
Files 13 13
Lines 664 686 +22
Branches 133 140 +7
================================================
+ Hits 601 617 +16
- Misses 47 51 +4
- Partials 16 18 +2
|
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.
Looks good! Could you add a test where install_key
succeeds with a string key_id
?
Signed-off-by: Callahan Kovacs <callahankovacs@gmail.com>
This commit relaxes the restriction of the provided key contents having only a single (primary) key, and makes AptKeyManager better handle the fact that "gpg import" might print out useful diagnostics messages even if the key contents are imported "successfully".
To do this, we capture gpg's output and add a new optional parameter for the desired "target" key fingerprint (the key that we desire to import even if other keys exist in the contents). This fingerprint is used when naming the imported file, and then:
failing if it's not there.
The motivation for this change is that there are keys "in the wild" that generate gpg error messages but still contain a valid, non-expired desired key. This was supported before but regressed when we moved away from apt-key.
This commit is the second one on the road to fixing the "multiple keys in the same file" regression.
tox
?