Repository navigation
fix(auth): reject non-list authorization_details shapes - #243
Merged
Merged
Conversation
A JSON object decodes to an associative PHP array that passes is_array(), so a map used where RFC 9396 requires a list was still traversed: a map of entries at the top level, or a map-valued field, could grant a value. That contradicted the "non-list input contributes nothing" contract and could turn a malformed claim into an access grant. Require list shape at both levels — the entry collection and each field — via array_is_list(), with regression coverage for associative inputs at each level. Also documents the helper and its wildcard semantics in docs/oauth2.md, per the package's guidance to document new OAuth2 helpers there.
ChiragAgg5k
requested review from
eldadfux,
lohanidamodar and
loks0n
as code owners
September 9, 2026 14:55
Contributor
loks0n
approved these changes
Sep 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #242, addressing the two Greptile review comments.
P1 (security): non-list shapes could grant access
A JSON object decodes to an associative PHP array, which passes
is_array(). So a map used where RFC 9396 requires a list was still traversed:{"named": {"type": "project", "identifiers": ["p1"]}}— a map of entries at the top level — was accepted as an entry collection and grantedp1.{"identifiers": {"alias": "p1"}}— a map-valued field — matched throughin_array().That contradicted the documented "non-list input contributes nothing" contract and could turn a malformed authorization claim into an access grant.
Fix: require list shape with
array_is_list()at both levels — the entry collection and each field. Regression cases cover an associative entry collection and an associative field; both now grant nothing, while a valid list-shaped claim still does.P2 (docs): document the new helper
Added an RFC 9396 section to
docs/oauth2.mdcovering usage, the list-shape guarantee, and the opt-in wildcard semantics, per the package's guidance to document new OAuth2 helpers there rather than indocs/jwt.md.Tests
bin/monorepo test authpasses (260).bin/monorepo check auth(pint, phpstan, rector) andbin/monorepo validateare clean.