From: Daniel Kahn Gillmor Date: Sun, 26 May 2019 22:16:00 +0000 (-0400) Subject: test: add test for missing external subject X-Git-Tag: archive/debian/0.29_rc0-1~14 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=1c879f39391b1144bfb2328fe778ab7d7e582100 test: add test for missing external subject Adding another test to ensure that we handle protected headers gracefully when no external subject is present. Signed-off-by: Daniel Kahn Gillmor --- diff --git a/test/T356-protected-headers.sh b/test/T356-protected-headers.sh index 68d431e9..59ab58d7 100755 --- a/test/T356-protected-headers.sh +++ b/test/T356-protected-headers.sh @@ -25,6 +25,12 @@ test_json_nodes <<<"$output" \ 'crypto:[0][0][0]["crypto"]={"decrypted": {"status": "full", "header-mask": {"Subject": "Subject Unavailable"}}}' \ 'subject:[0][0][0]["headers"]["Subject"]="This is a protected header"' +test_begin_subtest "when no external header is present, show masked subject as null" +output=$(notmuch show --decrypt=true --format=json id:subjectless-protected-header@crypto.notmuchmail.org) +test_json_nodes <<<"$output" \ + 'crypto:[0][0][0]["crypto"]={"decrypted": {"status": "full", "header-mask": {"Subject": null}}}' \ + 'subject:[0][0][0]["headers"]["Subject"]="This is a protected header"' + test_begin_subtest "misplaced protected headers should not be made visible during decryption" output=$(notmuch show --decrypt=true --format=json id:misplaced-protected-header@crypto.notmuchmail.org) test_json_nodes <<<"$output" \ diff --git a/test/corpora/protected-headers/subjectless-protected-header.eml b/test/corpora/protected-headers/subjectless-protected-header.eml new file mode 100644 index 00000000..7163b9ae --- /dev/null +++ b/test/corpora/protected-headers/subjectless-protected-header.eml @@ -0,0 +1,29 @@ +From: test_suite@notmuchmail.org +To: test_suite@notmuchmail.org +Date: Sat, 01 Jan 2000 12:00:00 +0000 +Message-ID: +MIME-Version: 1.0 +Content-Type: multipart/encrypted; boundary="=-=-="; + protocol="application/pgp-encrypted" + +--=-=-= +Content-Type: application/pgp-encrypted + +Version: 1 + +--=-=-= +Content-Type: application/octet-stream +Subject: this should not show up as a protected header + +-----BEGIN PGP MESSAGE----- + +hIwDxE023q1UqxYBA/9ZaOuxGtLVWiA7KQfB+4td1AILd1uy039UDb+9YwlhmJTq +mNqVJu+ZkFniZPMliM0z1QRBkBeL2Q7MrHAdYxYBKrDHKVja4O7jwqeKjy5BzQCW +fnyT+sb2Mh+dz5P2voF3XJHgqzhFY1rtVEatXSZADwwIVU6oZqGZ8GOELNGSd9KX +ASNElH7WGZB/TQ5X+MktzOLExx5QWaRK9skogI2RRoOquS7KpMcjzb2FWaJDjr1s +RGboX7NG3xCvNUV2ByFTvLOeo7eO1GfUsabTUbMMvh3AE1UvHgCu8VJiRrMdmPln +BM2xnwCYec6wYJ46fHukTgv+286nSQcV0XT6a+qM5GMgV5DMHW2vSyl6kTszJ3EP +xvQBfPCItA== +=Gkxz +-----END PGP MESSAGE----- +--=-=-=--