unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* using the fringe to indicate good signatures
@ 2015-08-20 13:12 David Edmondson
  2015-09-07 22:50 ` Daniel Kahn Gillmor
  0 siblings, 1 reply; 6+ messages in thread
From: David Edmondson @ 2015-08-20 13:12 UTC (permalink / raw)
  To: notmuch


[-- Attachment #1.1: Type: text/plain, Size: 353 bytes --]

After listening to bremner, dkg et al. from Heidelberg, I threw together
a quick patch to see how we might indicate signature validity in the
fringe. The intention is to prompt more discussion - this code is not
ready to ship.

The patch is attached. The result looks something like:
    http://dme.org/data/images/notmuch-signed-fringe.png

Thoughts?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: signed-fringe.diff --]
[-- Type: text/x-patch, Size: 2863 bytes --]

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 4dee34b..3d447af 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -646,25 +646,46 @@ will return nil if the CID is unknown or cannot be retrieved."
       (indent-rigidly start (point) 1)))
   t)
 
-(defun notmuch-show-insert-part-multipart/signed (msg part content-type nth depth button)
-  (button-put button 'face 'notmuch-crypto-part-header)
-  ;; add signature status button if sigstatus provided
-  (if (plist-member part :sigstatus)
-      (let* ((from (notmuch-show-get-header :From msg))
-	     (sigstatus (car (plist-get part :sigstatus))))
-	(notmuch-crypto-insert-sigstatus-button sigstatus from))
-    ;; if we're not adding sigstatus, tell the user how they can get it
-    (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts."))
+;; None of the existing fringe bitmaps are empty.
+(define-fringe-bitmap 'notmuch-show--fringe-empty '[])
 
-  (let ((inner-parts (plist-get part :content))
-	(start (point)))
-    ;; Show all of the parts.
-    (mapc (lambda (inner-part)
-	    (notmuch-show-insert-bodypart msg inner-part depth))
-	  inner-parts)
+(defun notmuch-show--sigstatus-to-fringe-string (status)
+  (let ((good-bad-ugly (plist-get status :status)))
+    (cond
+     ((string= good-bad-ugly "good")
+      (propertize "dummy" 'display
+		  '(left-fringe notmuch-show--fringe-empty notmuch-crypto-signature-good)))
+     ;; XXX dme: insert more here.
+     (t nil))))
 
-    (when notmuch-show-indent-multipart
-      (indent-rigidly start (point) 1)))
+(defun notmuch-show-insert-part-multipart/signed (msg part content-type nth depth button)
+  (let ((start-of-signed (point)))
+    (button-put button 'face 'notmuch-crypto-part-header)
+
+    (let ((sigstatus (car (plist-get part :sigstatus)))
+	  (from (notmuch-show-get-header :From msg)))
+      ;; Add signature status button if status is provided.
+      (if sigstatus
+	  (notmuch-crypto-insert-sigstatus-button sigstatus from)
+	;; If we're not adding the status, tell the user how they can
+	;; get it.
+	(button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts."))
+
+      (let ((inner-parts (plist-get part :content))
+	    (start (point))
+	    (fringe-string (notmuch-show--sigstatus-to-fringe-string sigstatus)))
+	;; Show all of the parts.
+	(mapc (lambda (inner-part)
+		(notmuch-show-insert-bodypart msg inner-part depth))
+	      inner-parts)
+
+	(when notmuch-show-indent-multipart
+	  (indent-rigidly start (point) 1))
+
+	(when fringe-string
+	  (replace-regexp "^" fringe-string nil start-of-signed (point))))
+      )
+    )
   t)
 
 (defun notmuch-show-insert-part-multipart/encrypted (msg part content-type nth depth button)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 292 bytes --]

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: using the fringe to indicate good signatures
  2015-08-20 13:12 using the fringe to indicate good signatures David Edmondson
@ 2015-09-07 22:50 ` Daniel Kahn Gillmor
  2015-09-08  6:01   ` David Edmondson
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Kahn Gillmor @ 2015-09-07 22:50 UTC (permalink / raw)
  To: David Edmondson, notmuch

[-- Attachment #1: Type: text/plain, Size: 669 bytes --]

On Thu 2015-08-20 09:12:26 -0400, David Edmondson wrote:
> After listening to bremner, dkg et al. from Heidelberg, I threw together
> a quick patch to see how we might indicate signature validity in the
> fringe. The intention is to prompt more discussion - this code is not
> ready to ship.

> The patch is attached. The result looks something like:
>     http://dme.org/data/images/notmuch-signed-fringe.png

I like the basic idea of this, thanks for putting it together.  It's
good to put security indicators in a region of the UI that the message
content cannot modify or spoof.

What do we think should be done if there are multiple nested signatures?

     --dkg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 948 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: using the fringe to indicate good signatures
  2015-09-07 22:50 ` Daniel Kahn Gillmor
