[PATCH v3 4/4] cli/show: emit new whole-message crypto status output
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Sat May 25 11:04:06 PDT 2019
This allows MUAs that don't want to think about per-mime-part
cryptographic status to have a simple high-level overview of the
message's cryptographic state.
Sensibly structured encrypted and/or signed messages will work fine
with this. The only requirement for the simplest encryption + signing
is that the message have all of its encryption and signing protection
(the "cryptographic envelope") in a contiguous set of MIME layers at
the very outside of the message itself.
This is because messages with some subparts signed or encrypted, but
with other subparts with no cryptographic protection is very difficult
to reason about, and even harder for the user to make sense of or work
with.
For further characterization of the Cryptographic Envelope and some of
the usability tradeoffs, see here:
https://dkg.fifthhorseman.net/blog/e-mail-cryptography.html#cryptographic-envelope
---
devel/schemata | 18 ++++++++++++++++++
notmuch-show.c | 29 +++++++++++++++++++++++++++++
test/T070-insert.sh | 1 +
test/T160-json.sh | 11 ++++++-----
test/T170-sexp.sh | 10 +++++-----
test/T190-multipart.sh | 4 +++-
test/T220-reply.sh | 1 +
test/T340-maildir-sync.sh | 1 +
test/T350-crypto.sh | 19 +++++++++++++++----
test/T355-smime.sh | 5 +++--
test/T470-missing-headers.sh | 2 ++
test/T510-thread-replies.sh | 11 +++++++++++
test/T670-duplicate-mid.sh | 1 +
13 files changed, 96 insertions(+), 17 deletions(-)
diff --git a/devel/schemata b/devel/schemata
index 42b1bcf3..72feb7b7 100644
--- a/devel/schemata
+++ b/devel/schemata
@@ -33,6 +33,8 @@ v3
v4
- replace signature error integer bitmask with a set of flags for
individual errors.
+- (notmuch 0.29) added message.crypto to identify overall message
+ cryptographic state
Common non-terminals
--------------------
@@ -73,9 +75,25 @@ message = {
tags: [string*],
headers: headers,
+ crypto: crypto,
body?: [part] # omitted if --body=false
}
+# when showing the message, was any or all of it decrypted?
+msgdecstatus: "full"|"partial"
+
+# The overall cryptographic state of the message as a whole:
+crypto = {
+ signed?: {
+ status: sigstatus,
+ # was the set of signatures described under encrypted cover?
+ encrypted: bool,
+ },
+ decrypted?: {
+ status: msgdecstatus,
+ }
+}
+
# A MIME part (format_part_sprinter)
part = {
id: int|string, # part id (currently DFS part number)
diff --git a/notmuch-show.c b/notmuch-show.c
index b95fc389..c6a7a10a 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -628,6 +628,35 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
format_part_sprinter (ctx, sp, mime_node_child (node, 0), true, include_html);
sp->end (sp);
}
+
+ if (notmuch_format_version >= 4) {
+ const _notmuch_message_crypto_t *msg_crypto = mime_node_get_message_crypto_status (node);
+ sp->map_key (sp, "crypto");
+ sp->begin_map (sp);
+ if (msg_crypto->sig_list ||
+ msg_crypto->decryption_status != NOTMUCH_MESSAGE_DECRYPTED_NONE) {
+ if (msg_crypto->sig_list) {
+ sp->map_key (sp, "signed");
+ sp->begin_map (sp);
+ sp->map_key (sp, "status");
+ format_part_sigstatus_sprinter (sp, msg_crypto->sig_list);
+ if (msg_crypto->signature_encrypted) {
+ sp->map_key (sp, "encrypted");
+ sp->boolean (sp, msg_crypto->signature_encrypted);
+ }
+ sp->end (sp);
+ }
+ if (msg_crypto->decryption_status != NOTMUCH_MESSAGE_DECRYPTED_NONE) {
+ sp->map_key (sp, "decrypted");
+ sp->begin_map (sp);
+ sp->map_key (sp, "status");
+ sp->string (sp, msg_crypto->decryption_status == NOTMUCH_MESSAGE_DECRYPTED_FULL ? "full" : "partial");
+ sp->end (sp);
+ }
+ }
+ sp->end (sp);
+ }
+
sp->end (sp);
return;
}
diff --git a/test/T070-insert.sh b/test/T070-insert.sh
index 05be473a..48165caa 100755
--- a/test/T070-insert.sh
+++ b/test/T070-insert.sh
@@ -48,6 +48,7 @@ test_begin_subtest "Insert message adds default tags"
output=$(notmuch show --format=json "subject:insert-subject")
expected='[[[{
"id": "'"${gen_msg_id}"'",
+ "crypto": {},
"match": true,
"excluded": false,
"filename": ["'"${cur_msg_filename}"'"],
diff --git a/test/T160-json.sh b/test/T160-json.sh
index 91b98e5d..004adb4e 100755
--- a/test/T160-json.sh
+++ b/test/T160-json.sh
@@ -5,16 +5,16 @@ test_description="--format=json output"
test_begin_subtest "Show message: json"
add_message "[subject]=\"json-show-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[bcc]=\"test_suite+bcc at notmuchmail.org\"" "[reply-to]=\"test_suite+replyto at notmuchmail.org\"" "[body]=\"json-show-message\""
output=$(notmuch show --format=json "json-show-message")
-test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": [\"${gen_msg_filename}\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"Bcc\": \"test_suite+bcc at notmuchmail.org\", \"Reply-To\": \"test_suite+replyto at notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"
+test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"crypto\": {}, \"match\": true, \"excluded\": false, \"filename\": [\"${gen_msg_filename}\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"Bcc\": \"test_suite+bcc at notmuchmail.org\", \"Reply-To\": \"test_suite+replyto at notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"
# This should be the same output as above.
test_begin_subtest "Show message: json --body=true"
output=$(notmuch show --format=json --body=true "json-show-message")
-test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": [\"${gen_msg_filename}\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"Bcc\": \"test_suite+bcc at notmuchmail.org\", \"Reply-To\": \"test_suite+replyto at notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"
+test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"crypto\": {}, \"match\": true, \"excluded\": false, \"filename\": [\"${gen_msg_filename}\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"Bcc\": \"test_suite+bcc at notmuchmail.org\", \"Reply-To\": \"test_suite+replyto at notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"
test_begin_subtest "Show message: json --body=false"
output=$(notmuch show --format=json --body=false "json-show-message")
-test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": [\"${gen_msg_filename}\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"Bcc\": \"test_suite+bcc at notmuchmail.org\", \"Reply-To\": \"test_suite+replyto at notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}}, []]]]"
+test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"crypto\": {}, \"match\": true, \"excluded\": false, \"filename\": [\"${gen_msg_filename}\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"Bcc\": \"test_suite+bcc at notmuchmail.org\", \"Reply-To\": \"test_suite+replyto at notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}}, []]]]"
test_begin_subtest "Search message: json"
add_message "[subject]=\"json-search-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"json-search-message\""
@@ -33,7 +33,7 @@ test_expect_equal_json "$output" "[{\"thread\": \"XXX\",
test_begin_subtest "Show message: json, utf-8"
add_message "[subject]=\"json-show-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-show-méssage\""
output=$(notmuch show --format=json "jsön-show-méssage")
-test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": [\"${gen_msg_filename}\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-utf8-body-sübjéct\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"jsön-show-méssage\n\"}]}, []]]]"
+test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"crypto\": {}, \"match\": true, \"excluded\": false, \"filename\": [\"${gen_msg_filename}\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-utf8-body-sübjéct\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"jsön-show-méssage\n\"}]}, []]]]"
test_begin_subtest "Show message: json, inline attachment filename"
subject='json-show-inline-attachment-filename'
@@ -48,7 +48,7 @@ output=$(notmuch show --format=json "id:$id")
filename=$(notmuch search --output=files "id:$id")
# Get length of README after base64-encoding, minus additional newline.
attachment_length=$(( $(base64 $NOTMUCH_SRCDIR/test/README | wc -c) - 1 ))
-test_expect_equal_json "$output" "[[[{\"id\": \"$id\", \"match\": true, \"excluded\": false, \"filename\": [\"$filename\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\"], \"headers\": {\"Subject\": \"$subject\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"test_suite at notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"multipart/mixed\", \"content\": [{\"id\": 2, \"content-type\": \"text/plain\", \"content\": \"This is a test message with inline attachment with a filename\"}, {\"id\": 3, \"content-type\": \"application/octet-stream\", \"content-length\": $attachment_length, \"content-transfer-encoding\": \"base64\", \"content-disposition\": \"inline\", \"filename\": \"README\"}]}]}, []]]]"
+test_expect_equal_json "$output" "[[[{\"id\": \"$id\", \"crypto\": {}, \"match\": true, \"excluded\": false, \"filename\": [\"$filename\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\"], \"headers\": {\"Subject\": \"$subject\", \"From\": \"Notmuch Test Suite <test_suite at notmuchmail.org>\", \"To\": \"test_suite at notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"multipart/mixed\", \"content\": [{\"id\": 2, \"content-type\": \"text/plain\", \"content\": \"This is a test message with inline attachment with a filename\"}, {\"id\": 3, \"content-type\": \"application/octet-stream\", \"content-length\": $attachment_length, \"content-transfer-encoding\": \"base64\", \"content-disposition\": \"inline\", \"filename\": \"README\"}]}]}, []]]]"
test_begin_subtest "Search message: json, utf-8"
add_message "[subject]=\"json-search-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-search-méssage\""
@@ -91,6 +91,7 @@ cat <<EOF > EXPECTED
"To": "Notmuch Test Suite <test_suite at notmuchmail.org>"
},
"id": "message-id at example.com",
+ "crypto": {},
"match": true,
"tags": [
"inbox",
diff --git a/test/T170-sexp.sh b/test/T170-sexp.sh
index c3dcf52a..fe7a9dff 100755
--- a/test/T170-sexp.sh
+++ b/test/T170-sexp.sh
@@ -5,16 +5,16 @@ test_description="--format=sexp output"
test_begin_subtest "Show message: sexp"
add_message "[subject]=\"sexp-show-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[bcc]=\"test_suite+bcc at notmuchmail.org\"" "[reply-to]=\"test_suite+replyto at notmuchmail.org\"" "[body]=\"sexp-show-message\""
output=$(notmuch show --format=sexp "sexp-show-message")
-test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :Bcc \"test_suite+bcc at notmuchmail.org\" :Reply-To \"test_suite+replyto at notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\"))) ())))"
+test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :Bcc \"test_suite+bcc at notmuchmail.org\" :Reply-To \"test_suite+replyto at notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\")) :crypto ()) ())))"
# This should be the same output as above.
test_begin_subtest "Show message: sexp --body=true"
output=$(notmuch show --format=sexp --body=true "sexp-show-message")
-test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :Bcc \"test_suite+bcc at notmuchmail.org\" :Reply-To \"test_suite+replyto at notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\"))) ())))"
+test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :Bcc \"test_suite+bcc at notmuchmail.org\" :Reply-To \"test_suite+replyto at notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\")) :crypto ()) ())))"
test_begin_subtest "Show message: sexp --body=false"
output=$(notmuch show --format=sexp --body=false "sexp-show-message")
-test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :Bcc \"test_suite+bcc at notmuchmail.org\" :Reply-To \"test_suite+replyto at notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\")) ())))"
+test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :Bcc \"test_suite+bcc at notmuchmail.org\" :Reply-To \"test_suite+replyto at notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :crypto ()) ())))"
test_begin_subtest "Search message: sexp"
add_message "[subject]=\"sexp-search-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"sexp-search-message\""
@@ -24,7 +24,7 @@ test_expect_equal "$output" "((:thread \"0000000000000002\" :timestamp 946728000
test_begin_subtest "Show message: sexp, utf-8"
add_message "[subject]=\"sexp-show-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-show-méssage\""
output=$(notmuch show --format=sexp "jsön-show-méssage")
-test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-utf8-body-sübjéct\" :From \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"jsön-show-méssage\n\"))) ())))"
+test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename (\"${gen_msg_filename}\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-utf8-body-sübjéct\" :From \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"jsön-show-méssage\n\")) :crypto ()) ())))"
test_begin_subtest "Search message: sexp, utf-8"
add_message "[subject]=\"sexp-search-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-search-méssage\""
@@ -44,6 +44,6 @@ output=$(notmuch show --format=sexp "id:$id")
filename=$(notmuch search --output=files "id:$id")
# Get length of README after base64-encoding, minus additional newline.
attachment_length=$(( $(base64 $NOTMUCH_SRCDIR/test/README | wc -c) - 1 ))
-test_expect_equal "$output" "((((:id \"$id\" :match t :excluded nil :filename (\"$filename\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\") :headers (:Subject \"sexp-show-inline-attachment-filename\" :From \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :To \"test_suite at notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"multipart/mixed\" :content ((:id 2 :content-type \"text/plain\" :content \"This is a test message with inline attachment with a filename\") (:id 3 :content-type \"application/octet-stream\" :content-disposition \"inline\" :filename \"README\" :content-transfer-encoding \"base64\" :content-length $attachment_length))))) ())))"
+test_expect_equal "$output" "((((:id \"$id\" :match t :excluded nil :filename (\"$filename\") :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\") :headers (:Subject \"sexp-show-inline-attachment-filename\" :From \"Notmuch Test Suite <test_suite at notmuchmail.org>\" :To \"test_suite at notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"multipart/mixed\" :content ((:id 2 :content-type \"text/plain\" :content \"This is a test message with inline attachment with a filename\") (:id 3 :content-type \"application/octet-stream\" :content-disposition \"inline\" :filename \"README\" :content-transfer-encoding \"base64\" :content-length $attachment_length)))) :crypto ()) ())))"
test_done
diff --git a/test/T190-multipart.sh b/test/T190-multipart.sh
index 5cfa9d33..6f715ff9 100755
--- a/test/T190-multipart.sh
+++ b/test/T190-multipart.sh
@@ -378,7 +378,7 @@ test_expect_success "notmuch show --format=text --part=8 'id:87liy5ap00.fsf at yoom
test_begin_subtest "--format=json --part=0, full message"
notmuch show --format=json --part=0 'id:87liy5ap00.fsf at yoom.home.cworth.org' >OUTPUT
cat <<EOF >EXPECTED
-{"id": "87liy5ap00.fsf at yoom.home.cworth.org", "match": true, "excluded": false, "filename": ["${MAIL_DIR}/multipart"], "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth <cworth at cworth.org>", "To": "cworth at cworth.org", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [
+{"id": "87liy5ap00.fsf at yoom.home.cworth.org", "crypto": {}, "match": true, "excluded": false, "filename": ["${MAIL_DIR}/multipart"], "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth <cworth at cworth.org>", "To": "cworth at cworth.org", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [
{"id": 1, "content-type": "multipart/signed", "content": [
{"id": 2, "content-type": "multipart/mixed", "content": [
{"id": 3, "content-type": "message/rfc822", "content-disposition": "inline", "content": [{"headers": {"Subject": "html message", "From": "Carl Worth <cworth at cworth.org>", "To": "cworth at cworth.org", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [
@@ -637,6 +637,7 @@ notmuch_json_show_sanitize <<EOF >EXPECTED
"In-reply-to": "<87liy5ap00.fsf at yoom.home.cworth.org>",
"References": "<87liy5ap00.fsf at yoom.home.cworth.org>"},
"original": {"id": "XXXXX",
+ "crypto": {},
"match": false,
"excluded": false,
"filename": ["YYYYY"],
@@ -728,6 +729,7 @@ cat_expected_head ()
{
cat <<EOF
[[[{"id": "htmlmessage", "match":true, "excluded": false, "date_relative":"2000-01-01",
+ "crypto": {},
"timestamp": 946684800,
"filename": ["${MAIL_DIR}/include-html"],
"tags": ["inbox", "unread"],
diff --git a/test/T220-reply.sh b/test/T220-reply.sh
index 4db3a958..b6d8f42a 100755
--- a/test/T220-reply.sh
+++ b/test/T220-reply.sh
@@ -278,6 +278,7 @@ test_expect_equal_json "$output" '
"id": 1
}
],
+ "crypto": {},
"date_relative": "2010-01-05",
"excluded": false,
"filename": ["'${MAIL_DIR}'/msg-014"],
diff --git a/test/T340-maildir-sync.sh b/test/T340-maildir-sync.sh
index 7fece5f2..7416dd61 100755
--- a/test/T340-maildir-sync.sh
+++ b/test/T340-maildir-sync.sh
@@ -45,6 +45,7 @@ test_expect_equal "$output" "adding-replied-tag:2,RS"
test_begin_subtest "notmuch show works with renamed file (without notmuch new)"
output=$(notmuch show --format=json id:${gen_msg_id} | notmuch_json_show_sanitize)
test_expect_equal_json "$output" '[[[{"id": "XXXXX",
+"crypto": {},
"match": true,
"excluded": false,
"filename": ["YYYYY"],
diff --git a/test/T350-crypto.sh b/test/T350-crypto.sh
index 3539bafe..0aada4df 100755
--- a/test/T350-crypto.sh
+++ b/test/T350-crypto.sh
@@ -25,7 +25,7 @@ test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; t
test_begin_subtest "signature verification"
output=$(notmuch show --format=json --verify subject:"test signed message 001" \
| notmuch_json_show_sanitize \
- | sed -e 's|"created": [1234567890]*|"created": 946728000|')
+ | sed -e 's|"created": [1234567890]*|"created": 946728000|g')
expected='[[[{"id": "XXXXX",
"match": true,
"excluded": false,
@@ -33,6 +33,7 @@ expected='[[[{"id": "XXXXX",
"timestamp": 946728000,
"date_relative": "2000-01-01",
"tags": ["inbox","signed"],
+ "crypto": {"signed": {"status": [{ "status": "good", "created": 946728000, "fingerprint": "'$FINGERPRINT'", "userid": "'"$SELF_USERID"'"}]}},
"headers": {"Subject": "test signed message 001",
"From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
"To": "test_suite at notmuchmail.org",
@@ -74,6 +75,7 @@ expected='[[[{"id": "XXXXX",
"timestamp": 946728000,
"date_relative": "2000-01-01",
"tags": ["inbox","signed"],
+ "crypto": {"signed": {"status": [{ "status": "bad", "keyid": "'$(echo $FINGERPRINT | cut -c 25-)'"}]}},
"headers": {"Subject": "bad signed message 001",
"From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
"To": "test_suite at notmuchmail.org",
@@ -112,6 +114,7 @@ output=$(notmuch show --format=json --verify subject:"bad signed message 002" \
| notmuch_json_show_sanitize \
| sed -e 's|"created": [1234567890]*|"created": 946728000|')
expected='[[[{"id": "XXXXX",
+ "crypto": {},
"match": true,
"excluded": false,
"filename": ["YYYYY"],
@@ -143,7 +146,7 @@ gpg --quiet --batch --no-tty --export-ownertrust > "$GNUPGHOME/ownertrust.bak"
echo "${FINGERPRINT}:3:" | gpg --quiet --batch --no-tty --import-ownertrust
output=$(notmuch show --format=json --verify subject:"test signed message 001" \
| notmuch_json_show_sanitize \
- | sed -e 's|"created": [1234567890]*|"created": 946728000|')
+ | sed -e 's|"created": [1234567890]*|"created": 946728000|g')
expected='[[[{"id": "XXXXX",
"match": true,
"excluded": false,
@@ -151,6 +154,7 @@ expected='[[[{"id": "XXXXX",
"timestamp": 946728000,
"date_relative": "2000-01-01",
"tags": ["inbox","signed"],
+ "crypto": {"signed": {"status": [{ "status": "good", "created": 946728000, "fingerprint": "'$FINGERPRINT'"}]}},
"headers": {"Subject": "test signed message 001",
"From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
"To": "test_suite at notmuchmail.org",
@@ -177,7 +181,7 @@ test_begin_subtest "signature verification with signer key unavailable"
mv "${GNUPGHOME}"{,.bak}
output=$(notmuch show --format=json --verify subject:"test signed message 001" \
| notmuch_json_show_sanitize \
- | sed -e 's|"created": [1234567890]*|"created": 946728000|')
+ | sed -e 's|"created": [1234567890]*|"created": 946728000|g')
expected='[[[{"id": "XXXXX",
"match": true,
"excluded": false,
@@ -185,6 +189,7 @@ expected='[[[{"id": "XXXXX",
"timestamp": 946728000,
"date_relative": "2000-01-01",
"tags": ["inbox","signed"],
+ "crypto": {"signed": {"status": [{"errors": {"key-missing": true}, "keyid": "'$(echo $FINGERPRINT | cut -c 25-)'", "status": "error"}]}},
"headers": {"Subject": "test signed message 001",
"From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
"To": "test_suite at notmuchmail.org",
@@ -264,6 +269,7 @@ expected='[[[{"id": "XXXXX",
"timestamp": 946728000,
"date_relative": "2000-01-01",
"tags": ["encrypted","inbox"],
+ "crypto": {"decrypted": {"status": "full"}},
"headers": {"Subject": "test encrypted message 001",
"From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
"To": "test_suite at notmuchmail.org",
@@ -315,6 +321,7 @@ output=$(notmuch show --format=json --decrypt=true subject:"test encrypted messa
| notmuch_json_show_sanitize \
| sed -e 's|"created": [1234567890]*|"created": 946728000|')
expected='[[[{"id": "XXXXX",
+ "crypto": {},
"match": true,
"excluded": false,
"filename": ["YYYYY"],
@@ -350,7 +357,7 @@ test_expect_success \
test_begin_subtest "decryption + signature verification"
output=$(notmuch show --format=json --decrypt=true subject:"test encrypted message 002" \
| notmuch_json_show_sanitize \
- | sed -e 's|"created": [1234567890]*|"created": 946728000|')
+ | sed -e 's|"created": [1234567890]*|"created": 946728000|g')
expected='[[[{"id": "XXXXX",
"match": true,
"excluded": false,
@@ -358,6 +365,9 @@ expected='[[[{"id": "XXXXX",
"timestamp": 946728000,
"date_relative": "2000-01-01",
"tags": ["encrypted","inbox"],
+ "crypto": {"signed": {"status": [{ "status": "good", "created": 946728000, "fingerprint": "'$FINGERPRINT'", "userid": "'"$SELF_USERID"'"}],
+ "encrypted": true },
+ "decrypted": {"status": "full"}},
"headers": {"Subject": "test encrypted message 002",
"From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
"To": "test_suite at notmuchmail.org",
@@ -433,6 +443,7 @@ expected='[[[{"id": "XXXXX",
"timestamp": 946728000,
"date_relative": "2000-01-01",
"tags": ["inbox","signed"],
+ "crypto": {"signed": {"status": [{"errors": {"key-revoked": true}, "keyid": "'$(echo $FINGERPRINT | cut -c 25-)'", "status": "error"}]}},
"headers": {"Subject": "test signed message 001",
"From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
"To": "test_suite at notmuchmail.org",
diff --git a/test/T355-smime.sh b/test/T355-smime.sh
index e410286b..336da917 100755
--- a/test/T355-smime.sh
+++ b/test/T355-smime.sh
@@ -50,8 +50,8 @@ test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "signature verification (notmuch CLI)"
output=$(notmuch show --format=json --verify subject:"test signed message 001" \
| notmuch_json_show_sanitize \
- | sed -e 's|"created": [-1234567890]*|"created": 946728000|' \
- -e 's|"expires": [-1234567890]*|"expires": 424242424|' )
+ | sed -e 's|"created": [-1234567890]*|"created": 946728000|g' \
+ -e 's|"expires": [-1234567890]*|"expires": 424242424|g' )
expected='[[[{"id": "XXXXX",
"match": true,
"excluded": false,
@@ -59,6 +59,7 @@ expected='[[[{"id": "XXXXX",
"timestamp": 946728000,
"date_relative": "2000-01-01",
"tags": ["inbox","signed"],
+ "crypto": {"signed": {"status": [{"fingerprint": "'$FINGERPRINT'", "status": "good","userid": "CN=Notmuch Test Suite","expires": 424242424, "created": 946728000}]}},
"headers": {"Subject": "test signed message 001",
"From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
"To": "test_suite at notmuchmail.org",
diff --git a/test/T470-missing-headers.sh b/test/T470-missing-headers.sh
index 555fd4e9..32b070ec 100755
--- a/test/T470-missing-headers.sh
+++ b/test/T470-missing-headers.sh
@@ -107,6 +107,7 @@ expected=$(notmuch_json_show_sanitize <<EOF
"id": 1
}
],
+ "crypto": {},
"date_relative": "2001-01-05",
"excluded": false,
"filename": ["YYYYY"],
@@ -137,6 +138,7 @@ expected=$(notmuch_json_show_sanitize <<EOF
"id": 1
}
],
+ "crypto": {},
"date_relative": "1970-01-01",
"excluded": false,
"filename": ["YYYYY"],
diff --git a/test/T510-thread-replies.sh b/test/T510-thread-replies.sh
index 5d6bea7e..8b96a1db 100755
--- a/test/T510-thread-replies.sh
+++ b/test/T510-thread-replies.sh
@@ -19,6 +19,7 @@ add_message '[in-reply-to]="mumble"' \
'[subject]="Re: one"'
output=$(notmuch show --format=json 'subject:one' | notmuch_json_show_sanitize)
expected='[[[{"id": "foo at one.com",
+ "crypto": {},
"match": true,
"excluded": false,
"filename": ["YYYYY"],
@@ -33,6 +34,7 @@ expected='[[[{"id": "foo at one.com",
"content-type": "text/plain",
"content": "This is just a test message (#1)\n"}]},
[[{"id": "msg-002 at notmuch-test-suite",
+ "crypto": {},
"match": true, "excluded": false,
"filename": ["YYYYY"],
"timestamp": 978709437, "date_relative": "2001-01-05",
@@ -53,6 +55,7 @@ add_message '[in-reply-to]="Your message of December 31 1999 <bar at baz.com>"' \
'[subject]="Re: two"'
output=$(notmuch show --format=json 'subject:two' | notmuch_json_show_sanitize)
expected='[[[{"id": "foo at two.com",
+ "crypto": {},
"match": true, "excluded": false,
"filename": ["YYYYY"],
"timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
@@ -63,6 +66,7 @@ expected='[[[{"id": "foo at two.com",
"body": [{"id": 1, "content-type": "text/plain",
"content": "This is just a test message (#3)\n"}]},
[[{"id": "msg-004 at notmuch-test-suite", "match": true, "excluded": false,
+ "crypto": {},
"filename": ["YYYYY"],
"timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
"headers": {"Subject": "Re: two",
@@ -82,6 +86,7 @@ add_message '[in-reply-to]="<foo at three.com>"' \
'[subject]="Re: three"'
output=$(notmuch show --format=json 'subject:three' | notmuch_json_show_sanitize)
expected='[[[{"id": "foo at three.com", "match": true, "excluded": false,
+ "crypto": {},
"filename": ["YYYYY"],
"timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
"headers": {"Subject": "three",
@@ -90,6 +95,7 @@ expected='[[[{"id": "foo at three.com", "match": true, "excluded": false,
"Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1,
"content-type": "text/plain", "content": "This is just a test message (#5)\n"}]},
[[{"id": "msg-006 at notmuch-test-suite", "match": true, "excluded": false,
+ "crypto": {},
"filename": ["YYYYY"],
"timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
"headers": {"Subject": "Re: three",
@@ -111,6 +117,7 @@ add_message '[in-reply-to]="<baz at four.com> (RFC822 4lyfe)"' \
'[subject]="neither"'
output=$(notmuch show --format=json 'subject:four' | notmuch_json_show_sanitize)
expected='[[[{"id": "foo at four.com", "match": true, "excluded": false,
+ "crypto": {},
"filename": ["YYYYY"],
"timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
"headers": {"Subject": "four",
@@ -119,6 +126,7 @@ expected='[[[{"id": "foo at four.com", "match": true, "excluded": false,
"Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1,
"content-type": "text/plain", "content": "This is just a test message (#7)\n"}]},
[[{"id": "msg-009 at notmuch-test-suite", "match": false, "excluded": false,
+ "crypto": {},
"filename": ["YYYYY"],
"timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
"headers": {"Subject": "neither",
@@ -127,6 +135,7 @@ expected='[[[{"id": "foo at four.com", "match": true, "excluded": false,
"Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1,
"content-type": "text/plain", "content": "This is just a test message (#9)\n"}]},
[]]]]], [[{"id": "bar at four.com", "match": true, "excluded": false,
+ "crypto": {},
"filename": ["YYYYY"],
"timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
"headers": {"Subject": "not-four",
@@ -145,6 +154,7 @@ add_message '[id]="bar at five.com"' \
'[subject]="not-five"'
output=$(notmuch show --format=json 'subject:five' | notmuch_json_show_sanitize)
expected='[[[{"id": "XXXXX", "match": true, "excluded": false,
+ "crypto": {},
"filename": ["YYYYY"], "timestamp": 42, "date_relative": "2001-01-05",
"tags": ["inbox", "unread"], "headers": {"Subject": "five",
"From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
@@ -153,6 +163,7 @@ expected='[[[{"id": "XXXXX", "match": true, "excluded": false,
"content-type": "text/plain",
"content": "This is just a test message (#10)\n"}]},
[[{"id": "XXXXX", "match": true, "excluded": false,
+ "crypto": {},
"filename": ["YYYYY"], "timestamp": 42, "date_relative": "2001-01-05",
"tags": ["inbox", "unread"],
"headers": {"Subject": "not-five",
diff --git a/test/T670-duplicate-mid.sh b/test/T670-duplicate-mid.sh
index fd7df057..c17ccb69 100755
--- a/test/T670-duplicate-mid.sh
+++ b/test/T670-duplicate-mid.sh
@@ -92,6 +92,7 @@ output=$(notmuch show --body=false --format=json id:duplicate |
notmuch_json_show_sanitize | sed 's/message [0-9]/A_SUBJECT/')
expected='[[[{
"id": "XXXXX",
+ "crypto": {},
"match": true,
"excluded": false,
"filename": [
--
2.20.1
More information about the notmuch
mailing list