Check link text domain suspiciousness

* lisp/international/textsec.el (textsec-link-suspicious-p): Check
whether the domain in the link text is suspicious.
This commit is contained in:
Lars Ingebrigtsen 2022-01-20 08:01:20 +01:00
parent f9f12086fb
commit 7cfc0bd6a9
2 changed files with 10 additions and 2 deletions

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

View file

@ -195,6 +195,8 @@
(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