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