aboutsummaryrefslogtreecommitdiff
path: root/test/T350-crypto.sh
AgeCommit message (Collapse)Author
2025-02-28Accept "key-missing" from a signature from a revoked keyDaniel Kahn Gillmor
We have traditionally expected a signature to show up as "revoked" when the signing key is revoked. However, GnuPG's recent fix to avoid a denial of service against legitimate signatures appears to have changed the status of signature verification from keys which happen to have been revoked. See https://bugs.debian.org/1098995 and https://dev.gnupg.org/T7547 This change makes the test suite a little bit less brittle while we look for a resolution from upstream. It should probably also be backported to debian unstable unless a notmuch release to unstable is imminent. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2023-07-21test: support testing notmuch as installedDavid Bremner
We put some effort into testing the built copy rather than some installed copy. On the other hand for people like packagers, testing the installed copy is also of interest. When NOTMUCH_TEST_INSTALLED is set to a nonempty value, tests do not require a built notmuch tree or running configure. Some of the tests marked as broken when running against installed notmuch are probably fixable.
2022-09-19test: compute expected keyid from fingerprintJustus Winter
2022-01-26emacs: use cached encoded copy for fccDavid Bremner
This fixes the bug reported by dkg in [1]. The movement of the call to n-m-setup-message-for-saving is so the cleanup of Fcc headers happens in the encoded version (otherwise Fcc headers may be saved to disk). [1]: id:87k1zm225v.fsf@fifthhorseman.net
2022-01-26test/emacs: known broken test for matching fcc and sent messageDavid Bremner
Based on the method outlined by Daniel Kahn Gillmor in id:87k1zm225v.fsf@fifthhorseman.net. With a delay of 0.2 seconds the test becomes flaky on my machine. With a 1 second delay it fails consistently for more than 1600 iterations.
2021-06-26cli/show: produce "email" element in sigstatusDaniel Kahn Gillmor
When the certificate that signs a message is known to be valid, GMime is capable of reporting on the e-mail address embedded in the certificate. We pass this information along to the caller of "notmuch show", as often only the e-mail address of the certificate has actually been checked/verified. Furthermore, signature verification should probably at some point compare the e-mail address of the caller against the sender address of the message itself. Having to parse what gmime thinks is a "userid" to extract an e-mail address seems clunky and unnecessary if gmime already thinks it knows what the e-mail address is. See id:878s41ax6t.fsf@fifthhorseman.net for more motivation and discussion. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2021-06-03test: source $NOTMUCH_SRCDIR/test/test-lib-emacs.shTomi Ollila
Sourcing test-lib.sh will cd to TMP_DIRECTORY, so relative path in $0 will not work in previous version . $(dirname "$0")/test-lib-emacs.sh Now individual test scripts -- e.g. ./test/T310-emacs.sh will work.
2021-05-17test: split emacs functionality to its own fileFelipe Contreras
This way it's easier to identify the tests that do require emacs stuff. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-01test: add external prereqs to many emacs testsFelipe Contreras
The tests fail otherwise. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2019-05-26cli/show: emit new whole-message crypto status outputDaniel Kahn Gillmor
This allows MUAs that don't want to think about per-mime-part cryptographic status to have a simple high-level overview of the message's cryptographic state. Sensibly structured encrypted and/or signed messages will work fine with this. The only requirement for the simplest encryption + signing is that the message have all of its encryption and signing protection (the "cryptographic envelope") in a contiguous set of MIME layers at the very outside of the message itself. This is because messages with some subparts signed or encrypted, but with other subparts with no cryptographic protection is very difficult to reason about, and even harder for the user to make sense of or work with. For further characterization of the Cryptographic Envelope and some of the usability tradeoffs, see here: https://dkg.fifthhorseman.net/blog/e-mail-cryptography.html#cryptographic-envelope
2019-05-07test/crypto: add_gnupg_home should have ultimate trust on "its own" keyDaniel Kahn Gillmor
The typical use case for gpg is that if you control a secret key, you mark it with "ultimate" ownertrust. The opaque --import-ownertrust mechanism is GnuPG's standard mechanism to set up ultimate ownertrust (the ":6:" means "ultimate", for whatever reason). We adjust the test suite to match this change, inverting the sense of one test: since the default is now that the user ID of the suite's own key is valid, we change the test to make sure that the user ID is not emitted when it is *not* valid. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-05-07test: simplify user ID handlingDaniel Kahn Gillmor
The user ID on the self-test is a little bit clunky-looking. It also may end up showing up elsewhere in the test suite. Centralizing the user ID in one place should make it easier to handle if it ever changes, and should make tests easier to read. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-05-07test/crypto: clarify the difference between ownertrust and validityDaniel Kahn Gillmor
This is a subtle difference, but the output of notmuch shouldn't ever change based on ownertrust itself -- notmuch is intended to show valid User IDs, and to avoid showing invalid User IDs. It so happens that setting ownertrust of a key to ultimate sets all associated user IDs to "full" validity, so the test is correct, but just misnamed. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-05-03gmime-cleanup: tests should only care about gmime 3Daniel Kahn Gillmor
note that "notmuch-show for message with invalid From" is still broken in T310-emacs.sh. It would be good to debug what's going on there and try to get it fixed! signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-04-26crypto: Avoid pretending to verify signatures on unsigned encrypted mailDaniel Kahn Gillmor
Unsigned encrypted mail shows up with a weird empty signature list. If we successfully decrypted and there was no signature in it, we should just not show a sigstatus at all. The documentation for g_mime_decrypt_result_get_signatures says: a GMimeSignatureList or NULL if the stream was not signed.
2019-04-24tests: move FINGERPRINT definition to add_gnupg_homeDaniel Kahn Gillmor
If a test has added a GnuPG homedir, it may well want to know the fingerprint. This saves us from having to redefine this magic string in multiple places when more tests eventually use the GnuPG homedir.
2018-12-07reply: Include sender as recipient if they were the original recipientDavid Edmondson
When generating a reply message, if the user was the originator and only recipient of the original message, include the user as a recipient of the reply.
2017-12-29cli/reply: make --decrypt take a keywordDaniel Kahn Gillmor
This brings the --decrypt argument to "notmuch reply" into line with the other --decrypt arguments (in "show", "new", "insert", and "reindex"). This patch is really just about bringing consistency to the user interface. We also use the recommended form in the emacs MUA when replying, and update test T350 to match.
2017-12-29cli/show: make --decrypt take a keyword.Daniel Kahn Gillmor
We also expand tab completion for it, update the emacs bindings, and update T350, T357, and T450 to match. Make use of the bool-to-keyword backward-compatibility feature.
2017-10-20test: use $(dirname "$0") for sourcing test-lib.shJani Nikula
Don't assume the tests are always run from within the source tree.
2017-10-14tests: prepare for more crypto tests (using add_gnupg_home)Daniel Kahn Gillmor
Move add_gnupg_home to test-lib.sh to prepare it for reuse.
2017-09-17lib: index the content-type of the parts of encrypted messagesDaniel Kahn Gillmor
This is a logical followup to "lib: index the content type of signature parts", which will make it easier to record the message structure of all messages.
2017-09-17lib: index the content type of signature partsJani Nikula
It's useful (*) to be able to easily find messages with certain types of signatures. Having the mimetype: prefix searches fail for some content types is also genuinely surprising (*). Index the content type of signature parts. While at it, switch to the gmime convenience constants for content and signature part indexes. *) At least for developers of email software!
2017-09-17test: signed and encrypted part content type indexingJani Nikula
Add known broken subtests for searching signed and encrypted messages using mimetype: prefix search for the content-types of signed and encrypted parts.
2017-09-03test/crypto: remove headers more robustlyDavid Bremner
In [1], Vladimir Panteleev observed that the In-Reply-To and References headers could be wrapped in the 'default' output format of notmuch-reply, depending on the version of Emacs creating the message. In my own experiments notmuch-reply sometimes wraps headers with only one message-id if that message-id is long enough. However it happens, this causes the previous approach using grep to fail. Since I found the proposed unwrapping shell fragment in [1] a bit hard to follow, I decided to write a little python script instead. Then Tomi suggested a slight generalization of my script, and here we are. [1] id:20170817175145.3204-7-notmuch@thecybershadow.net
2017-07-14test/crypto: mark extra space in userid as a bug in gmime-2.6David Bremner
I can't see the space in the output of gpg -K --with-colons
2017-07-05test/crypto: add test for corrupted signaturesDavid Bremner
Have an empty list of signatures is not the nicest mechanism to signal complete failure to verify, but it's the one we currently have.
2017-07-05test: add test for modified pgp/mime signed messageDavid Bremner
This is a good thing to test in any case, but particularly as we hit the dark corners of the gmime crypto API.
2017-07-04cli: implement structured output version 4David Bremner
Since the error field is unused by the emacs front end, no changes are needed other than bumping the format version number. As it is, this is a bit overengineered, but it will reduce duplication when we support gmime 3.0
2017-05-26exit lingering gpg agents at the end of relevant testsTomi Ollila
Since gnupg 2.1.20, gpg-agent no longer shut itself down when $GNUPGHOME directory is removed. Add exit hooks to the test modules which execute `gpgconf --kill all` Add exit hooks to execute `gpgconf --kill all` in the modules that create $GNUPGHOME for gpg to work with.
2017-04-06test: standardize argument order to test_expect_equal_fileDavid Bremner
It is annoying to debug failing tests when the interpretation of the diffs is reversed for some tests.
2017-03-09test: require test_begin_subtest before test_expect_successJani Nikula
Unify the subtests by requiring test_begin_subtest before test_expect_success. (Similar change for test_expect_code will follow.) This increases clarity in the test scripts by having a separate line for the start of the subtest with the heading, and makes it possible to simplify the test infrastructure by making all subtests similar.
2017-02-28cli/show: add content-disposition to structured output message partsJani Nikula
Help the clients decide how to display parts. Test updates by Mark Walters <markwalters1009@gmail.com>. One more test fix by db
2017-02-26cli/show: list all filenames of a message in the formatted outputJani Nikula
Instead of just having the first filename for the message, list all duplicate filenames of the message as a list in the formatted outputs. This bumps the format version to 3.
2016-11-24tests: account for varying-size cryptographic signaturesDaniel Kahn Gillmor
GnuPG 2.1.16 is now injecting the full issuer fingerprint in its signatures, which makes them about 32 octets larger when ascii-armored. This change in size means that the size of the MIME parts will vary depending on the version of gpg that the user has installed. at any rate, the signature part should be non-zero (this is true for basically any MIME part), so we just test for that instead of an exact size.
2016-09-18emacs: reply: remove wrong sig/enc status buttonsMark Walters
This stops the (usually incorrect) sigstatus and encstatus buttons appearing when replying in emacs, and updates the test suite to match. Overriding the status button functions is a little unusual but much less intrusive than passing an argument all the way down the call chain. It also makes it clear exactly what it does. We also hide the application/pgp-encrypted part as it can only contain "Version: 1". We do this in notmuch show, which means it also happens when replying.
2016-09-18test/crypto: test reply to encrypted message in emacsDavid Bremner
This test considers the extra output about encryption/signature status as a bug, to be fixed in the next commit
2016-09-08test/crypto: hard code fingerprintDavid Bremner
Originally the intent was to make the test more robust against changing test keys. It turns out that (unscientifically) gpg --with-colons output changes more often than our test key. Rather than making the script more complex, just hard code the fingerprint. This fixes Debian bug #847013; I expect similar test failures as other distros adopt gnupg 2.1.15
2015-08-07test: make script exit (1) if it "fails" to source (.) a fileTomi Ollila
The files (test) scripts source (with builtin command `.`) provides information which the scripts depend, and without the `source` to succeed allowing script to continue may lead to dangerous situations (e.g. rm -rf "${undefined_variable}"/*). At the end of all source (.) lines construct ' || exit 1' was added; In our case the script script will exit if it cannot find (or read) the file to be sourced. Additionally script would also exits if the last command of the sourced file exited nonzero.
2014-01-13test: renamed test scripts to format T\d\d\d-name.shTomi Ollila
All test scripts to be executed are now named as T\d\d\d-name.sh, numers in increments of 10. This eases adding new tests and developers to see which are test scripts that are executed by test suite and in which order.