[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 7e7974154b 2/5: Improve textsec-domain-suspicious-p message
From: |
Lars Ingebrigtsen |
Subject: |
master 7e7974154b 2/5: Improve textsec-domain-suspicious-p message |
Date: |
Thu, 20 Jan 2022 02:38:31 -0500 (EST) |
branch: master
commit 7e7974154b902f53dd1646ec0246b9e8b7c32824
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
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.
---
lisp/international/textsec.el | 7 +++++--
test/lisp/international/textsec-tests.el | 4 ++++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/lisp/international/textsec.el b/lisp/international/textsec.el
index bf90afb7c0..6b37e92569 100644
--- a/lisp/international/textsec.el
+++ b/lisp/international/textsec.el
@@ -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)
diff --git a/test/lisp/international/textsec-tests.el
b/test/lisp/international/textsec-tests.el
index acd7797150..f8fc056480 100644
--- a/test/lisp/international/textsec-tests.el
+++ b/test/lisp/international/textsec-tests.el
@@ -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>")))