aerc/lib
Moritz Poldrack fad90c2956 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: e1d8bc4d17 ("msgviewer: open http links from messages")
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
2022-09-13 23:58:53 +02:00
..
auth lint: homogenize operations and minor fixes (gocritic) 2022-08-04 21:58:01 +02:00
calendar lint: ensure errors are at least logged (errcheck) 2022-08-04 21:57:57 +02:00
crypto pgp: enable quoted replies of encrypted messages 2022-08-31 10:10:03 +02:00
format lint: homogenize operations and minor fixes (gocritic) 2022-08-04 21:58:01 +02:00
marker mark: allow multiple visual selections 2022-08-22 09:30:37 +02:00
parse open-link: make URL parsing more lenient 2022-09-13 23:58:53 +02:00
sort go.mod: change base git url 2021-11-05 10:21:45 +01:00
statusline lint: homogenize operations and minor fixes (gocritic) 2022-08-04 21:58:01 +02:00
templates lint: apply new formatting rules 2022-08-01 10:44:52 +02:00
ui lint: homogenize operations and minor fixes (gocritic) 2022-08-04 21:58:01 +02:00
uidstore Create UIDStore package 2019-07-12 11:09:47 -04:00
attachment.go compose: refactor attachment handling 2022-07-02 17:52:49 +02:00
dirstore.go Move msgstore map to dirstore 2019-07-26 14:15:27 -04:00
history.go Add command history and cycling 2019-07-26 14:29:34 -04:00
keepalive_dummy.go format: reformat code with go 1.17 2021-12-11 23:24:08 +01:00
keepalive_linux.go format: reformat code with go 1.17 2021-12-11 23:24:08 +01:00
messageview.go go: removed io/ioutil 2022-08-22 09:30:19 +02:00
msgstore.go msgstore: do not run threadbuilder unless in threaded view 2022-08-31 10:06:56 +02:00
oauthbearer.go lint: work nicely with wrapped errors (errorlint) 2022-08-04 21:58:04 +02:00
open.go lint: homogenize operations and minor fixes (gocritic) 2022-08-04 21:58:01 +02:00
socket.go lint: ensure errors are at least logged (errcheck) 2022-08-04 21:57:57 +02:00
structure_helpers.go lint: homogenize operations and minor fixes (gocritic) 2022-08-04 21:58:01 +02:00
structure_helpers_test.go lint: apply new formatting rules 2022-08-01 10:44:52 +02:00
threadbuilder.go lint: ensure errors are at least logged (errcheck) 2022-08-04 21:57:57 +02:00