3 test_description="protected headers in emacs interface"
4 . $(dirname "$0")/test-lib.sh || exit 1
5 . $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
7 # testing protected headers with emacs
10 add_email_corpus protected-headers
12 test_begin_subtest "notmuch-search should show not unindexed protected subject header in emacs"
13 test_emacs '(notmuch-search "id:protected-header@crypto.notmuchmail.org")
17 2000-01-01 [1/1] test_suite@notmuchmail.org Subject Unavailable (encrypted inbox unread)
18 End of search results.
20 test_expect_equal_file EXPECTED OUTPUT
22 test_begin_subtest "notmuch-show should not show unindexed protected subject header in emacs when nm-c-process-mime is nil"
23 test_emacs '(let ((notmuch-crypto-process-mime nil))
24 (notmuch-show "id:protected-header@crypto.notmuchmail.org")
27 test_suite@notmuchmail.org (2000-01-01) (encrypted inbox)
28 Subject: Subject Unavailable
29 To: test_suite@notmuchmail.org
30 Date: Sat, 01 Jan 2000 12:00:00 +0000
32 [ multipart/encrypted ]
33 [ Unknown encryption status ]
34 [ application/pgp-encrypted ]
35 [ application/octet-stream ]
37 test_expect_equal_file EXPECTED OUTPUT
39 test_begin_subtest "notmuch-show should show protected subject header in emacs"
40 test_emacs '(notmuch-show "id:protected-header@crypto.notmuchmail.org")
43 test_suite@notmuchmail.org (2000-01-01) (encrypted inbox)
44 Subject: This is a protected header
45 To: test_suite@notmuchmail.org
46 Date: Sat, 01 Jan 2000 12:00:00 +0000
48 [ multipart/encrypted ]
49 [ Decryption successful ]
50 [ application/pgp-encrypted ]
52 This is the sekrit message
54 test_expect_equal_file EXPECTED OUTPUT
56 # notmuch-emacs still leaks the subject line; as long as it leaks the
57 # subject line, it should emit the external subject, not the protected
58 # subject, even if it knows what the true subject is:
59 test_begin_subtest "Reply within emacs to a message with protected headers, not leaking subject"
60 test_emacs "(let ((message-hidden-headers '()))
61 (notmuch-show \"id:protected-header@crypto.notmuchmail.org\")
65 From: Notmuch Test Suite <test_suite@notmuchmail.org>
66 To: test_suite@notmuchmail.org
67 Subject: Re: Subject Unavailable
68 In-Reply-To: <protected-header@crypto.notmuchmail.org>
70 References: <protected-header@crypto.notmuchmail.org>
71 --text follows this line--
72 <#secure method=pgpmime mode=signencrypt>
73 test_suite@notmuchmail.org writes:
75 > This is the sekrit message
77 test_expect_equal_file EXPECTED OUTPUT
79 # protected headers should behave differently after re-indexing
80 test_begin_subtest 'defaulting to indexing cleartext'
81 test_expect_success 'notmuch config set index.decrypt true'
82 test_begin_subtest 'try reindexing protected header message'
83 test_expect_success 'notmuch reindex id:protected-header@crypto.notmuchmail.org'
85 test_begin_subtest "notmuch-search should show indexed protected subject header in emacs"
86 test_emacs '(notmuch-search "id:protected-header@crypto.notmuchmail.org")
90 2000-01-01 [1/1] test_suite@notmuchmail.org This is a protected header (encrypted inbox)
91 End of search results.
93 test_expect_equal_file EXPECTED OUTPUT
95 # notmuch-emacs still leaks the subject line:
96 test_begin_subtest "don't leak protected subject during reply, even if indexed"
97 test_emacs "(let ((message-hidden-headers '()))
98 (notmuch-show \"id:protected-header@crypto.notmuchmail.org\")
102 From: Notmuch Test Suite <test_suite@notmuchmail.org>
103 To: test_suite@notmuchmail.org
104 Subject: Re: Subject Unavailable
105 In-Reply-To: <protected-header@crypto.notmuchmail.org>
106 Fcc: ${MAIL_DIR}/sent
107 References: <protected-header@crypto.notmuchmail.org>
108 --text follows this line--
109 <#secure method=pgpmime mode=signencrypt>
110 test_suite@notmuchmail.org writes:
112 > This is the sekrit message
114 test_expect_equal_file EXPECTED OUTPUT