Open
Description
Once a: protocol is allowed, policy authors often want to place additional
constraints: e.g. a data protocol with an image/... mime-type for use with <img
src>, or a tel: protocol that contains a valid telephone number.
Right now, policy authors are tempted to do
allowUrlProtocols("data", "https", "http", "mailto")
allowAttributes("src").matching(Pattern.compile("^(data:image/(gif|png|jpeg)[,;]
|http|https|mailto|//)", Pattern.CASE_INSENSITIVE)
which requires duplicative effort.
We should provide good alternatives to writing regular expressions to match
URLs as it is error prone.
Perhaps a URL policy that recognizes structure in URLs.
Original issue reported on code.google.com by mikesamuel@gmail.com
on 21 Jan 2014 at 4:09