Skip to content

fix(Dashboard): Fix HTTP headers in app.flagsmith.com - #9116

Draft
emyller wants to merge 6 commits into
mainfrom
fix/sec-headers
Draft

emyller wants to merge 6 commits into
mainfrom
fix/sec-headers

Conversation

@emyller

@emyller emyller commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Contributes to ENG-687.

Changes

  • Use helmet to ensure security headers served frontend-level.
  • Add the headers X-Content-Type-Options: nosniff and Referrer-Policy: same-origin, plus Content-Security-Policy: frame-ancestors 'none' when the backend serves the dashboard.
  • Remove X-Powered-By.

Review effort: 1/5

@vercel

vercel Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated
docs Ignored Ignored Preview Nov 26, 2026 3:14pm UTC
flagsmith-frontend-preview Ignored Ignored Preview Nov 26, 2026 3:14pm UTC
flagsmith-frontend-staging Ignored Ignored Preview Nov 26, 2026 3:14pm UTC

Request Review

@linear-code

linear-code Bot commented Nov 25, 2026

Copy link
Copy Markdown

ENG-687

@github-actions github-actions Bot added front-end Issue related to the React Front End Dashboard api Issue related to the REST API labels Nov 25, 2026
@emyller emyller self-assigned this Nov 25, 2026
@github-actions github-actions Bot added the fix label Nov 25, 2026
@codecov

codecov Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 98.93%. Comparing base (d42d4a3) to head (d6e0a24).

Files with missing lines Patch % Lines
api/app/views.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9116      +/-   ##
==========================================
+ Coverage   98.07%   98.93%   +0.85%     
==========================================
  Files        1716     1716              
  Lines       72803    72808       +5     
==========================================
+ Hits        71402    72031     +629     
+ Misses       1401      777     -624     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread frontend/api/index.js Outdated
const app = express()

app.use(frameProtection)
app.use(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The tests were removed without replacement. Could we keep a separate middleware file so we can have unit test there with a mocked res.setHeader. i think it's cheap enough to make sure the headers are not dropped in case of config change

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I hope it's improved in bc17aa6. Thanks!

Comment thread frontend/api/index.js Outdated
}),
helmet.xFrameOptions({ action: 'deny' }),
helmet.xContentTypeOptions(),
helmet.referrerPolicy({ policy: 'same-origin' }),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just a note that this is strict and we would lose the referer in analytics. If that's not acceptable, we could use strict-origin-when-cross-origin which keeps the origin without the full path

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Great catch! I was misled by bad LLM research. 2380915

dammit claude
@github-actions github-actions Bot added fix and removed fix labels Nov 26, 2026
@emyller
emyller requested a review from Zaimwa9 November 26, 2026 15:15

This branch was successfully deployed

2 active (outdated) deployments
Preview – flagsmith-frontend-preview — 23809159 Deployed Nov 26, 2026 by vercel[bot]
Preview – flagsmith-frontend-staging — 23809159 Deployed Nov 26, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API fix front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants