mirror of
https://github.com/go-gitea/gitea.git
synced 2026-06-19 07:36:24 +00:00
fix: csp (#38162)
ref: https://github.com/go-gitea/gitea/issues/8707#issuecomment-4741577316
This commit is contained in:
@@ -132,8 +132,9 @@ func (c TemplateContext) HeadMetaContentSecurityPolicy() template.HTML {
|
||||
// * Maybe this approach should be avoided, don't make the config system too complex, just let users use A
|
||||
return template.HTML(`<meta http-equiv="Content-Security-Policy" content="` +
|
||||
// allow all by default (the same as old releases with no CSP)
|
||||
// maybe some images or markup (external) renders need "data:", need to investigate
|
||||
`default-src * data:;` +
|
||||
// * maybe some images or markup (external) renders need "data:", need to investigate
|
||||
// * avatar upload editor needs "blob:", at least "img-src" and "content-src"
|
||||
`default-src * data: blob:;` +
|
||||
|
||||
// enforce nonce for all scripts, disallow inline scripts
|
||||
`script-src * 'nonce-` + c.CspScriptNonce() + `';` +
|
||||
|
||||
Reference in New Issue
Block a user