Skip to content

[NSOC] [GSSoC] Add Server-Side CORS + Security Headers Hardening - #842

Merged
devanshi14malhotra merged 3 commits into
devanshi14malhotra:mainfrom
Aditya8369:801
May 24, 2026
Merged

devanshi14malhotra merged 3 commits into
devanshi14malhotra:mainfrom
Aditya8369:801

Conversation

@Aditya8369

Copy link
Copy Markdown
Contributor

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

  • Bug Fix
  • Feature
  • Enhancement
  • Documentation

Checklist

  • Code follows guidelines
  • Tested properly
  • Docs updated
  • PR title includes the relevant event tag or a general contribution label

Example:
[NSoC'26] Add authentication system

@netlify

netlify Bot commented May 21, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for bibliodrift-dm ready!

Name Link
🔨 Latest commit af8b6ba
🔍 Latest deploy log https://app.netlify.com/projects/bibliodrift-dm/deploys/6a1116518b30aa0008460913
😎 Deploy Preview https://deploy-preview-842--bibliodrift-dm.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Aditya8369

Copy link
Copy Markdown
Contributor Author

@devanshi14malhotra consider my PRs under both NSOC and GSSoC

@Aditya8369

Copy link
Copy Markdown
Contributor Author

@devanshi14malhotra fixed the conflicts

@devanshi14malhotra devanshi14malhotra added level3 10 points NSoC'26 For issues and PRs which are a part of the Nexus Spring of Code open source event labels May 24, 2026
@devanshi14malhotra
devanshi14malhotra merged commit f73c584 into devanshi14malhotra:main May 24, 2026
5 of 6 checks passed
@Aditya8369

Aditya8369 commented May 24, 2026 •

Copy link
Copy Markdown
Contributor Author

@devanshi14malhotra please add gssoc:approved and other labels also for all my PRs....

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

Labels

level3 10 points NSoC'26 For issues and PRs which are a part of the Nexus Spring of Code open source event

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SECURITY] Add Server-Side CORS + Security Headers Hardening

2 participants