Skip to content

[docs] Improve CSP guide with required directives#48258

Draft
Janpot wants to merge 7 commits intomui:masterfrom
Janpot:docs/improve-csp-guide
Draft

[docs] Improve CSP guide with required directives#48258
Janpot wants to merge 7 commits intomui:masterfrom
Janpot:docs/improve-csp-guide

Conversation

@Janpot
Copy link
Copy Markdown
Member

@Janpot Janpot commented Apr 10, 2026

Summary

  • Restructure the CSP guide around static vs. dynamic website setups
  • Add a "Required directives" section explaining style-src-elem, style-src-attr, and script-src
  • Clarify that style-src-attr 'unsafe-inline' is only needed for SSR (React's CSSOM API is CSP-safe in client-only apps)
  • Add static hosting guidance (nonces require a server)
  • Add "CSP is optional" callout

…distinction

Restructure the Content Security Policy guide to clearly explain:
- Which CSP directives Material UI requires and why
- The difference between static and dynamic website setups
- That style-src-attr 'unsafe-inline' is needed for SSR due to
  inline style attributes, but not for client-only apps
- That nonces require a server and can't be used with static hosting
@Janpot Janpot added the docs Improvements or additions to the documentation. label Apr 10, 2026
@mui-bot
Copy link
Copy Markdown

mui-bot commented Apr 10, 2026

Netlify deploy preview

Bundle size report

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against be9d5bd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to the documentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants