ATLAS-5389: Atlas React Dashboard — Align UI with strict browser resource policy (nonce-based script/style handling) - #744
Open
pawarprasad123 wants to merge 1 commit into
Open
Conversation
…urce policy (nonce-based script/style handling)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR prepares the React Dashboard for strict Content Security Policy (CSP) by wiring a per-request CSP nonce into MUI/Emotion style injection. When the server injects a nonce into the HTML shell and CSP headers, Emotion-generated <style> tags will carry the same nonce and will not be blocked by the browser.
Without this change, MUI components (which use Emotion for sx and runtime styles) would render unstyled under a strict style-src 'self' 'nonce-...' policy.
Problem
DAST findings show Atlas UI currently allows inline scripts, dynamic eval, and inline styles. Server-side work will introduce per-request nonce support. On the React side:
Under strict CSP, blocked Emotion styles would break the entire React UI (sidebar, tables, forms, toasts, etc.).
Out of Scope (follow-up on same JIRA)
How was this patch tested?
Automated tests
Command run:
Result: 33/33 passed (3 suites, ~3s)
Build verification
cd dashboard && npm run buildResult: Success (~12.6s) — no TypeScript or Vite errors.
Linter verification
Result: No linter errors in changed files.
Manual testing (required before integrated merge)
These require backend CSP + HTML nonce injection (not available in unit tests):
Dependencies
Backend PR must deploy per-request nonce generation and HTML injection before full E2E validation.
Vite build already externalizes JS bundles — no pipeline changes needed.
@emotion/cache is available transitively via @emotion/react / MUI.