@ 2015-09-08  6:01   ` David Edmondson
  2015-09-08  6:43     ` Daniel Kahn Gillmor
  0 siblings, 1 reply; 6+ messages in thread
From: David Edmondson @ 2015-09-08  6:01 UTC (permalink / raw)
  To: Daniel Kahn Gillmor, notmuch

On Mon, Sep 07 2015, Daniel Kahn Gillmor <dkg@fifthhorseman.net> wrote:
> On Thu 2015-08-20 09:12:26 -0400, David Edmondson wrote:
>> After listening to bremner, dkg et al. from Heidelberg, I threw together
>> a quick patch to see how we might indicate signature validity in the
>> fringe. The intention is to prompt more discussion - this code is not
>> ready to ship.
>
>> The patch is attached. The result looks something like:
>>     http://dme.org/data/images/notmuch-signed-fringe.png
>
> I like the basic idea of this, thanks for putting it together.  It's
> good to put security indicators in a region of the UI that the message
> content cannot modify or spoof.
>
> What do we think should be done if there are multiple nested signatures?

Cry?

More seriously, we could use the indentation space for a similar
indicator, which would allow us some room at an appropriate depth for
each message (but not each part (in the default configuration)).

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: using the fringe to indicate good signatures
  2015-09-08  6:01   ` David Edmondson
@ 2015-09-08  6:43     ` Daniel Kahn Gillmor
  2015-09-08  9:53       ` David Edmondson
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Kahn Gillmor @ 2015-09-08  6:43 UTC (permalink / raw)
  To: David Edmondson, notmuch

On Tue 2015-09-08 02:01:42 -0400, David Edmondson wrote:
> On Mon, Sep 07 2015, Daniel Kahn Gillmor <dkg@fifthhorseman.net> wrote:
>> On Thu 2015-08-20 09:12:26 -0400, David Edmondson wrote:
>>> After listening to bremner, dkg et al. from Heidelberg, I threw together
>>> a quick patch to see how we might indicate signature validity in the
>>> fringe. The intention is to prompt more discussion - this code is not
>>> ready to ship.
>>
>>> The patch is attached. The result looks something like:
>>>     http://dme.org/data/images/notmuch-signed-fringe.png
>>
>> I like the basic idea of this, thanks for putting it together.  It's
>> good to put security indicators in a region of the UI that the message
>> content cannot modify or spoof.
>>
>> What do we think should be done if there are multiple nested signatures?
>
> Cry?

heh :)

> More seriously, we could use the indentation space for a similar
> indicator, which would allow us some room at an appropriate depth for
> each message (but not each part (in the default configuration)).

hm, but couldn't the indentation space be spoofed by a well-crafted
message?  that is: a non-indented message will consume space up to (but
not including) the fringe.  so a well-crafted message could be made to
*look* like an indented message, including whatever is comparable to the
chrome/UI elements we would use for an actual signed message.

I think it is also acceptable to just punt at some level -- we can say
"notmuch-emacs will indicate the outermost signed message part in the
fringe; it will not indicate nested signed messages in the fringe".
this is still an improvement from the status quo.

     --dkg

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: using the fringe to indicate good signatures
  2015-09-08  6:43     ` Daniel Kahn Gillmor
