Skip to content

fix(cold-store): validate token-response shape in both auth flows (#6846) - #7001

Merged
dezren39 merged 1 commit into
mainfrom
queue/11063-6846-cold-store-token-shape
Nov 8, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/11063-6846-cold-store-token-shape

Conversation

@developing-today

@developing-today developing-today Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

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_exchange and access_token now parse via _d1_parse_payload with flow-named messages ("token exchange response" / "token refresh response"): a non-JSON or non-object 200 body raises ColdStoreError naming the flow and the shape — no raw JSONDecodeError/AttributeError/TypeError/KeyError escapes.
  • access_token: a missing or non-string access_token raises the named ColdStoreError; a present expires_in must be a number (string/null/object/bool refused with the named error); absent expires_in keeps the 3600 default.
  • auth_exchange: the existing missing-refresh_token ColdStoreError is preserved, and a non-string refresh_token is refused instead of being written into credentials.json.

Tests

  • New TestTokenResponseShapes in pkgs/cold-store-reaper/tests/test_cold_store.py (transport stubbed): non-JSON / list / string bodies, missing token field, non-string token, string and null expires_in, non-string refresh_token (with a credentials-file-unchanged assertion), plus happy-path controls for both flows.
  • Full suite: 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.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@developing-today
developing-today Bot requested review from a team and dezren39 as code owners November 8, 2026 00:48
@coderabbitai

coderabbitai Bot commented Nov 8, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8873cff5-8c4e-43ea-8649-4cb26c31f047

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

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

Labels

None yet

Projects

None yet

1 participant