-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve headers for security #4757
base: staging
Are you sure you want to change the base?
Changes from 6 commits
61d61fe
a7368ab
5ad9ebc
2d4ed5c
7b9e500
3661cdc
7bb124c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,14 +13,18 @@ | |
ssl_session_timeout 1d; | ||
ssl_session_tickets off; | ||
|
||
add_header Strict-Transport-Security "max-age=15768000;"; | ||
add_header Strict-Transport-Security "max-age=15768000; preload"; | ||
add_header X-Content-Type-Options nosniff; | ||
add_header X-XSS-Protection "1; mode=block"; | ||
add_header X-XSS-Protection "0"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this option entirely. As per https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection, it is superseded by the Content-Security-Policy and not supported by any browser anymore. |
||
add_header X-Robots-Tag none; | ||
add_header X-Download-Options noopen; | ||
add_header X-Frame-Options "SAMEORIGIN" always; | ||
add_header X-Permitted-Cross-Domain-Policies none; | ||
add_header Referrer-Policy strict-origin; | ||
add_header Permissions-Policy "accelerometer=(), ambient-light-sensor=(), autoplay=(), battery=(), camera=(), clipboard-read=(), display-capture=(), document-domain=(), encrypted-media=(), fullscreen=(), geolocation=(), gyroscope=(), hid=(), idle-detection=(), interest-cohort=(), magnetometer=(), microphone=(), midi=(), payment=(), picture-in-picture=(), screen-wake-lock=(), serial=(), usb=(), sync-xhr=(), xr-spatial-tracking=()"; | ||
add_header Content-Security-Policy "default-src 'none'; connect-src 'self' https://api.github.com https://www.gravatar.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: https://www.gravatar.com; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; frame-ancestors 'none'; upgrade-insecure-requests; block-all-mixed-content; base-uri 'none'"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this list still complete? The pull request is a year old, perhaps we now have different external dependencies? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am still using this on my mailcow instance and have not had any issues. I can check later but I'd still expect it to work. |
||
add_header Cross-Origin-Opener-Policy same-origin; | ||
add_header Cross-Origin-Resource-Policy same-origin; | ||
|
||
index index.php index.html; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to https://hstspreload.org,
preload
has no effect whenincludeSubDomains
is not specified. And we definitely don't want that option as it has an effect outside of Mailcow.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that it should be removed, a quote also from hstspreload.org: