Skip to content

Update X-XSS-Protection recommendation #53711

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

Closed
wants to merge 1 commit into from

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 <micha@dietpi.com>
@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: settings 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
1 participant