Commit graph

51 commits

Author SHA1 Message Date
Robert Pluim
e4b243b931 Use 'char-to-name'
* lisp/international/emoji.el (emoji--name): Lookup name using 'char-to-name'.
* lisp/international/textsec.el (textsec-domain-suspicious-p): And here.
* lisp/simple.el (what-cursor-position): And here.
2024-06-11 11:06:37 +02:00
Eli Zaretskii
9fbe9dc4c3 ; Improve doc strings in textsec.el
* lisp/international/textsec.el (textsec-email-address-suspicious-p)
(textsec-email-address-header-suspicious-p, textsec-scripts)
(textsec-single-script-p, textsec-covering-scripts)
(textsec-restriction-level, textsec-mixed-numbers-p)
(textsec-resolved-script-set)
(textsec-single-script-confusable-p)
(textsec-mixed-script-confusable-p)
(textsec-whole-script-confusable-p)
(textsec-local-address-suspicious-p)
(textsec-bidi-controls-suspicious-p, textsec-name-suspicious-p)
(textsec-suspicious-nonspacing-p): Doc fixes.
2024-05-25 11:59:21 +03:00
Andreas Schwab
672ca232db textsec: handle email address without domain part
* lisp/international/textsec.el
(textsec-email-address-suspicious-p): Handle missing domain part.
(textsec-email-address-header-suspicious-p): Likewise.
2024-05-04 21:08:43 +02:00
Po Lu
ecf08f0621 Merge from savannah/emacs-29
dc4e6b1329 ; Update copyright years in more files
64b3777631 ; Run set-copyright from admin.el
8e1c56ae46 ; Add 2024 to copyright years

# Conflicts:
#	doc/misc/modus-themes.org
#	doc/misc/texinfo.tex
#	etc/NEWS
#	etc/refcards/ru-refcard.tex
#	etc/themes/modus-operandi-theme.el
#	etc/themes/modus-themes.el
#	etc/themes/modus-vivendi-theme.el
#	lib/alloca.in.h
#	lib/binary-io.h
#	lib/c-ctype.h
#	lib/c-strcasecmp.c
#	lib/c-strncasecmp.c
#	lib/careadlinkat.c
#	lib/cloexec.c
#	lib/close-stream.c
#	lib/diffseq.h
#	lib/dup2.c
#	lib/filemode.h
#	lib/fpending.c
#	lib/fpending.h
#	lib/fsusage.c
#	lib/getgroups.c
#	lib/getloadavg.c
#	lib/gettext.h
#	lib/gettime.c
#	lib/gettimeofday.c
#	lib/group-member.c
#	lib/malloc.c
#	lib/md5-stream.c
#	lib/md5.c
#	lib/md5.h
#	lib/memmem.c
#	lib/memrchr.c
#	lib/nanosleep.c
#	lib/save-cwd.h
#	lib/sha1.c
#	lib/sig2str.c
#	lib/stdlib.in.h
#	lib/strtoimax.c
#	lib/strtol.c
#	lib/strtoll.c
#	lib/time_r.c
#	lib/xalloc-oversized.h
#	lisp/auth-source-pass.el
#	lisp/emacs-lisp/lisp-mnt.el
#	lisp/emacs-lisp/timer.el
#	lisp/info-look.el
#	lisp/jit-lock.el
#	lisp/loadhist.el
#	lisp/mail/rmail.el
#	lisp/net/ntlm.el
#	lisp/net/webjump.el
#	lisp/progmodes/asm-mode.el
#	lisp/progmodes/project.el
#	lisp/progmodes/sh-script.el
#	lisp/textmodes/flyspell.el
#	lisp/textmodes/reftex-toc.el
#	lisp/textmodes/reftex.el
#	lisp/textmodes/tex-mode.el
#	lisp/url/url-gw.el
#	m4/alloca.m4
#	m4/clock_time.m4
#	m4/d-type.m4
#	m4/dirent_h.m4
#	m4/dup2.m4
#	m4/euidaccess.m4
#	m4/fchmodat.m4
#	m4/filemode.m4
#	m4/fsusage.m4
#	m4/getgroups.m4
#	m4/getloadavg.m4
#	m4/getrandom.m4
#	m4/gettime.m4
#	m4/gettimeofday.m4
#	m4/gnulib-common.m4
#	m4/group-member.m4
#	m4/inttypes.m4
#	m4/malloc.m4
#	m4/manywarnings.m4
#	m4/mempcpy.m4
#	m4/memrchr.m4
#	m4/mkostemp.m4
#	m4/mktime.m4
#	m4/nproc.m4
#	m4/nstrftime.m4
#	m4/pathmax.m4
#	m4/pipe2.m4
#	m4/pselect.m4
#	m4/pthread_sigmask.m4
#	m4/readlink.m4
#	m4/realloc.m4
#	m4/sig2str.m4
#	m4/ssize_t.m4
#	m4/stat-time.m4
#	m4/stddef_h.m4
#	m4/stdint.m4
#	m4/stdio_h.m4
#	m4/stdlib_h.m4
#	m4/stpcpy.m4
#	m4/strnlen.m4
#	m4/strtoimax.m4
#	m4/strtoll.m4
#	m4/time_h.m4
#	m4/timegm.m4
#	m4/timer_time.m4
#	m4/timespec.m4
#	m4/unistd_h.m4
#	m4/warnings.m4
#	nt/configure.bat
#	nt/preprep.c
#	test/lisp/register-tests.el
2024-01-02 10:28:14 +08:00
Po Lu
8e1c56ae46 ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
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