From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 3E5326DE1492 for ; Sun, 26 May 2019 15:16:32 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.179 X-Spam-Level: X-Spam-Status: No, score=-0.179 tagged_above=-999 required=5 tests=[AWL=0.022, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jfDCmRRDV75j for ; Sun, 26 May 2019 15:16:31 -0700 (PDT) Received: from che.mayfirst.org (che.mayfirst.org [162.247.75.118]) by arlo.cworth.org (Postfix) with ESMTPS id 00F4B6DE1309 for ; Sun, 26 May 2019 15:16:21 -0700 (PDT) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/simple; d=fifthhorseman.net; i=@fifthhorseman.net; q=dns/txt; s=2019; t=1558908978; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : from; bh=clAUIEpuWp/sOgDWKncIZ2aDNA8gsC6PiRsuPNyUAOw=; b=qqnsAIsp2br9BhWCeM+4NsqCq4GMAnEzW3z/aJSka+auXjzoYrx5MHx4 PLOcngoUlGU7Adh4PPkk2MVy1RK7CA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fifthhorseman.net; i=@fifthhorseman.net; q=dns/txt; s=2019rsa; t=1558908978; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : from; bh=clAUIEpuWp/sOgDWKncIZ2aDNA8gsC6PiRsuPNyUAOw=; b=eTlisOHesn9erHRu1JxzLq9fma1CrnsmzF5NTnT8lye95bw0JjQMyoRb rJ50q7UUtlueHOg9HWd0brNDITQRSx2Tve16UoqXimJ4B/TwCz3R0XGWHT rP9g9Cy0JW5HgrBIR0OzLeNdqJ0DuPcWMfBxewp/veSrfy06nDN9L90dgt q7xE/zaskW9Cf/+s4qp1XR0tNRMf40Gj2QOIO50Iuh7pLyvZqZyoLlBdVa /e0gfsC4oCEfNusw1w0tu82zfAHam9WZLENBImsKP7L/NjnIsw74x6iEcg Yl/x6WFnN+uKsLtnNXYeMSvg9AU/QOleU0xL+VQvZap0zsmRLPFaxw== Received: from fifthhorseman.net (cpe-74-71-53-242.nyc.res.rr.com [74.71.53.242]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by che.mayfirst.org (Postfix) with ESMTPSA id B7389F9AB for ; Sun, 26 May 2019 18:16:18 -0400 (EDT) Received: by fifthhorseman.net (Postfix, from userid 1000) id 6059D20E84; Sun, 26 May 2019 18:16:14 -0400 (EDT) From: Daniel Kahn Gillmor To: Notmuch Mail Subject: [PATCH v2 07/17] test: add test for missing external subject Date: Sun, 26 May 2019 18:16:00 -0400 Message-Id: <20190526221610.2833-8-dkg@fifthhorseman.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190526221610.2833-1-dkg@fifthhorseman.net> References: <20190526221610.2833-1-dkg@fifthhorseman.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 May 2019 22:16:32 -0000 Adding another test to ensure that we handle protected headers gracefully when no external subject is present. Signed-off-by: Daniel Kahn Gillmor --- test/T356-protected-headers.sh | 6 ++++ .../subjectless-protected-header.eml | 29 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 test/corpora/protected-headers/subjectless-protected-header.eml 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----- +--=-=-=-- -- 2.20.1