Skip to content
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

Improve efficiency of source key management #793

Merged
merged 3 commits into from
Feb 12, 2020
Merged

Conversation

rmol
Copy link
Contributor

@rmol rmol commented Feb 11, 2020

Description

Only set db.Source.public_key and db.Source.fingerprint when a source's key is successfully imported to the local key ring. This allows us to use those columns to check the presence of the key and save a call to GPG during sync.

Fixes #757.

Test Plan

Run the client against a local dev server with LOGLEVEL=debug. Observe in the logs that the initial sync imports source public keys, and subsequent ones skip the imports. Observe that there is no keyring access popup for syncs where no new keys are imported.

Checklist

If these changes modify code paths involving cryptography, the opening of files in VMs or network (via the RPC service) traffic, Qubes testing in the staging environment is required. For fine tuning of the graphical user interface, testing in any environment in Qubes is required. Please check as applicable:

  • I have tested these changes in the appropriate Qubes environment
  • I do not have an appropriate Qubes OS workstation set up (the reviewer will need to test these changes)
  • These changes should not need testing in Qubes

If these changes add or remove files other than client code, packaging logic (e.g., the AppArmor profile) may need to be updated. Please check as applicable:

  • I have submitted a separate PR to the packaging repo
  • No update to the packaging logic (e.g., AppArmor profile) is required for these changes
  • I don't know and would appreciate guidance

Only set db.Source.public_key and db.Source.fingerprint when a
source's key is successfully imported to the local key ring. This
allows us to use those columns to check the presence of the key and
save a call to GPG during sync.
@sssoleileraaa sssoleileraaa self-requested a review February 11, 2020 23:57
Copy link
Contributor

@sssoleileraaa sssoleileraaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirmed this fixes the issue: i no longer see frequent keyring popups. i verified that now for every sync i see a log like this one for each existing source:

2020-02-11 16:02:43,081 - securedrop_client.storage:145(update_source_key) DEBUG: Source key data is unchanged
2020-02-11 16:02:43,081 - securedrop_client.storage:192(update_sources) DEBUG: Updated source 82cec7df-b54c-4396-b8f1-c1f4dde778d9

and if there is a new source:

2020-02-11 16:05:13,094 - securedrop_client.crypto:152(import_key) DEBUG: Importing key with fingerprint 8A80A746A38F8DCF1295428917C08CCA40466BF6
2020-02-11 16:05:13,107 - securedrop_client.storage:206(update_sources) DEBUG: Added new source c21b9e51-2ec2-425f-ac77-df9de45eebfc

i left a nitpicky comment that you can just ignore. also leaving this open since it's on redshiftzero's todo list

@sssoleileraaa
Copy link
Contributor

but if you don't want to ignore my nitpicky comment that's fine too!

The session needs to be committed before calling import_key, but that
should happen where the changes to the source are being made, in
update_sources.
Copy link
Contributor

@kushaldas kushaldas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as it is suggested. Approved.

Not merging it as I want another pair of eyes to look as it is important :)

@sssoleileraaa
Copy link
Contributor

going to run through this one more time to make sure everything still works with the latest changes from master

@sssoleileraaa sssoleileraaa merged commit 6b09720 into master Feb 12, 2020
@sssoleileraaa sssoleileraaa deleted the 757-quiet-gpg branch February 12, 2020 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Checking for existing gpg keys causes frequent keyring popups
3 participants