@@ -108,7 +108,7 @@ func TestExternalMarkupRenderer(t *testing.T) {
108108 // default sandbox in sub page response
109109 assert .Equal (t , "frame-src 'self'; sandbox allow-scripts allow-popups" , respSub .Header ().Get ("Content-Security-Policy" ))
110110 // FIXME: actually here is a bug (legacy design problem), the "PostProcess" will escape "<script>" tag, but it indeed is the sanitizer's job
111- assert .Equal (t , `<script nonce="not-needed" crossorigin src="` + public .AssetURI ("js/external-render-helper.js" )+ `"></script><link rel="stylesheet" href="` + public .AssetURI ("css/theme-gitea-auto.css" )+ `"><div><any attr="val"><script></script></any></div>` , respSub .Body .String ())
111+ assert .Equal (t , `<script nonce crossorigin src="` + public .AssetURI ("js/external-render-helper.js" )+ `"></script><link rel="stylesheet" href="` + public .AssetURI ("css/theme-gitea-auto.css" )+ `"><div><any attr="val"><script></script></any></div>` , respSub .Body .String ())
112112 })
113113 })
114114
@@ -131,7 +131,7 @@ func TestExternalMarkupRenderer(t *testing.T) {
131131 t .Run ("HTMLContentWithExternalRenderIframeHelper" , func (t * testing.T ) {
132132 req := NewRequest (t , "GET" , "/user2/repo1/render/branch/master/html.no-sanitizer" )
133133 respSub := MakeRequest (t , req , http .StatusOK )
134- assert .Equal (t , `<script nonce="not-needed" crossorigin src="` + public .AssetURI ("js/external-render-helper.js" )+ `"></script><link rel="stylesheet" href="` + public .AssetURI ("css/theme-gitea-auto.css" )+ `"><script>foo("raw")</script>` , respSub .Body .String ())
134+ assert .Equal (t , `<script nonce crossorigin src="` + public .AssetURI ("js/external-render-helper.js" )+ `"></script><link rel="stylesheet" href="` + public .AssetURI ("css/theme-gitea-auto.css" )+ `"><script>foo("raw")</script>` , respSub .Body .String ())
135135 assert .Equal (t , "frame-src 'self'" , respSub .Header ().Get ("Content-Security-Policy" ))
136136 })
137137 })
0 commit comments