Fix Cross-Origin-Opener-Policy header on static error pages#6274
Open
alikabeel-spooner wants to merge 3 commits intorubygems:masterfrom
Open
Fix Cross-Origin-Opener-Policy header on static error pages#6274alikabeel-spooner wants to merge 3 commits intorubygems:masterfrom
alikabeel-spooner wants to merge 3 commits intorubygems:masterfrom
Conversation
Static error pages (404, 500, etc.) served from the public/ directory were not receiving the Cross-Origin-Opener-Policy header because they bypass the Rails controller stack and the action_dispatch.default_headers configuration. This fix adds a SecurityHeaders middleware at position 0 in the middleware stack to ensure all responses, including static error pages, receive the COOP header. This prevents XS-leak attacks where malicious sites can control window navigation after opening rubygems.org. Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Member
|
Any particular reason why this was re-opened from #5442 ? |
Author
Yes, the Rails team mentioned this should be in the frameworks that believe it adds security value. I also I believe this version is cleaner than the other one. Finally, the HackerOne report has been opened for ages and I would love to fix it and get it resolved. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6274 +/- ##
==========================================
- Coverage 38.65% 37.98% -0.67%
==========================================
Files 487 488 +1
Lines 10728 10798 +70
==========================================
- Hits 4147 4102 -45
- Misses 6581 6696 +115 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Static error pages (404, 500, etc.) served from the public/ directory were not receiving the Cross-Origin-Opener-Policy header because they bypass the Rails controller stack and the action_dispatch.default_headers configuration.
This fix adds a SecurityHeaders middleware at position 0 in the middleware stack to ensure all responses, including static error pages, receive the COOP header. This prevents XS-leak attacks where malicious sites can control window navigation after opening rubygems.org.