]> git.eshelyaron.com Git - emacs.git/commitdiff
Check link text domain suspiciousness
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 20 Jan 2022 07:01:20 +0000 (08:01 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 20 Jan 2022 07:01:20 +0000 (08:01 +0100)
* lisp/international/textsec.el (textsec-link-suspicious-p): Check
whether the domain in the link text is suspicious.

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

index 017eb5dc9c41575689aba71192ea704e7489b981..c30d997b4fecf0934ba5d081f6ead7a1ec83f770 100644 (file)
@@ -416,7 +416,13 @@ the same domain as the URL."
                                (url-domsuf-cookie-allowed-p tdomain)))))
             (throw 'found
                    (format "Text `%s' doesn't point to link URL `%s'"
-                           text url)))))))))
+                           text url)))
+           ((and tdomain
+                 (textsec-domain-suspicious-p tdomain))
+            (throw 'found
+                   (format "Domain `%s' in the link text is suspicious"
+                           (bidi-string-strip-control-characters
+                            tdomain))))))))))
 
 (provide 'textsec)
 
index 31e9aefc73614251206cc0a56387048154f90b5f..44815ebb39ff5965b416204fd4ed620e9bda9e15 100644 (file)
            (cons "https://www.gnu.org/"
                  "This is a link that doesn't point to fsf.org")))
 
-  )
+  (should (textsec-link-suspicious-p
+           (cons "https://www.gn\N{LEFT-TO-RIGHT ISOLATE}u.org/"
+                 "gn\N{LEFT-TO-RIGHT ISOLATE}u.org"))))
 
 ;;; textsec-tests.el ends here