Skip to content

fix: add security headers to nginx config#8

Merged
wicky-zipstack merged 2 commits intomainfrom
fix/nginx-security-headers
Mar 26, 2026
Merged

fix: add security headers to nginx config#8
wicky-zipstack merged 2 commits intomainfrom
fix/nginx-security-headers

Conversation

@wicky-zipstack
Copy link
Contributor

What

  • Add security headers to frontend/nginx.conf to address VAPT findings

Why

How

Added 4 security headers to the server block in frontend/nginx.conf:

  • X-Frame-Options: DENY — prevents the page from being embedded in iframes (anti-clickjacking)
  • X-Content-Type-Options: nosniff — prevents MIME type sniffing
  • Referrer-Policy: strict-origin-when-cross-origin — controls referrer information sent with requests
  • Content-Security-Policy — restricts content sources to prevent XSS:
    • default-src 'self' — only allow same-origin by default
    • script-src 'self' 'unsafe-inline' 'unsafe-eval' — required for React
    • connect-src 'self' https://*.visitran.com wss://*.visitran.com — allow API and WebSocket connections
    • frame-ancestors 'none' — modern replacement for X-Frame-Options

Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)

  • Low risk. The CSP policy is permissive enough to allow React's inline scripts/styles and connections to visitran.com subdomains. Already hot-patched and verified on production (app.visitran.com) — app loads and functions correctly with these headers. The always directive ensures headers are sent on all response codes including errors.

Database Migrations

  • None

Env Config

  • None

Relevant Docs

Related Issues or PRs

Dependencies Versions

  • None

Notes on Testing

  • Already verified on production via hot-patch:
    curl -sI https://app.visitran.com | grep -i "content-security\|x-frame\|x-content-type\|referrer"
    
    All 4 headers present and app functions correctly
  • After merge and rebuild, verify headers persist across pod restarts

Screenshots

N/A — verified via curl headers.

Checklist

  • I have read and understood the Contribution Guidelines.
  • X-Frame-Options header added
  • X-Content-Type-Options header added
  • Referrer-Policy header added
  • Content-Security-Policy header added
  • Verified on production via hot-patch — app loads correctly

Copy link

@abhizipstack abhizipstack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wicky-zipstack wicky-zipstack merged commit 1ddf329 into main Mar 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants