Skip to content
Medium 5.4

Empty array key validation bypass

GHSA-cq3g-fj94-c8p3 First seen on SecPulse

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

PackageAffected → Fixed
composerlaravel/framework
<13.43.0→ >=13.43.0
composerlaravel/framework
<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

We use cookies for analytics and ad measurement. This setting applies to all Game co., Ltd. sites. Details