Empty array key validation bypass
Summary
When validated input contains an array element whose key is an empty string, such as {"items": {"": {"name": "..."}}} in a JSON request, the rules attached to items.* are never applied to that element. ValidationRuleParser already matches empty segments with [^\.]*, but `ValidationData::extr...
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| composerlaravel/framework |
<13.43.0→ >=13.43.0 |
>=13.43.0 |
| composerlaravel/framework |
<12.73.0→ >=12.73.0 |
>=12.73.0 |
Original description The description as published by the source.
When validated input contains an array element whose key is an empty string, such as {"items": {"": {"name": "..."}}} in a JSON request, the rules attached to items.* are never applied to that element. ValidationRuleParser already matches empty segments with [^\.]*, but ValidationData::extractValuesForWildcards() and Validator::getExplicitKeys() still use [^\.]+, so the element is never gathered and wildcard parameters such as required_if:users.*.role,admin are not resolved for it. Rules like Rule::forEach() or array:name,qty on items.* are silently skipped for that element.
Source: GitHub Repository Security Advisories (Game のスタック) GitHub Advisory OSV
References
- GITHUB_REPO_ADVISORY laravel/framework