-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Fix: Remove X-XSS-Protection use, check and recommendation #53476
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
Fix: Remove X-XSS-Protection use, check and recommendation #53476
Conversation
Co-authored-by: John Molakvoæ <[email protected]> Signed-off-by: invario <[email protected]>
e397074
to
2b58f74
Compare
Looks a documentation PR is there since some years as well: nextcloud/documentation#9188 |
Thanks! I didn't even look into the documentation yet, but now that I searched, it seems there are (3) instances of it being mentioned in the docs. (2) of them are for nginx sample configurations, and (1) is the one you mentioned. I'll gladly do another PR to remove those mentions... but wondering if I should wait to see if my current PR gets a green light. |
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.
Blocking to prevent merge during vacations
Umm, coincidentally I was just annoyed enough by the false warning and created as well a PR to address this 😅. It however leaves the check in place, just allows But OWASP indeed suggests both, either disabling XSS filtering explicitly, or not setting the header at all. So removing it from checks entirely is probably the better move. But I will leave the PR as alternative, if someone prefers it that way. For anyone who is interested in more details about this header, and the actual vulnerabilities XSS filtering causes, even if combined with page blocking:
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
@invario can you rebase please, so we get checks green? I did locally, so there are no conflicts, but better to keep your commit signature. We need to wait for vacation lock to be lifted anyway, but lets assure everything else is finished and ready, to minimize any further delay. I updated nextcloud/documentation#9188 to match this PR. |
Great, thanks! Will rebase. Need bit of time. limited Internet on cruise lol |
But that is basically exactly it. By default Nextcloud is not embeddable from anywhere but itself: server/lib/public/AppFramework/Http/ContentSecurityPolicy.php Lines 75 to 78 in af6de04
But reading further it seems CSP is covering this in general and for more browsers (comments against it were from 12-15y ago before CSP was a wide-spread thing). |
Right, and even if CSP is not supported, it sets (and checks for) |
Tests are weirdly failing. |
Cypress and performance tests are expected to fail, but no idea what the background of this is:
|
That is not what was confusing, the background is security of our GitHub tokens. |
Ah right, secrets are not accessible by forks, so Cypress would then fail due to empty But why was the performance test failing, or why shall it not run on forks? Regarding secrets, it uses However, nodb tests and everything else is green. Suitable for backport to 31 and 30 or not? |
Not sure who is responsible so posting just here for now, https://scan.nextcloud.com probably needs adjustments as well as it reports e.g. the header as missing now. |
Good point! Not sure where to report best 🤔. |
see nextcloud/server#53476 (cherry picked from commit 06c99c2)
X-XSS-Protection
recommendation is deprecated #37154Summary
Use of the
X-XSS-Protection
header with value"1; mode=block"
is deprecated and in fact it appears to generally be recommended against. There are indications that from searching online that using it may actually cause vulnerabilities.TODO
Test for any issues? I put this PR together quickly by just searching the repo for any mention of
X-XSS-Protection
and removing it/the corresponding code. There were a total of (8) instances located and I removed them all in this PR.If simply removing this is bad practice, I would appreciate input/direction, as from what I read, the proper solution is to implement a "strong" CSP. One of the suggestions to avoid problems is to ensure
unsafe-inline
isn't used, but when I spot checked various NC apps and pages, I saw it was being used.**However**, I believe it is still recommended to remove
X-XSS-Protection
no matter what.Checklist