Whitelist for preview files from the backend (#1651)
This PR adds a whitelist of safe files to download with `Content-Disposition: inline;` from the backend, all other files will be force download via `Content-Disposition: attachment;` existing svg files will still be rendered in a secure way via the html `image` tag. reference: https://digi.ninja/blog/svg_xss.php Signed-off-by: Lenin Alevski <alevsk.8772@gmail.com>
This commit is contained in:
@@ -254,7 +254,7 @@ func serveProxy(responseWriter http.ResponseWriter, req *http.Request) {
|
||||
}
|
||||
// Allow iframes
|
||||
responseWriter.Header().Set("X-Frame-Options", "SAMEORIGIN")
|
||||
responseWriter.Header().Set("X-XSS-Protection", "1")
|
||||
responseWriter.Header().Set("X-XSS-Protection", "1; mode=block")
|
||||
|
||||
io.Copy(responseWriter, resp.Body)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user