ncrypt/crypt_gpgme.c: Show encryption information#4221
ncrypt/crypt_gpgme.c: Show encryption information#4221flatcap merged 4 commits intoneomutt:devel/securityfrom
Conversation
|
v1b (by @flatcap) changes:
|
|
v1c changes:
|
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
|
v2 changes:
|
|
Hmmm, interesting thing: If the recipient is hidden (which I've tested by manually editing a real message, first decrypting it with with gpg(1), editing a few things, then re-encrypting it with different recipients), gpgme reports a key ID consisting of all 0s. The following is an experiment encrypted to me (non-hidden), and two other recipients (both with I like that behavior for now. |
Yeah, it looks good. A possible alternative is |
Yup, that looks good. For now, I'll be lazy and not code that. :) |
|
A quick look at the crash (it's late here)... It's writing to Update: |
Those two seem to always have different values. Without triggering the crash, I see that I don't understand what those two pointers are used for. :| |
Hmmm, I checked that the time that I've also made sense in my head of the difference between I still have no clue what |
|
My best guess of how it works, is...
These "handlers" originate in Where does the extra |
|
v3 changes:
|
|
v3b changes:
|
|
When does the pgp_gpgme_application_handler() handler run? I don't know how to test it. :| |
|
(This is from a quick trawl of the code, not from understanding :-) An email with an attachment of Lines 1666 to 1670 in 37d021f Then we set the handler to neomutt/ncrypt/crypt_mod_pgp_gpgme.c Lines 58 to 67 in 37d021f Leading us to Line 2427 in 37d021f |
Would you mind sending me an email with such an attachment? I don't know how to write one. ;) |
Ahh, this worked: attaching an encrypted file (I'm the hidden recipient in the test below). The entire mail is shown as: And viewing just the attachment: And the multipart/mixed (all): |
|
v7 changes:
|
|
This is still wrong, it needs to be (if git grep isn't leading me astray) |
Hmmm! I didn't know of that function. Yep, that looks much nicer. Thanks! |
Some users want to be able to turn this feature off. But default to 'yes', since it's better to not hide crypto-related info, unless the user explicitly says they don't care about it. Link: <neomutt#4221> Suggested-by: наб <[email protected]> Signed-off-by: Alejandro Colomar <[email protected]>
|
v8 changes:
|
This comment was marked as resolved.
This comment was marked as resolved.
TL;DR: These blank lines are not part of the signed and/or encrypted message. neomutt(1) was claiming so, which was incorrect. As наб suggested (see links below), I think we were abusing blank lines a bit too much. Long story: A MIME part doesn't include the trailing blank line. That blank line belongs to the structure of the whole message, and doesn't belong to the body part. A typical PGP/MIME email looks like this: Date: Mon, 1 Apr 2024 21:40:04 +0200 From: Alejandro Colomar <[email protected]> To: [email protected] Subject: After Message-ID: <ZgsNlP1MtLAsGBA3@debian> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="bHQR9+uNWFqbSKv/" Content-Disposition: inline --bHQR9+uNWFqbSKv/ Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Date: Mon, 1 Apr 2024 21:40:04 +0200 From: Alejandro Colomar <[email protected]> To: [email protected] Subject: After Supposedly, migadu is fixed now. Let's see --bHQR9+uNWFqbSKv/ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmYLDZQACgkQnowa+77/ 2zKXvBAApT2XkOxpPRRmhjawh/axbHG3NXBldiYe9DAupE4eVJLxLnv8/tf+WWHU oru0vdOBaO1H8VwNi22P+aXo+29HARKawlwhVmgd2auSYzrR+UaSTSwLTN0UO8e/ KCG2LHPMrTnZjPmlWdVRjOq44hkwes32yByjGrVz6cuwtss7XAdDmxuRGpRjHB47 EVBstReybfepSXEhPJTB+yUfUpnVZ9G4nUBDlBODHHY8T2FPB8AMQmXAUGSIn96Y V33lIyiQ92gBrp3UmppfegOU+Clt18UD9tGs00UmIRlagclS9gUcUrY8CeKKMOJ5 PYjsyqjiBLTVO58lKAjXEcAOMs0us+psxmSgzqBw52bLhxlwUDytwMUJUcQiERme zG6lz2lbZ45PMzrtKcm4fAxoJyQgwyf5zrQG5iyqvkmngQoo3ONlqZsZPz9GQffi C6uB8lmRvJM4FcPs/w2Ee6bXA3xk9ClGWryFGwdJM49nGMPXyzDx3/nc5KlOAXAn QPqFSy+kEuzXGJXQZcYwj0o/xNU3B+EecZH148xuAzBHpk8yQd07ZOGhwJFnUq+N r/cr0pr4A74t+J38Bb4vLKcWgg2pqISqX6zf/0VyYEa6o7dvMxG31gRw+z/Tv+Ln 2WKY/wWvJHbfFuhED7uNtMfiKq8JA2ZxyKi9z/V5G780/89soG0= =BrzD -----END PGP SIGNATURE----- --bHQR9+uNWFqbSKv/-- Of which the main body part is precisely this: ``` Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Date: Mon, 1 Apr 2024 21:40:04 +0200 From: Alejandro Colomar <[email protected]> To: [email protected] Subject: After Supposedly, migadu is fixed now. Let's see ``` Note no trailing blank. When verifying the signature, that blank line belongs to the encapsulation boundary, and if included, it would fail the verification. See <#4229> for that. Then, a MIME part can be further subdivided. Quoting RFC1521: > Each part starts with an encapsulation boundary, and then contains a > body part consisting of header area, a blank line, and a body area. This RFC has been obsoleted by RFC2045, but the new one is less clear in the wording, and probably nothing really changed, so don't worry about it. This says that the blank line between the headers and the body is *not* part of the body. This is very much like with HTTP messages. [neo]mutt(1), however, when displaying signed/encrypted email, printed both the separating blank and the trailing blank (or it invented a blank line before and after the body, however it is; it might be that, since the blank goes even before the protected subject, if there is one). These blanks were spurious, and may lead to think that the original body actually has those blanks. That's a lie. Not a big one, but a lie. Trimming those 2 blanks makes the output more correct, faithful to the original message as it was sent, and less consuming of non-renewable resources (think of 24-rows here). Closes: <#4242> Link: <#4221 (comment)> Link: <#4229> Link: <https://datatracker.ietf.org/doc/html/rfc1521#section-7.2> Link: <https://datatracker.ietf.org/doc/html/rfc2045#section-2.4> Cc: наб <[email protected]> Cc: Pietro Cerutti <[email protected]> Signed-off-by: Alejandro Colomar <[email protected]>
Some users want to be able to turn this feature off. But default to 'yes', since it's better to not hide crypto-related info, unless the user explicitly says they don't care about it. Link: <neomutt#4221> Suggested-by: наб <[email protected]> Signed-off-by: Alejandro Colomar <[email protected]>
|
v8b (by @flatcap ) changes:
|
|
v9 changes:
|
Some users want to be able to turn this feature off. But default to 'yes', since it's better to not hide crypto-related info, unless the user explicitly says they don't care about it. Link: <neomutt#4221> Suggested-by: наб <[email protected]> Signed-off-by: Alejandro Colomar <[email protected]>
Some users want to be able to turn this feature off. But default to 'yes', since it's better to not hide crypto-related info, unless the user explicitly says they don't care about it. Link: <neomutt#4221> Suggested-by: наб <[email protected]> Signed-off-by: Alejandro Colomar <[email protected]>
|
v9b changes:
|
This is a small refactor in preparation for the next commit. Signed-off-by: Alejandro Colomar <[email protected]>
Show a block of information about the encryption of a message, which includes the recipients that can decrypt the message. This info isn't necessarily complete: the sender could hide some recipients, so that they are able to decrypt the message, but aren't listed. See gpg(1) options --recipient and --hidden-recipient. I'm not sure, but I suspect a malicious sender could also add fake recipients, which are listed, but cannot really decrypt the message. Therefore, this should be taken only as an informative block, and with a pinch of salt. It would be good to protect the To and Cc header fields, to provide a guarantee to the recipient that the listed recipients match the original recipients as intended by the sender. See the bug neomutt#4223 linked below. Closes: <neomutt#4163> Link: <https://www.gnupg.org/documentation/manuals/gpgme.pdf#Public%20Key%20Algorithms> Link: <https://www.gnupg.org/documentation/manuals/gpgme.pdf#Decrypt> Link: <https://linux.codidact.com/posts/291205> Link: <neomutt#4223> Co-developed-by: Richard Russon <[email protected]> Cc: Werner Koch <[email protected]> Cc: наб <[email protected]> Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
Some users want to be able to turn this feature off. But default to 'yes', since it's better to not hide crypto-related info, unless the user explicitly says they don't care about it. Link: <neomutt#4221> Suggested-by: наб <[email protected]> Signed-off-by: Alejandro Colomar <[email protected]>
|
|
Thanks! :-) |
Show a block of information about the encryption of a message, which includes the recipients that can decrypt the message.
This info isn't necessarily complete: the sender could hide some recipients, so that they are able to decrypt the message, but aren't listed. See gpg(1) options --recipient and --hidden-recipient. I'm not sure, but I suspect a malicious sender could also add fake recipients, which are listed, but cannot really decrypt the message.
Therefore, this should be taken only as an informative block, and with a pinch of salt.
Closes: #4163
Cc: @flatcap
Cc: @dd9jn
What does this PR do?
Show encryption information about a message.
Screenshots (if relevant)
Unencrypted mail:
Encrypted mail:
Does this PR meet the acceptance criteria? (This is just a reminder for you,
this section can be removed if you fulfill it.)
Documentation created/updated (you have to edit
docs/manual.xml.head
for that)
Not yet.
All builds and tests are passing
It builds (and runs) on my PC.
Added doxygen code documentation
syntax
Small, but yeah. I may need to expand those a little bit.
Code follows the style guide
I think so.
What are the relevant issue numbers?
Show information about the encryption of a message #4163
Revisions
v9c
v9c changes (by @flatcap ):Merged
Merged: