Skip to content

Commit 1ee3c12

Browse files
committed
go mod && go fmt: update dependencies and format code
1 parent 07c5693 commit 1ee3c12

File tree

5 files changed

+25
-23
lines changed

5 files changed

+25
-23
lines changed

doc.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,31 @@ the allowlist will be stripped.
3535
3636
The 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
4040
Into the more harmless:
4141
42-
Hello World
42+
Hello World
4343
4444
And 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
4848
Into this:
4949
50-
XSS
50+
XSS
5151
5252
Whilst 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
5858
To 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
6464
The primary purpose of bluemonday is to take potentially unsafe user generated
6565
content (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
9595
prevention cheat sheet ( https://www.google.com/search?q=xss+prevention+cheat+sheet )
9696
to 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
*/
104104
package bluemonday

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ go 1.19
44

55
require (
66
github.com/aymerick/douceur v0.2.0
7-
golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b
7+
golang.org/x/net v0.0.0-20221002022538-bcab6841153b
88
)
99

1010
require github.com/gorilla/css v1.0.0 // indirect
1111

1212
retract [v1.0.0, v1.0.18] // Retract older versions as only latest is to be depended upon
13+
1314
retract v1.0.19 // Uses older version of golang.org/x/net

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuP
22
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
33
github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY=
44
github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c=
5-
golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b h1:ZmngSVLe/wycRns9MKikG9OWIEjGcGAkacif7oYQaUY=
6-
golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
5+
golang.org/x/net v0.0.0-20221002022538-bcab6841153b h1:6e93nYa3hNqAvLr0pD4PN1fFS+gKzp2zAXqrnTCstqU=
6+
golang.org/x/net v0.0.0-20221002022538-bcab6841153b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=

helpers.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,11 @@ func (p *Policy) AllowImages() {
193193
// http://en.wikipedia.org/wiki/Data_URI_scheme
194194
//
195195
// Images must have a mimetype matching:
196-
// image/gif
197-
// image/jpeg
198-
// image/png
199-
// image/webp
196+
//
197+
// image/gif
198+
// image/jpeg
199+
// image/png
200+
// image/webp
200201
//
201202
// NOTE: There is a potential security risk to allowing data URIs and you should
202203
// only permit them on content you already trust.

sanitize_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,7 @@ echo('IPT>alert("XSS")</SCRIPT>'); ?>`,
11511151
expected: ``,
11521152
},
11531153
{
1154-
in: `<IMG SRC="jav ascript:alert('XSS');">`,
1154+
in: `<IMG SRC="jav ascript:alert('XSS');">`,
11551155
expected: ``,
11561156
},
11571157
{

0 commit comments

Comments
 (0)