fix: split large Content-Security-Policy headers over multiple HTTP headers#60337
fix: split large Content-Security-Policy headers over multiple HTTP headers#60337n-iv wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses Apache mod_proxy_fcgi failures caused by oversized Content-Security-Policy response headers by splitting long CSP/Feature-Policy values into multiple header() calls (splitting only between directives) to stay under a safe per-header length threshold.
Changes:
- Add logic in the HTTP output layer to split large
Content-Security-PolicyandFeature-Policyheaders into multiple header lines. - Keep splitting boundaries at directive separators (
;) to avoid splitting inside directives.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
cc @skjnldsv could be related to nextcloud/documentation#13803 |
Was thinking the same!! |
|
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.) |
bd7e780 to
ef604a0
Compare
|
@n-iv could you squash your commits into one again please? :) |
7b084c6 to
e445372
Compare
…eaders Signed-off-by: niv <nicolas.varlot@ac-versailles.fr>
|
Hi @skjnldsv I squashed my commits. Np for your availability, mine is quite low too :) |
Summary
When the
Content-Security-Policyheader exceeds 7800 bytes, split it into multipleheader()calls. Apachemod_proxy_fcgiotherwise fails withAH01070 Error parsing script headersand returns HTTP 500 becauseHUGE_STRING_LENis hardcoded at 8192 bytes inhttpd.hand is used to parse FCGI response headers. Raising this limit by recompiling Apache does not fix the issue (other related FCGI buffer limits sit at the same value).The split is performed only between directives, never inside one. Per CSP Level 3 §3.1, multiple CSP headers are enforced as the intersection of the conveyed policies, so behavior is unchanged for compliant clients.
Checklist
3. to review, feature component)stable32)AI (if applicable)