OWASP / java-html-sanitizer

Takes third-party HTML and produces HTML that is safe to embed in your web application. Fast and easy to configure.
Other
834 stars 209 forks source link

Consider allowing different valid protocols to be applied to specific elements->attributes. #249

Closed lread closed 2 years ago

lread commented 2 years ago

Thanks!

First and foremost, thanks so much for creating the java-html-sanitizer. Such a nice and useful contribution to the open-source world!

My Question

I'm not sure if this is a valid, or merely a newbie, question. My apologies if it is the latter.

I'm experimenting with implementing a policy that restricts URL protocols differently for different HTML elements->attributes.

As far as I can tell, the default support is applying allowed URL protocols globally. Is that right?

For example, can I somehow use allowUrlProtocols to express that I'd like to:

Maybe this is not an interesting thing to do, I'm not sure. I got the idea that it might be interesting when looking at the html-pipeline sanitization filter.

lread commented 2 years ago

Aha! It was a newbie question!

For my above use case, I now see that I can

Which allows me to express my use case nicely.