1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-20 04:30:55 -08:00
Commit graph

46 commits

Author SHA1 Message Date
Stefan Monnier
3748c8a62e (textsec-bidi-controls-suspicious-p): Minor tweak
* lisp/international/textsec.el (textsec-bidi-controls-suspicious-p):
Don't assume point-min==1 (and point-min is marginally more
efficient, to boot).
2023-03-19 14:51:27 -04:00
Eli Zaretskii
cae528457c ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
Stefan Kangas
d73b86a90a Fix typo in textsec-restriction-level
* lisp/international/textsec.el (textsec-restriction-level):
* test/lisp/international/textsec-tests.el (test-restriction-level):
Fix typo in symbol name `moderately-restrictive'.
2022-10-26 23:02:30 +02:00
Lars Ingebrigtsen
2c45d3cae0 Make more IPV6 domains non-suspicious in textsec
* lisp/international/textsec.el (textsec--ipvx-address-p): Make
more IPV6 domains non-suspicious.
2022-04-11 17:36:26 +02:00
Mattias Engdegård
26db1ca80e Recognise hybrid IPv6/IPv4 addresses in textsec (bug#54624)
* lisp/international/textsec.el (textsec--ipvx-address-p):
  Recognise hybrid addresses like "::ffff:129.55.2.201".
  Combine to a single regexp and translate to rx.
  Remove some regexp ambiguity (relint complaint).
* test/lisp/international/textsec-tests.el (test-suspiction-domain):
  Add test cases.
2022-04-11 16:29:24 +02:00
Lars Ingebrigtsen
fbf2ed9a64 ipv6 addresses aren't suspicious
* lisp/international/textsec.el (textsec--ipvx-address-p): New
function.
(textsec-domain-suspicious-p): Use it to say that ipv6 addresses
aren't suspicious (bug#54624).
2022-03-29 17:12:01 +02:00
Eli Zaretskii
a604e877cd ; Fix last change in 'textsec-bidi-controls-suspicious-p'. 2022-01-22 12:14:17 +02:00
Eli Zaretskii
682b6df6bf Improve detection of suspicious uses of bidi controls
* lisp/international/textsec.el
(textsec-bidi-controls-suspicious-p): New function.
(textsec-name-suspicious-p): Use it.

* test/lisp/international/textsec-tests.el (test-suspicious-name):
Enable the test that was previously failing with
'bidi-find-overridden-directionality'.
2022-01-22 11:58:05 +02:00
Lars Ingebrigtsen
cce813a4e7 Make textsec-link-suspicious-p less mistrustful
* lisp/international/textsec.el (textsec-link-suspicious-p): Scale
back the suspicion -- only warn about texts that contain a full
explicit link.
2022-01-20 18:12:44 +01:00
Lars Ingebrigtsen
10fbbddddd Improve the textsec-domain-suspicious-p warning message
* lisp/international/textsec.el (textsec-domain-suspicious-p):
Improve warning message.
2022-01-20 13:37:33 +01:00
Lars Ingebrigtsen
5a64286d6a Make textsec-link-suspicious-p have fewer false positives
* lisp/international/textsec.el (textsec-link-suspicious-p):
Attempt to improve the domain-guessing logic.
2022-01-20 12:37:31 +01:00
Lars Ingebrigtsen
37e2304f98 Tweak textsec-link-suspicious-p
* lisp/international/textsec.el (textsec-link-suspicious-p): Don't
mark dates as suspicious.
2022-01-20 10:10:08 +01:00
Lars Ingebrigtsen
4768657b31 Allow suspicious names with some forms of bidi controls
* lisp/international/textsec.el (textsec-name-suspicious-p): Allow
names with bidi-find-overridden-directionality.
2022-01-20 09:52:08 +01:00
Lars Ingebrigtsen
536ad66ae3 Improve textsec-domain-suspicious-p message
* lisp/international/textsec.el (textsec-domain-suspicious-p):
Improve warning message.
2022-01-20 09:36:12 +01:00
Lars Ingebrigtsen
7cfc0bd6a9 Check link text domain suspiciousness
* lisp/international/textsec.el (textsec-link-suspicious-p): Check
whether the domain in the link text is suspicious.
2022-01-20 08:01:20 +01:00
Lars Ingebrigtsen
f9f12086fb Expand textsec-link-suspicious-p checking
* lisp/international/textsec.el (textsec-link-suspicious-p): Check
the text more thoroughly for link-like things.
2022-01-20 07:57:13 +01:00
Lars Ingebrigtsen
7e7974154b 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.
2022-01-20 07:45:33 +01:00
Lars Ingebrigtsen
50ddfb2428 Make textsec-mixed-numbers-p actually work
* lisp/international/textsec.el (textsec-mixed-numbers-p): Fix the
test.
2022-01-19 18:50:40 +01:00
Eli Zaretskii
689e865a9b ; * lisp/international/textsec.el (textsec-url-suspicious-p): Fix a typo. 2022-01-19 19:26:46 +02:00
Lars Ingebrigtsen
e58b4b24cf Add text for suspicious links
* lisp/international/textsec-check.el (textsec-check): Note `link'.
(textsec-propertize): Fix typo.

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

