Skip to content

[Autocomplete] Use hash_equals() to compare the extra_options checksum#3565

Merged
Kocal merged 1 commit into
symfony:3.xfrom
Kocal:security/autocomplete/hash-equals
May 20, 2026
Merged

[Autocomplete] Use hash_equals() to compare the extra_options checksum#3565
Kocal merged 1 commit into
symfony:3.xfrom
Kocal:security/autocomplete/hash-equals

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

validateChecksum() compared the client-supplied checksum against the
server-computed HMAC with !==, which short-circuits on the first
differing byte and is therefore not constant-time (CWE-208).

The checksum guards the integrity of extra_options, which the
controller feeds into the autocompleter as form-creation options, so the
comparison should be timing-safe. Switch to hash_equals() with the
known value as the first argument. LiveComponent already does this in
LiveComponentHydrator::verifyChecksum() — this aligns Autocomplete with
it.

validateChecksum() compared the client-supplied checksum against the
server-computed HMAC with `!==`, which short-circuits on the first
differing byte and is therefore not constant-time (CWE-208).

The checksum guards the integrity of `extra_options`, which the
controller feeds into the autocompleter as form-creation options, so the
comparison should be timing-safe. Switch to hash_equals() with the
known value as the first argument. LiveComponent already does this in
LiveComponentHydrator::verifyChecksum() — this aligns Autocomplete with
it.
@Kocal Kocal self-assigned this May 20, 2026
@carsonbot carsonbot added Autocomplete Bug Bug Fix Status: Needs Review Needs to be reviewed labels May 20, 2026
@Kocal Kocal changed the title [Autocomplete] Use hash_equals() to compare the extra_options checksum [Autocomplete] Use hash_equals() to compare the extra_options checksum May 20, 2026
@Kocal
Copy link
Copy Markdown
Member Author

Kocal commented May 20, 2026

Thank you @Amoifr.

@Kocal Kocal merged commit 6391e78 into symfony:3.x May 20, 2026
28 checks passed
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.

3 participants