-
-
Notifications
You must be signed in to change notification settings - Fork 354
Using CSP nonce - enforce stricter CSP #2786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Reviewer's Guide by SourceryThis pull request implements Content Security Policy (CSP) nonce support for Altair. It adds a Sequence diagram for applying theme with CSP noncesequenceDiagram
participant ThemeDirective
participant EmotionInstance
participant getCSS
ThemeDirective->>ThemeDirective: getEmotionInstance()
alt EmotionInstance does not exist
ThemeDirective->>ThemeDirective: createEmotion({ key: 'altair-theme', nonce: this.cspNonce })
ThemeDirective-->>EmotionInstance: Returns new Emotion instance
end
ThemeDirective->>EmotionInstance: css(getCSS(appTheme, appDarkTheme, accentColor))
EmotionInstance-->>ThemeDirective: Returns class name
ThemeDirective->>document: document.documentElement.classList.add(className)
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @imolorhe - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider creating a dedicated configuration service or constant for the default CSP nonce value to avoid hardcoding it in multiple places.
- It might be useful to add a runtime check to ensure the provided CSP nonce is valid before applying it.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Visit the preview URL for this PR (updated for commit 2597652): https://altair-gql--pr2786-imolorhe-use-csp-non-zows9j1c.web.app (expires Fri, 14 Mar 2025 20:29:32 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 02d6323d75a99e532a38922862e269d63351a6cf |
a7f61ef
to
ebf6cee
Compare
ebf6cee
to
2597652
Compare
Related to #2775
cspNonce
to altair config option.Required CSP allowed values
Summary by Sourcery
Documentation: