Improve textsec-domain-suspicious-p message

* 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.
This commit is contained in:
Lars Ingebrigtsen 2022-01-20 07:45:33 +01:00
parent 7785463c8e
commit 7e7974154b
2 changed files with 9 additions and 2 deletions

View 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)

View file

@ -162,6 +162,10 @@
(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>")))