-
Notifications
You must be signed in to change notification settings - Fork 51
Verify message by sender #4144
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
Verify message by sender #4144
Conversation
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.
this is roughly it, as a wip
extension/chrome/elements/pgp_block_modules/pgp-block-attachmens-module.ts
Outdated
Show resolved
Hide resolved
extension/chrome/elements/pgp_block_modules/pgp-block-signature-module.ts
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
… except successful verification
This pull request introduces 1 alert when merging 2df3953 into c636c10 - view on LGTM.com new alerts:
|
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.
New changes all look good. I'll do another review for all of the changes hollistically
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
code looks good
// in some tests we load the block without sender information | ||
$('#pgp_signature').addClass('bad').find('.result').text(`Cannot verify: missing pubkey, missing sender info`); |
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.
This should not really happen. If we have customers complain about this, we'll have to be fetching this information from Google API. Which I think we already do - before the frame is rendered. For now, we can leave this as is.
private renderBadSignature = () => { | ||
$('#pgp_signature').addClass('bad'); | ||
$('#pgp_signature > .result').text('signature does not match'); | ||
this.view.renderModule.setFrameColor('red'); // todo: in what other cases should we set the frame red? |
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.
Decrypt error, which we are already doing.
If you are talking about re-fetching the message because the DOM may have mingled it, then yes - we should display the re-fetched message we got from Google API. If you mean re-fetching public keys for verification, then we don't have to re-render the message, just verification result. Does this mean this is still actionable to change / update in this PR? |
yes, in this particular test the message is completely different when re-fetched from API. |
We should indeed re-render the message body to match what we got from API. Since that's what we are verifying on the second attempt. Could be in another issue - since we were never doing that before, it's not new to this PR. Well noticed. |
Is this for performance reasons? I didn't pay too much attention on what is rendered and re-rendered. I can do this in this or another PR |
The issue is already filed (#4164) |
It's just for less work reasons, development-wise. Usually re-rendering fewer things is less work. As long as it doesn't create any side effects, it doesn't really matter if the body is re-rendered. There is one possible side effect - if the user starts wanting to copy and paste part of the message, re-rendering will upset them because their highlight will be gone if the text gets replaced while trying to copy it. |
I'm afraid there might be such side effects. I suggest to fix them after (or as part of) #4164 as there is a stack of modules calling each other. Perhaps, a bit of refactoring is in order. |
Getting an exception - this scenario is likely not tested? it's on
|
Also happens on |
Separately, it seems to me that the pgp block doesn't finish rendering anything until the decrypt -> try to verify -> aha missing pubkey -> fetch pubkeys -> reverify loop is complete. I didn't investigate in detail, could it be true? I'd recommend to write a test as follows:
Do you have a similar test that checks for the "verifying signature" step specifically? |
By background I meant that the user should not need to wait for it. Render the text body as soon as it's decrypted even if pubkeys are missing to verify it, and render "verifying signature..". So user can see message right away, and signature verification result only later, when it's done verifying. |
Here I was concerned that the user would have to wait 10 seconds to read the message if it takes 10 seconds to fetch public keys to verify it. Sorry for not clarifying earlier, I overlooked this comment. |
This pull request introduces 1 alert when merging 761f9a9 into c636c10 - view on LGTM.com new alerts:
|
fixed this -- no longer re-fetching the encrypted message when verification fails |
This one should now be passing too |
This does not close the issue fully yet - I've filed #4197 which should be done right after. |
This PR refactors decryption functions to use verificationPubs as parameter,
fetches unknown sender's pubkeys with publookup, automatically saving them to ContactStore and using to verify signature.
sender email is always displayed as Signer (primary UID from pubkey is ignored)
close #3884
Tests (delete all except exactly one):
To be filled by reviewers
I have reviewed that this PR... (tick whichever items you personally focused on during this review):