Skip to content

Match main Redash's security in global redash - #76

Merged
imenattatra merged 2 commits into
metr-mainfrom
feature/harden-global-redash-security
Jul 22, 2026
Merged

Match main Redash's security in global redash#76
imenattatra merged 2 commits into
metr-mainfrom
feature/harden-global-redash-security

Conversation

@imenattatra

Copy link
Copy Markdown

Closes https://github.com/metr-systems/backlog/issues/4942

AI Disclaimer: I did use claude opus to double check if global redash and main are on the same security level and to plan if anything is missing and also to assist

Summary

Global redash was missing the protections the main app gets from flask-talisman. This brings it up to at least the same level.

Code Strategy

  • Add a dedicated Talisman instance in security.py, configured from the same redash settings the main app reads. One set of env vars (REDASH_ENFORCE_HTTPS, REDASH_HSTS_*, REDASH_CONTENT_SECURITY_POLICY, ...) now hardens both apps the same way, instead of the two drifting apart.
  • This adds HTTPS + HSTS enforcement, X-Frame-Options, a Content-Security-Policy, a referrer policy, and Secure/HttpOnly session cookie flags.
  • Use a dedicated instance rather than the main app's, to keep the two apps decoupled, matching the existing separate csrf and limiter instances.

Global redash was missing the
transport and header protections the main app gets from flask-talisman.
This brings it up to at least the same level, so Global is never weaker
than the main app.

- Add a dedicated Talisman instance in security.py, configured from the
  same redash settings the main app reads. One set of env vars
  (REDASH_ENFORCE_HTTPS, REDASH_HSTS_*, REDASH_CONTENT_SECURITY_POLICY,
  ...) now hardens both apps the same way, instead of the two drifting
  apart.
- This adds HTTPS + HSTS enforcement, X-Frame-Options, a
  Content-Security-Policy, a referrer policy, and Secure/HttpOnly session
  cookie flags.
- Use a dedicated instance rather than the main app's, to keep the two
  apps decoupled, matching the existing separate csrf and limiter
  instances.
@imenattatra
imenattatra requested review from a team and helenalebreton July 15, 2026 16:43
@imenattatra imenattatra self-assigned this Jul 15, 2026

@berinhard berinhard left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Shouldn't we add a test to make sure both talisman configurations, Redash's and our global one, are using the very same values for every attr?

From their source code, it seems it would be an easy thing to test as every parameter gets mapped to an object's attribute.

@imenattatra

Copy link
Copy Markdown
Author

Shouldn't we add a test to make sure both talisman configurations, Redash's and our global one, are using the very same values for every attr?

From their source code, it seems it would be an easy thing to test as every parameter gets mapped to an object's attribute.

please find it updated in the latest commit, thank you!

@imenattatra
imenattatra requested a review from berinhard July 16, 2026 15:31

@berinhard berinhard left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sorry for the late review, but thanks for adding the tests 👍

@imenattatra
imenattatra merged commit 07f1b2e into metr-main Jul 22, 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