Add Content-Security-Policy header to feed icon url
- SVG images could contains Javascript. This CSP blocks inline script. - Feed icons are served using <img> tag and Javascript is not interpreted. See https://developer.mozilla.org/en-US/docs/Web/SVG/SVG_as_an_Image#restrictions
This commit is contained in:
parent
33fd0a617e
commit
2935aaef45
2 changed files with 2 additions and 0 deletions
|
@ -27,6 +27,7 @@ func (h *handler) showIcon(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
response.New(w, r).WithCaching(icon.Hash, 72*time.Hour, func(b *response.Builder) {
|
||||
b.WithHeader("Content-Security-Policy", `default-src 'self'`)
|
||||
b.WithHeader("Content-Type", icon.MimeType)
|
||||
b.WithBody(icon.Content)
|
||||
b.WithoutCompression()
|
||||
|
|
|
@ -67,6 +67,7 @@ func (h *handler) imageProxy(w http.ResponseWriter, r *http.Request) {
|
|||
etag := crypto.HashFromBytes(decodedURL)
|
||||
|
||||
response.New(w, r).WithCaching(etag, 72*time.Hour, func(b *response.Builder) {
|
||||
b.WithHeader("Content-Security-Policy", `default-src 'self'`)
|
||||
b.WithHeader("Content-Type", resp.Header.Get("Content-Type"))
|
||||
b.WithBody(resp.Body)
|
||||
b.WithoutCompression()
|
||||
|
|
Loading…
Add table
Reference in a new issue