Skip to content

[system] Serialize InitColorSchemeScript configuration values - #49091

Open
Janpot wants to merge 1 commit into
mui:masterfrom
Janpot:harden-init-color-scheme-script
Open

[system] Serialize InitColorSchemeScript configuration values#49091
Janpot wants to merge 1 commit into
mui:masterfrom
Janpot:harden-init-color-scheme-script

Conversation

@Janpot

@Janpot Janpot commented Sep 4, 2026

Copy link
Copy Markdown
Member

The storage keys and default scheme names were interpolated straight into the inline SSR script, so an app that derives any of them from user- or tenant-controlled config could break out of the string literal (or the <script> element). This serializes those values with JSON.stringify (escaping <, U+2028, U+2029) before embedding them.

attribute and colorSchemeNode are assumed to be static, developer-defined values, so they're left as-is (the attribute prop doc now says so).

@code-infra-dashboard

code-infra-dashboard Bot commented Sep 4, 2026

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-49091--material-ui.netlify.app/
QR code for https://deploy-preview-49091--material-ui.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/material 🔺+136B(+0.03%) 🔺+48B(+0.03%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/private-theming 0B(0.00%) 0B(0.00%)
@mui/system 🔺+144B(+0.21%) 🔺+59B(+0.24%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@Janpot
Janpot force-pushed the harden-init-color-scheme-script branch from d25fa7d to f31b5bf Compare September 7, 2026 09:15
@Janpot Janpot added the security Pull requests that address a security vulnerability. label Sep 7, 2026
@Janpot
Janpot marked this pull request as ready for review September 7, 2026 09:29
@Janpot

Janpot commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

@claude review

@github-actions

This comment was marked as resolved.

The storage keys and default scheme names were interpolated straight
into the inline SSR script. An app that derives any of them from user-
or tenant-controlled config could break out of the string literal (or
the <script> element), so serialize those values with JSON.stringify
(escaping <, U+2028, U+2029) before embedding them.

The `attribute` and `colorSchemeNode` props are assumed to be static,
developer-defined values and are left as-is.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security Pull requests that address a security vulnerability.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant