diff options
author | Moritz Poldrack <git@moritz.sh> | 2022-09-11 02:14:53 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-09-13 23:58:53 +0200 |
commit | fad90c2956c6e57fd8da83da9c218b35cf2a2f93 (patch) | |
tree | 8ddc3a435a2d261c5b32bbb53ad8891f182c7661 /lib/keepalive_dummy.go | |
parent | ba9d79fd2d6d17b8d2ec940697cab2348293c510 (diff) | |
download | aerc-fad90c2956c6e57fd8da83da9c218b35cf2a2f93.tar.gz |
open-link: make URL parsing more lenient
URLs are extremely loosely defined and can take many shapes which may
not be parsed at all if unusual characters like the exclamation mark are
present. To ensure lists and odd use of spaces are not parsed as links
some sanity-checks are in place:
- the URL's schema must be at least two characters long
- the URL's authority, path, and fragment must have a combined
length of 8 characters or longer
- the URL must not contain a whitespace character, >, ), or "
- the URL may only contain a ] when followed by a different allowed
character or at the end of the line (necessary for IPv6
authorities)
The tests for this function now include links with an exclamation point
and IPv6 addresses. The tests are given names to be easier identifiable.
Link: https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml
Reported-by: "Bence Ferdinandy" <bence@ferdinandy.com>
Cc: "Koni Marti" <koni.marti@gmail.com>
Fixes: e1d8bc4d17cb ("msgviewer: open http links from messages")
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'lib/keepalive_dummy.go')
0 files changed, 0 insertions, 0 deletions