@@ -35,31 +35,31 @@ the allowlist will be stripped.
3535
3636The default bluemonday.UGCPolicy().Sanitize() turns this:
3737
38- Hello <STYLE>.XSS{background-image:url("javascript:alert('XSS')");}</STYLE><A CLASS=XSS></A>World
38+ Hello <STYLE>.XSS{background-image:url("javascript:alert('XSS')");}</STYLE><A CLASS=XSS></A>World
3939
4040Into the more harmless:
4141
42- Hello World
42+ Hello World
4343
4444And it turns this:
4545
46- <a href="javascript:alert('XSS1')" onmouseover="alert('XSS2')">XSS<a>
46+ <a href="javascript:alert('XSS1')" onmouseover="alert('XSS2')">XSS<a>
4747
4848Into this:
4949
50- XSS
50+ XSS
5151
5252Whilst still allowing this:
5353
54- <a href="http://www.google.com/">
55- <img src="https://ssl.gstatic.com/accounts/ui/logo_2x.png"/>
56- </a>
54+ <a href="http://www.google.com/">
55+ <img src="https://ssl.gstatic.com/accounts/ui/logo_2x.png"/>
56+ </a>
5757
5858To pass through mostly unaltered (it gained a rel="nofollow"):
5959
60- <a href="http://www.google.com/" rel="nofollow">
61- <img src="https://ssl.gstatic.com/accounts/ui/logo_2x.png"/>
62- </a>
60+ <a href="http://www.google.com/" rel="nofollow">
61+ <img src="https://ssl.gstatic.com/accounts/ui/logo_2x.png"/>
62+ </a>
6363
6464The primary purpose of bluemonday is to take potentially unsafe user generated
6565content (from things like Markdown, HTML WYSIWYG tools, etc) and make it safe
@@ -95,10 +95,10 @@ attributes are considered safe for your scenario. OWASP provide an XSS
9595prevention cheat sheet ( https://www.google.com/search?q=xss+prevention+cheat+sheet )
9696to help explain the risks, but essentially:
9797
98- 1. Avoid allowing anything other than plain HTML elements
99- 2. Avoid allowing `script`, `style`, `iframe`, `object`, `embed`, `base`
100- elements
101- 3. Avoid allowing anything other than plain HTML elements with simple
102- values that you can match to a regexp
98+ 1. Avoid allowing anything other than plain HTML elements
99+ 2. Avoid allowing `script`, `style`, `iframe`, `object`, `embed`, `base`
100+ elements
101+ 3. Avoid allowing anything other than plain HTML elements with simple
102+ values that you can match to a regexp
103103*/
104104package bluemonday
0 commit comments