Skip to content

Enable x-html in the CSP build - #4932

Open
m-develops wants to merge 1 commit into
alpinejs:mainfrom
m-develops:csp-enable-x-html
Open

m-develops wants to merge 1 commit into
alpinejs:mainfrom
m-develops:csp-enable-x-html

Conversation

@m-develops

Copy link
Copy Markdown

The CSP build replaces x-html with a directive that throws, so apps that use it for trusted HTML render nothing under a CSP. Filament renders its own icon HTML and labels this way, which breaks under Livewire's csp_safe mode.

CSP itself does not restrict what x-html does: the browser still blocks scripts and inline event handlers in the inserted HTML, and Alpine expressions in it go through the CSP evaluator like any other markup. So this removes the override and lets the CSP build use the core directive unchanged. Like in the core build, Alpine attributes in the inserted HTML are initialized, so x-html should only receive trusted content, as its docs already warn.

The test that expected an error now checks that x-html renders and initializes its content in the CSP build, like the core test of the same name.

Discussed with @danharrin in filamentphp/filament#20661.

This branch has not been deployed

No deployments
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.

1 participant