Repository navigation
fix(cold-store): validate token-response shape in both auth flows (#6846) - #7001
Merged
Merged
Conversation
developing-today
Bot
requested review from
a team and
dezren39
as code owners
November 8, 2026 00:48
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
4 tasks
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.
Summary
Validate the OAuth token endpoint's HTTP-200 response shape in both cold-store auth flows (issue #6846), mirroring the D1 hardening from #2618:
auth_exchangeandaccess_tokennow parse via_d1_parse_payloadwith flow-named messages ("token exchange response" / "token refresh response"): a non-JSON or non-object 200 body raisesColdStoreErrornaming the flow and the shape — no rawJSONDecodeError/AttributeError/TypeError/KeyErrorescapes.access_token: a missing or non-stringaccess_tokenraises the namedColdStoreError; a presentexpires_inmust be a number (string/null/object/bool refused with the named error); absentexpires_inkeeps the 3600 default.auth_exchange: the existing missing-refresh_tokenColdStoreErroris preserved, and a non-stringrefresh_tokenis refused instead of being written intocredentials.json.Tests
TestTokenResponseShapesinpkgs/cold-store-reaper/tests/test_cold_store.py(transport stubbed): non-JSON / list / string bodies, missing token field, non-string token, string and nullexpires_in, non-stringrefresh_token(with a credentials-file-unchanged assertion), plus happy-path controls for both flows.python3 -m unittest discover -s pkgs/cold-store-reaper/tests— 146 tests, OK (1 skipped).Merge Danger
Door: Two-way
Blast Radius: Low — two parse sites in one file, plus tests. Behaviour for well-shaped token responses is unchanged.
Fixes #6846
🤖 Queue worker lane code-o, task 11063.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.