Repository navigation
[NSOC] [GSSoC] Add Server-Side CORS + Security Headers Hardening - #842
Merged
Merged
Conversation
✅ Deploy Preview for bibliodrift-dm ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
Author
|
@devanshi14malhotra consider my PRs under both NSOC and GSSoC |
Contributor
Author
|
@devanshi14malhotra fixed the conflicts |
devanshi14malhotra
merged commit May 24, 2026
f73c584
into
devanshi14malhotra:main
5 of 6 checks passed
Contributor
Author
|
@devanshi14malhotra please add |
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.
Pull Request
NSOC and GSSoC
Description
Server-side hardening is in place in backend/app.py: every response now goes through a shared security-header helper, with CSP, HSTS, nosniff, Referrer-Policy, Permissions-Policy, and X-Frame-Options set consistently. CORS is now an explicit allowlist with credentials enabled, restricted methods/headers, and no wildcard origin usage. I also kept the policy applied in both active app sections in that file so the duplicate initialization path is covered.
I added an integration check in tests/test_security_headers.py that asserts the security headers and trusted-origin CORS behavior on
/api/v1/health. Static validation passed, but executable pytest is still blocked in the current venv by a missing dependency:flask_migrate.Related Issue
Fixes #801
Type of Change
Checklist
Example:
[NSoC'26] Add authentication system