Skip to content

[LiveComponent] Make LiveComponentSubscriber safe-by-default#3566

Open
Kocal wants to merge 1 commit into
symfony:3.xfrom
Kocal:security/live-component/testmode-default
Open

[LiveComponent] Make LiveComponentSubscriber safe-by-default#3566
Kocal wants to merge 1 commit into
symfony:3.xfrom
Kocal:security/live-component/testmode-default

Conversation

@Kocal
Copy link
Copy Markdown
Member

@Kocal Kocal commented May 20, 2026

Q A
Bug fix? yes
New feature? no
Deprecations? no
Documentation? no
Issues Fix #...
License MIT

A minor improvement, to make LiveComponentSubscriber "safe by default", by setting $testMode defaults to false.

Note that LiveComponentSubscriber is an internal class.

@Kocal Kocal self-assigned this May 20, 2026
@carsonbot carsonbot added Bug Bug Fix LiveComponent Status: Needs Review Needs to be reviewed labels May 20, 2026
`LiveComponentSubscriber::$testMode` defaulted to `true` in the
constructor, which disabled the `Accept: application/vnd.live-component+html`
check (documented as the CSRF defense) for any consumer that built the
subscriber outside the bundle's compiler pass.

The bundle's own `OptionalDependencyPass` already overrode the value to
`false` for non-test kernels, so the default never reached production
through normal DI — but the unsafe default remained a footgun for
manual instantiation, custom containers, or test setups that bypass
the pass.

Flip the constructor default to `false` and have `OptionalDependencyPass`
opt the test kernel in (when `test.client` is defined) instead of
opting production out. Same end state for both environments, safer
fallback when the pass is not in play.
@Kocal Kocal force-pushed the security/live-component/testmode-default branch from f1e4358 to d7b2a23 Compare May 20, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants