Skip to content

[core-docs] Tighten service worker host check#48581

Open
Janpot wants to merge 1 commit into
mui:masterfrom
Janpot:fix/sw-host-check
Open

[core-docs] Tighten service worker host check#48581
Janpot wants to merge 1 commit into
mui:masterfrom
Janpot:fix/sw-host-check

Conversation

@Janpot
Copy link
Copy Markdown
Member

@Janpot Janpot commented May 27, 2026

Summary

Closes CodeQL alert "Incomplete URL substring sanitization" on serviceWorker.ts.

window.location.host.includes('mui.com') matches any host where mui.com appears anywhere in the string. Switch to an exact-or-subdomain check so the service worker only registers on the real mui.com deployment.

Two-character semantic improvement; not a meaningful attack vector since window.location.host is browser-provided, but the new code is more correct.

`includes('mui.com')` matches any host containing `mui.com` as a
substring. Switch to an exact-or-subdomain check so the service worker
only registers on the real mui.com deployment.
@code-infra-dashboard
Copy link
Copy Markdown

Deploy preview

https://deploy-preview-48581--material-ui.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/private-theming 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


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

@Janpot Janpot added the scope: docs-infra Involves the docs-infra product (https://www.notion.so/mui-org/b9f676062eb94747b6768209f7751305). label May 27, 2026
@Janpot Janpot requested a review from a team May 27, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: docs-infra Involves the docs-infra product (https://www.notion.so/mui-org/b9f676062eb94747b6768209f7751305).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant