Skip to content

Conversation

@snim2
Copy link
Contributor

@snim2 snim2 commented Sep 5, 2025

Tighten the CSP so that src-scripts no longer has unsafe-inline but instead validates a nonce on every script.

snim2 and others added 16 commits August 29, 2025 08:32
We expect that styles and scripts rendered in the admin
dashboard will not be filterable, so only supply a
CSP for the front-end.
So we can use it with a CSP.
And add a nonce to all enqueued scripts.
In preparation for removing gravatar.com from the CSP.
Make addContentSecurityPolicy solely responsible for deciding
when to add a CSP to a page. Applies SRP.
Previously a bug in the implementation of is_login() caused
CSPs to be omitted for any page which partially matched the
path '/wp-login.php' including '/'.

Now, we work around that by checking SCRIPT_NAME in the
superglobal directly.

See:
    https://core.trac.wordpress.org/ticket/63896#ticket
@snim2 snim2 merged commit 7bf45c0 into main Sep 5, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants