Skip to content

Stop crashing when a token or registration response is a JSON array - #988

Open
w-goog wants to merge 4 commits into
masterfrom
codegen/987-json-array-guard
Open

w-goog wants to merge 4 commits into
masterfrom
codegen/987-json-array-guard

Conversation

@w-goog

@w-goog w-goog commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Fixes #987.

OIDAuthorizationService subscripts the parsed token and registration bodies without checking that they're dictionaries, so, a proxy answering with [] borks the app down with NSInvalidArgumentException. This has been there since the first release (#863 was the same crash)!

This PR gives the callback an OIDErrorCodeServerError for a 4xx and OIDErrorCodeJSONDeserializationError for a 2xx whose body isn't an object. The new tests exercise both endpoints through a stub NSURLProtocol.

Behaviour change: a 200 with [] used to yield an empty OIDTokenResponse. It's an error now :)

@w-goog
w-goog requested a review from camden-king October 30, 2026 22:45

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash (objectForKeyedSubscript: on NSArray) when the token endpoint returns a JSON array body

2 participants