-
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
using the API to retrieve a source immediately after source creation returns *all* source keys #4005
Comments
There is a related bit of code in def getkey(self, name):
for key in self.gpg.list_keys():
for uid in key['uids']:
if name in uid:
return key['fingerprint']
return None If we call this like Instead of listing all the keys and iterating through them, it may be better to use the GPG wrapper to extract exactly the key we want, then check that the extraction returned only one key. I'm fairly sure the wrapper supports this. If we do not make the change above, when we call def export_pubkey(self, identifier):
# 40 is the len of a fingerprint, scrypt filesystem_ids are longer than that
if not identifier and not len(identifier) > 40:
raise Exception("not today!")
return self.gpg.export_keys(identifier) |
As a related issue, if we use the code snippet above of exporting by identifier, this happens
You can see in the above that I'm exporting once by @redshiftzero mentioned that this may be an upstream issue, but also we're far behind the latest version of |
Hmm, did you confirm that it is indeed the case that we should expect to be able to pass When I tested just now, it looks like the behavior when the identifier actually doesn't match anything is to still return a public-key looking return value (i.e. the underlying problem here could just be passing an unexpected arg to
|
Yeah I just woke up and checked that with |
Description
Steps to Reproduce
Steps to reproduce
GET /api/v1/sources
Expected Behavior
Exactly one or zero keys are returned for the new source.
Actual Behavior
All keys are returned for the new source.
Example:
If you import the above key into GPG, you will see that it contains:
Comments
The root cause is here:
if
None
is passed toexport_keys
, then it will return all pub keys.This bug will cause the following fatal error in the Qt client.
In additional to the error in Qt, it seems likely this will cause errors in the web UI too (both interfaces), but I haven't tested that yet.
The text was updated successfully, but these errors were encountered: