]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve textsec-domain-suspicious-p message
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 20 Jan 2022 06:45:33 +0000 (07:45 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 20 Jan 2022 06:45:33 +0000 (07:45 +0100)
* lisp/international/textsec.el (textsec-domain-suspicious-p):
Ensure that we're not confusing the user if there's a directional
override in the string we're checking.

lisp/international/textsec.el
test/lisp/international/textsec-tests.el

index bf90afb7c0081b7faaee3bfe80f5323484b5bd95..6b37e9256982f196bd43908951304900959435b3 100644 (file)
@@ -244,8 +244,11 @@ or use certain other unusual mixtures of characters."
     (seq-do
      (lambda (char)
        (when (eq (elt idna-mapping-table char) t)
-         (throw 'found (format "Disallowed character: `%s' (#x%x)"
-                               (string char) char))))
+         (throw 'found
+                (format "Disallowed character: `%s' (#x%x, %s)"
+                        (bidi-string-strip-control-characters (string char))
+                        char
+                        (get-char-code-property char 'name)))))
      domain)
     ;; Does IDNA allow it?
     (unless (puny-highly-restrictive-domain-p domain)
index acd779715012c87eff968094d3f640e4f2ce16ca..f8fc0564807fcf531b2466d71508ef164f96e8c4 100644 (file)
    (textsec-email-address-header-suspicious-p
     "Lars Ingebrigtsen <larsi@gn\N{LEFT-TO-RIGHT ISOLATE}us.org>"))
 
+  (should
+   (textsec-email-address-header-suspicious-p
+    "Lars Ingebrigtsen <larsi@\N{RIGHT-TO-LEFT OVERRIDE}gnus.org>"))
+
   (should (textsec-email-address-header-suspicious-p
            "דגבא <foo@bar.com>")))