1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Make shr mark links with suspicious URLs

* lisp/international/textsec-check.el (textsec-propertize): New
function.
(textsec-check): Only check, don't alter STRING.

* lisp/international/textsec.el (textsec-url-suspicious-p): New
function.

* lisp/net/shr.el (shr-tag-a): Mark suspicious links.
This commit is contained in:
Lars Ingebrigtsen 2022-01-19 16:37:05 +01:00
parent 00a6946283
commit 1bfc086391
4 changed files with 41 additions and 13 deletions

View file

@ -1467,7 +1467,12 @@ ones, in case fg and bg are nil."
(dom-attr dom 'name)))) ; Obsolete since HTML5.
(push (cons id (point)) shr--link-targets))
(when url
(shr-urlify (or shr-start start) (shr-expand-url url) title))))
(shr-urlify (or shr-start start) (shr-expand-url url) title)
(when-let ((warning (textsec-check (shr-expand-url url) 'url)))
(add-text-properties (or shr-start start) (point)
(list 'help-echo warning
'face '(shr-link textsec-suspicious)))
(insert "⚠️")))))
(defun shr-tag-abbr (dom)
(let ((title (dom-attr dom 'title))