X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2FT358-emacs-protected-headers.sh;h=bca78531af616f9258fef8efc964264def92d71a;hp=a631223eabac0b089ba642acbab27dafd42bdffe;hb=HEAD;hpb=cd8006886b1c80ff556a96f1e84e3d3914067a54 diff --git a/test/T358-emacs-protected-headers.sh b/test/T358-emacs-protected-headers.sh index a631223e..96e42bf3 100755 --- a/test/T358-emacs-protected-headers.sh +++ b/test/T358-emacs-protected-headers.sh @@ -1,9 +1,11 @@ #!/usr/bin/env bash -test_description="emacs interface" +test_description="protected headers in emacs interface" . $(dirname "$0")/test-lib.sh || exit 1 +. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1 # testing protected headers with emacs +test_require_emacs add_gnupg_home add_email_corpus protected-headers @@ -51,6 +53,29 @@ This is the sekrit message EOF test_expect_equal_file EXPECTED OUTPUT +# notmuch-emacs still leaks the subject line; as long as it leaks the +# subject line, it should emit the external subject, not the protected +# subject, even if it knows what the true subject is: +test_begin_subtest "Reply within emacs to a message with protected headers, not leaking subject" +test_emacs "(let ((message-hidden-headers '())) + (notmuch-show \"id:protected-header@crypto.notmuchmail.org\") + (notmuch-show-reply) + (test-output))" +cat <EXPECTED +From: Notmuch Test Suite +To: test_suite@notmuchmail.org +Subject: Re: Subject Unavailable +In-Reply-To: +Fcc: ${MAIL_DIR}/sent +References: +--text follows this line-- +<#secure method=pgpmime mode=signencrypt> +test_suite@notmuchmail.org writes: + +> This is the sekrit message +EOF +test_expect_equal_file EXPECTED OUTPUT + # protected headers should behave differently after re-indexing test_begin_subtest 'defaulting to indexing cleartext' test_expect_success 'notmuch config set index.decrypt true' @@ -67,4 +92,25 @@ End of search results. EOF test_expect_equal_file EXPECTED OUTPUT +# notmuch-emacs still leaks the subject line: +test_begin_subtest "don't leak protected subject during reply, even if indexed" +test_emacs "(let ((message-hidden-headers '())) + (notmuch-show \"id:protected-header@crypto.notmuchmail.org\") + (notmuch-show-reply) + (test-output))" +cat <EXPECTED +From: Notmuch Test Suite +To: test_suite@notmuchmail.org +Subject: Re: Subject Unavailable +In-Reply-To: +Fcc: ${MAIL_DIR}/sent +References: +--text follows this line-- +<#secure method=pgpmime mode=signencrypt> +test_suite@notmuchmail.org writes: + +> This is the sekrit message +EOF +test_expect_equal_file EXPECTED OUTPUT + test_done