Add security headers - #833
Conversation
|
Hi @w00000dy, thank you for the PR! Most People that are using the integrated webserver are either not super "techy" or are just hosting bluemap casually for a very small server. -> Keep the integrated webserver casual, with no focus on ssl or "security", use a "proper" external webserver if these advanced options are needed :) |
|
Hi @TBlueF, Thank you for taking a look at my PR! Therefore, my suggestion would be to make the |
|
@w00000dy I ofc agree with the "secure by default" approach, but... There is already users who just embed their bluemap hosted by some gameserver-host in their static website and are happy with not having any https on both. There also might be users that use custom scripts that might break with the So You also removed the version from the My suggestion would be:Add a config in the additional-headers: {
#"Content-Security-Policy": "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https:; object-src 'none';"
"X-Frame-Options": "SAMEORIGIN"
"X-Content-Type-Options": "nosniff"
"Referrer-Policy": "strict-origin-when-cross-origin"
"Permissions-Policy": "accelerometer=(), ambient-light-sensor=(), autoplay=(), battery=(), camera=(), cross-origin-isolated=(), display-capture=(), document-domain=(), encrypted-media=(), execution-while-not-rendered=(), execution-while-out-of-viewport=(), fullscreen=(self), geolocation=(), gyroscope=(), keyboard-map=(), magnetometer=(), microphone=(), midi=(), navigation-override=(), payment=(), picture-in-picture=(), publickey-credentials-get=(), screen-wake-lock=(self), sync-xhr=(), usb=(), web-share=(), xr-spatial-tracking=()"
}And use that config to send the configured headers with the internal-webserver. That way we not just hardcode some fixed headers and values, instead we add a new powerful feature with a reasonably secure default configuration and a very straight forward way for the user to turn them off or change them. Or even add new ones! :) I would be happy to merge a PR that implements this cleanly 👍 |
|
I like the idea of adding a configuration to the web server configuration file. 👍🏼 I'll try to implement it. I removed the version from the Server header for defense in depth. Let's assume that BlueMap version 5.2 contains a critical security vulnerability. You can then use this server header to scan the internet for all outdated BlueMap installations. |
|
The version in the header and in other places is one of the most important tools for us to help and support people that have issues with their setup. I am looking at that exact header daily while analyzing support-questions in our discord :D |
This pull request adds several security headers to the HTTP responses.
https://bluecolored.de/bluemap/ uses nginx, but the result would be the same on the BlueMap web server.
Security improvements:
This adds several HTTP security headers to all responses, including
Content-Security-Policy,X-Frame-Options,X-Content-Type-Options,Referrer-Policy, andPermissions-Policy.I didn't include
Strict-Transport-Securitybecause BlueMap's web server doesn't handle HTTPS. If you use a reverse proxy (like Nginx, Caddy, or Cloudflare) for HTTPS, set this header there.I also changed the
ServerHTTP header from a versioned string (e.g.,BlueMap/1.0) to simplyBlueMap.What does not work anymore:
If users load their own scripts or CSS cross-origin, this is now blocked by CSP. If we should change this just let me know.