@ 2015-09-08  9:53       ` David Edmondson
  2015-09-08 18:00         ` Tomi Ollila
  0 siblings, 1 reply; 6+ messages in thread
From: David Edmondson @ 2015-09-08  9:53 UTC (permalink / raw)
  To: Daniel Kahn Gillmor, notmuch

On Tue, Sep 08 2015, Daniel Kahn Gillmor <dkg@fifthhorseman.net> wrote:
>> More seriously, we could use the indentation space for a similar
>> indicator, which would allow us some room at an appropriate depth for
>> each message (but not each part (in the default configuration)).
>
> hm, but couldn't the indentation space be spoofed by a well-crafted
> message?  that is: a non-indented message will consume space up to (but
> not including) the fringe.  so a well-crafted message could be made to
> *look* like an indented message, including whatever is comparable to the
> chrome/UI elements we would use for an actual signed message.

Yes, I guess that is possible at some level.

The fringe is a bitmap - we could use the leftmost vertical line of it
for the outermost component, next line for the next component, ...

Or perhaps use images:
   - all levels of the message at this line are "good",
   - some of the levels of the message at this line are "good".

Or maybe display a QR code in the fringe, and you point your phone at it
to find out what is going on?

> I think it is also acceptable to just punt at some level -- we can say
> "notmuch-emacs will indicate the outermost signed message part in the
> fringe; it will not indicate nested signed messages in the fringe".
> this is still an improvement from the status quo.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: using the fringe to indicate good signatures
  2015-09-08  9:53       ` David Edmondson
@ 2015-09-08 18:00         ` Tomi Ollila
  0 siblings, 0 replies; 6+ messages in thread
From: Tomi Ollila @ 2015-09-08 18:00 UTC (permalink / raw)
  To: David Edmondson, Daniel Kahn Gillmor, notmuch

On Tue, Sep 08 2015, David Edmondson <dme@dme.org> wrote:

> On Tue, Sep 08 2015, Daniel Kahn Gillmor <dkg@fifthhorseman.net> wrote:
>>> More seriously, we could use the indentation space for a similar
>>> indicator, which would allow us some room at an appropriate depth for
>>> each message (but not each part (in the default configuration)).
>>
>> hm, but couldn't the indentation space be spoofed by a well-crafted
>> message?  that is: a non-indented message will consume space up to (but
>> not including) the fringe.  so a well-crafted message could be made to
>> *look* like an indented message, including whatever is comparable to the
>> chrome/UI elements we would use for an actual signed message.
>
> Yes, I guess that is possible at some level.
>
> The fringe is a bitmap - we could use the leftmost vertical line of it
> for the outermost component, next line for the next component, ...
>
> Or perhaps use images:
>    - all levels of the message at this line are "good",
>    - some of the levels of the message at this line are "good".
>
> Or maybe display a QR code in the fringe, and you point your phone at it
> to find out what is going on?

QR-code does not fit into my 1-pixel-wide fringes, but barcode perhaps ;)

>
>> I think it is also acceptable to just punt at some level -- we can say
>> "notmuch-emacs will indicate the outermost signed message part in the
>> fringe; it will not indicate nested signed messages in the fringe".
>> this is still an improvement from the status quo.
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-09-08 18:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-20 13:12 using the fringe to indicate good signatures David Edmondson
2015-09-07 22:50 ` Daniel Kahn Gillmor
2015-09-08  6:01   ` David Edmondson
2015-09-08  6:43     ` Daniel Kahn Gillmor
2015-09-08  9:53       ` David Edmondson
2015-09-08 18:00         ` Tomi Ollila

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).