Skip to content

Conversation

@MichaIng
Copy link
Member

@MichaIng MichaIng commented Jun 27, 2025

Summary

While 1; mode=block was seen as the most secure value for this header, some years ago, after possible side-channel attacks have become known, this turned towards 0 being the best-practice value, disabling XSS filtering entirely for those old browsers who still support it.

MDN web docs give some explanation: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-XSS-Protection#security_considerations

The OWASP cheat sheet recommends 0: https://cheatsheetseries.owasp.org/cheatsheets/HTTP_Headers_Cheat_Sheet.html#x-xss-protection

Here the related discussion when this recommendation was updated: OWASP/CheatSheetSeries#376

A Stack Overflow question underlines the clear recommendation, adding some more details: https://stackoverflow.com/questions/9090577

Since 1; mode=block is not a large security risk, it affects only very old browsers, and a changed recommendation will (sadly) trigger a lot of issues/topics in forum and GitHub, the old value however is allowed to pass the check. So to pass the check, either page blocking needs to be enabled along with XSS filtering, or XSS filtering needs to be disabled. The warning however will always suggest to disable it.

TODO

  • Update .htaccess
  • Update documentation, once the change has been generally accepted

Checklist

@MichaIng MichaIng added this to the Nextcloud 32 milestone Jun 27, 2025
@MichaIng MichaIng requested a review from a team as a code owner June 27, 2025 23:15
@MichaIng MichaIng requested review from artonge, skjnldsv and yemkareems and removed request for a team June 27, 2025 23:15
@MichaIng MichaIng added 3. to review Waiting for reviews security pending documentation This pull request needs an associated documentation update labels Jun 27, 2025
@MichaIng
Copy link
Member Author

MichaIng commented Jun 27, 2025

Just found #53476 which addresses pretty much the same, and probably in a more consequent way. Keeping the check for this ancient header which is not supported anymore by any browser since 2019, doesn't really make sense. And OWASP also suggests to just not set it at all, as alternative to explicitly disabling XSS filtering.

While `1; mode=block` was seen as the most secure value for this header, some years ago, after possible side-channel attacks have become known, this turned towards `0` being the best-practice value, disabling XSS filtering entirely for those old browsers who still support it.

MDN web docs give some explanation: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-XSS-Protection#security_considerations

The OWASP cheat sheet recommends `0`: https://cheatsheetseries.owasp.org/cheatsheets/HTTP_Headers_Cheat_Sheet.html#x-xss-protection

Here the related discussion when this recommendation was updated: OWASP/CheatSheetSeries#376

A Stack Overflow question underlines the clear recommendation, adding some more details: https://stackoverflow.com/questions/9090577

Since `1; mode=block` is not a large security risk, it affects only very old browsers, and a changed recommendation will (sadly) trigger a lot of issues/topics in forum and GitHub, the old value however is allowed to pass the check. So to pass the check, either page blocking needs to be enabled along with XSS filtering, or XSS filtering needs to be disabled. The warning however will always suggest to disable it.

Signed-off-by: MichaIng <[email protected]>
@MichaIng MichaIng force-pushed the enh/xss-protection-check branch from bcc49fb to 9160fdc Compare June 28, 2025 00:06
@MichaIng MichaIng added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Jun 28, 2025
@MichaIng
Copy link
Member Author

After sleeping a night over it and another thought, I am closing this PR in favor or #53476. If for whatever reason a majority thinks it makes more sense to keep the check for now, just accepting 0 as well, it can be re-opened any time. But I vote for removing the check instead.

@MichaIng MichaIng closed this Jun 28, 2025
@MichaIng MichaIng removed this from the Nextcloud 32 milestone Jun 28, 2025
@MichaIng MichaIng removed the 2. developing Work in progress label Jun 28, 2025
@MichaIng MichaIng deleted the enh/xss-protection-check branch June 28, 2025 15:11
@github-actions
Copy link
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: settings feedback-requested pending documentation This pull request needs an associated documentation update security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Setup check for X-XSS-Protection recommendation is deprecated

2 participants