* lisp/net/shr.el (shr-tag-a): Check for sus links.
2022-01-19 17:50:21 +01:00
Lars Ingebrigtsen
1e5e85f3ce Fix thinko in textsec-url-suspicious-p
* lisp/international/textsec.el (textsec-url-suspicious-p): Don't
bug out on non-HTTP URLs.
2022-01-19 16:39:13 +01:00
Lars Ingebrigtsen
1bfc086391 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.
2022-01-19 16:37:05 +01:00
Lars Ingebrigtsen
00a6946283 Add new file textsec-check.el
* lisp/international/textsec-check.el: New file.
* lisp/international/textsec.el
(textsec-email-address-header-suspicious-p): Rename.
2022-01-19 16:22:16 +01:00
Lars Ingebrigtsen
598038643f Mark whole-script confusables as suspicious domains
* lisp/international/textsec.el (textsec-domain-suspicious-p):
Consider domain names that are whole-script confusables with ASCII
to be suspicious.  (I think this is what the Unicode standard is
recommending, but I'm not 100% sure.)
2022-01-19 15:52:20 +01:00
Lars Ingebrigtsen
124c4ad1e5 Split textsec-email-address-suspicious-p into two functions
* lisp/international/textsec.el
(textsec-email-address-suspicious-p): Made into its own function.
(textsec-email-suspicious-p): Use it and adjust doc strings.
2022-01-19 15:21:50 +01:00
Eli Zaretskii
87d7362c87 ; Minor fix in 'textsec-domain-suspicious-p'
* lisp/international/textsec.el (textsec-domain-suspicious-p): Fix
explanation string.
2022-01-19 16:19:36 +02:00
Lars Ingebrigtsen
b4336b2832 Make textsec-suspicious-nonspacing-p work on marks
* lisp/international/textsec.el (textsec-suspicious-nonspacing-p):
We're only interested in nonspacing marks, not control characters
in this test.
2022-01-19 14:42:39 +01:00
Eli Zaretskii
b6db2d0a6f ; Yet another improvement of doc strings in textsec
* lisp/international/textsec.el (textsec-local-address-suspicious-p)
(textsec-name-suspicious-p): Fix wording of doc strings.
2022-01-19 14:00:45 +02:00
Lars Ingebrigtsen
696bd360f6 Deconfuse textsec doc strings slightly
* lisp/international/textsec.el (textsec-name-suspicious-p):
(textsec-domain-suspicious-p):
(textsec-local-address-suspicious-p):
(textsec-name-suspicious-p):
(textsec-suspicious-nonspacing-p):
(textsec-email-suspicious-p): Suspiciosness isn't only about
homoglyphs, so don't claim so in the doc strings.
2022-01-19 11:34:48 +01:00
Robert Pluim
db714e08e0 Improve textsec doc strings
* lisp/international/textsec.el (textsec-domain-suspicious-p)
(textsec-local-address-suspicious-p, textsec-name-suspicious-p)
(textsec-suspicious-nonspacing-p): Improve doc strings.
2022-01-19 11:21:01 +01:00
Eli Zaretskii
596d0bda6d Minor improvement in textsec diagnostics
* lisp/international/textsec.el (textsec-suspicious-nonspacing-p):
Clarify wording of the strings returned to explain the suspicious
use of nonspacing characters.
2022-01-19 10:57:03 +02:00
Eli Zaretskii
877c4e849f Improve doc strings in textsec.el
* lisp/international/textsec.el (textsec-mixed-numbers-p)
(textsec-ascii-confusable-p, textsec-resolved-script-set)
(textsec-single-script-confusable-p)
(textsec-mixed-script-confusable-p)
(textsec-whole-script-confusable-p, textsec-domain-suspicious-p)
(textsec-local-address-suspicious-p, textsec-name-suspicious-p)
(textsec-suspicious-nonspacing-p): Doc fix.
2022-01-18 21:08:19 +02:00
Lars Ingebrigtsen
5006e19856 The name in textsec-email-suspicious-p is optional
* lisp/international/textsec.el (textsec-email-suspicious-p): The
name is optional.
2022-01-18 13:34:39 +01:00
Lars Ingebrigtsen
ce63f91025 Add textsec functions for verifying email addresses
* lisp/international/characters.el (bidi-control-characters):
Rename from glyphless--bidi-control-characters for use in textsec,
and add LRM/RLM/ALM.
(update-glyphless-char-display): Adjust the code.

* lisp/international/textsec.el (textsec-local-address-suspicious-p)
(textsec-name-suspicious-p, textsec-suspicious-nonspacing-p)
(textsec-email-suspicious-p): New functions.
2022-01-18 13:20:04 +01:00
Lars Ingebrigtsen
9f25c41ad4 Add textsec-domain-suspicious-p
* .gitignore: Ignore idna-mapping.el.

* admin/notes/unicode: Note idna-mapping file.
* admin/unidata/IdnaMappingTable.txt: New file.

* admin/unidata/Makefile.in (all): Generate idna-mapping.el.

* admin/unidata/unidata-gen.el (unidata-gen-idna-mapping): Generate.

* lisp/international/textsec.el (textsec-domain-suspicious-p): New
function.
2022-01-18 11:53:09 +01:00
Lars Ingebrigtsen
4eebf528fc Add textsec predicates for different types of confusability
* lisp/international/textsec.el (textsec-resolved-script-set)
(textsec-single-script-confusable-p)
(textsec-mixed-script-confusable-p)
(textsec-whole-script-confusable-p): New functions.
2022-01-18 10:24:32 +01:00
Lars Ingebrigtsen
19fefea1ca Add textsec support for confusable characters
* admin/notes/unicode: Note the confusables.txt file.
* admin/unidata/Makefile.in (${unidir}/uni-confusable.el):
Generate the confusable file.

* admin/unidata/README (https): Add confusables.txt.

* admin/unidata/confusables.txt: New file.

* admin/unidata/unidata-gen.el (unidata-gen-confusable): Parse the
confusables.txt file.

* lisp/international/textsec.el (textsec-ascii-confusable-p)
(textsec-unconfuse-string): New functions.
2022-01-18 09:57:54 +01:00
Lars Ingebrigtsen
65c9f57856 Improve textsec-restriction-level doc string
* lisp/international/textsec.el (textsec-restriction-level):
Improve doc string.
2022-01-18 09:57:54 +01:00
Robert Pluim
346747451f ; textsec.el: fix typo
* lisp/international/textsec.el (textsec-covering-scripts): Fix typo
in docstring.
2022-01-17 18:24:31 +01:00
Eli Zaretskii
ef1f5dfe2b Doc fixes in textsec.el
* lisp/international/textsec.el (textsec-scripts)
(textsec-single-script-p, textsec-covering-scripts): Clarify "script".
2022-01-17 19:15:30 +02:00
Lars Ingebrigtsen
9f902eb808 Change textsec-mixed-numbers-p to use recommended algorithm
* lisp/international/textsec.el (textsec-mixed-numbers-p): New
function.
2022-01-17 18:01:59 +01:00
Lars Ingebrigtsen
1c7307673b Add new function textsec-mixed-numbers-p
* lisp/international/textsec.el (textsec-mixed-numbers-p): New
function.
2022-01-17 17:32:58 +01:00
Lars Ingebrigtsen
9b358a99d6 Add some textsec-restriction-level comments
* lisp/international/textsec.el (textsec-restriction-level): Add
comment about source of the list of languages.
2022-01-17 16:27:10 +01:00
Lars Ingebrigtsen
a1ffee1e82 Add textsec-restriction-level function
* lisp/international/textsec.el (textsec-restriction-level): New
function.
2022-01-17 16:24:17 +01:00
Lars Ingebrigtsen
523a96a99e Fix some doc strings in textsec.el
* lisp/international/textsec.el (textsec-single-script-p): Fix
typo in doc string.
(textsec-covering-scripts): Improve doc string and sort the results.
2022-01-17 16:06:04 +01:00
Lars Ingebrigtsen
e2c8091113 Add support for functions that deal with Unicode scripts
* admin/unidata/Makefile.in (${unidir}/uni-scripts.el): Build
uni-scripts.el.

* admin/unidata/Scripts.txt:
* admin/unidata/ScriptExtensions.txt:
* admin/unidata/PropertyValueAliases.txt: New files from Unicode.

* admin/unidata/README: Update.

* admin/unidata/unidata-gen.el (unidata-gen-charprop): Allow
writing other data, too.
(unidata-gen-scripts, unidata-gen--read-script-aliases)
(unidata-gen--insert-file): New functions to parse the Script* files.

* lisp/international/textsec.el: Implement some functions that
work on scripts.
2022-01-17 15:47:50 +01:00