GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — cold-store-reaper(worker): Google token response is shape-trusted and cached — a wrong-shape 200 poisons the DO token cache (Bearer undefined) for up to an hour · Issue #6989 · developing-today/code

cold-store-reaper(worker): Google token response is shape-trusted and cached — a wrong-shape 200 poisons the DO token cache (Bearer undefined) for up to an hour #6989

New issue
Copy link
New issue
Copy link
Closed
Closed
cold-store-reaper(worker): Google token response is shape-trusted and cached — a wrong-shape 200 poisons the DO token cache (Bearer undefined) for up to an hour#6989
Copy link
Labels
app/cold-store-reaperPackage/app: cold-store-reaper (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Description

@dezren39
dezren39
opened on Nov 8, 2026
Issue body actions

Problem

pkgs/cold-store-reaper/worker/src/index.js — BundleFlight.accessToken() (the
rehydrator Worker's Google token exchange) trusts the token endpoint's 200
response body completely:

const payload = await resp.json();
const entry = {
  token: payload.access_token,
  expires_at_ms: Date.now() + (payload.expires_in ?? 3600) * 1000,
};
await this.state.storage.put("google_token", entry);
return entry.token;

There is no validation that payload is an object, that access_token is a
non-empty string, or that expires_in is a usable number — and the
unvalidated result is written to Durable Object storage as the cached
token
. The cached entry is then trusted by the early return at the top of
accessToken() (cached.expires_at_ms > Date.now() + 60_000), so one
wrong-shape 200 poisons every later rehydration on that bundle DO until the
bogus expiry passes.

Verified (laptop, main @7c8fb3e1ee, probe ~/git/fleet/probe-reaper-token)

Real src/index.js + src/decoder.js copied verbatim (md5-checked against
the laptop primary), stub DO storage + stub token endpoint, BundleFlight
driven directly (the shipped tests' own harness shape):

  • Control {access_token:"good", expires_in:3600} → returns "good",
    second call served from cache, token endpoint called once. Correct.
  • {} (200, no access_token) → accessToken() returns undefined and
    caches it (google_token entry with a ~1h future expires_at_ms);
    the second call returns undefined again with the token endpoint still
    called only once. Every rehydrate() in that window sends
    Authorization: Bearer undefined to Drive and fails 502 — even after the
    token endpoint recovers.
  • {access_token:123, expires_in:3600} → returns the number 123 and
    caches it the same way.
  • JSON null body → raw TypeError: Cannot read properties of null (reading 'access_token').
  • Non-JSON 200 body → raw SyntaxError out of resp.json().

In BundleFlight.fetch the raw errors surface as a 502 with the raw
runtime message (rehydration failed: Cannot read properties of null…),
not the module's HttpError vocabulary (google token exchange failed (HTTP …) is the only shaped failure, and it covers only non-200 status).

Why it matters

The rehydrator is the read door for cold-store restores. A single
malformed-but-200 token response (proxy/error-page JSON, a Google-side
shape change, a partial deploy) currently converts a transient exchange
hiccup into up to an hour of hard 502s per bundle DO, with no re-exchange
attempt and an error message that does not say the token response was the
problem. The Python sibling got exactly this boundary shaped in #6846
(cold_store.py token endpoint); the Worker door was not covered by it.

Acceptance criteria

  • accessToken() validates the parsed body before caching: it must be a
    plain object with a non-empty string access_token; anything else
    (null, scalar, array, missing/wrong-typed access_token) throws
    HttpError(502, …) naming the token exchange as the failure, and
    nothing is written to the google_token storage entry.
  • A non-JSON 200 body produces the same shaped 502, not a raw
    SyntaxError.
  • expires_in is used only when it is a finite positive number;
    otherwise the existing 3600s default applies (no NaN/negative expiry
    is ever cached).
  • A cached entry whose token is not a non-empty string is treated as
    absent (re-exchange), so an already-poisoned entry self-heals.
  • Regression tests in the package's node test style (stub token endpoint,
    as in test/range-ignored.test.mjs) cover: control cached once;
    {}/numeric-token/null/non-JSON responses → shaped 502, no cache
    write, and a following call re-exchanges and succeeds.
  • Existing worker tests still pass (npm test in
    pkgs/cold-store-reaper/worker).

Dedup note: #6846 covers the Python cold_store.py access_token /
auth_exchange parsing only; #6845/#6855 are the Python state/Drive
surfaces; #6590/#6182 are this Worker's decompression/range bounds. No
open or closed issue covers the Worker's JS token exchange.

Activity

Next
  1. developing-today commented on Nov 8, 2026

    @developing-today
    developing-todayBot
    on Nov 8, 2026 – with developing.today
    Contributor
    More actions

    CODE-2220

  2. dezren39
    added
    queue/queuedHas a queued queue task
    source/creatorFiled by the new-issue-creator job
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    status/needs-triageNot yet triaged; needs a first look
    priority/normalOrdinary priority (the default)
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    app/cold-store-reaperPackage/app: cold-store-reaper (pkgs/ or apps/ in this repo)
    on Nov 8, 2026
  3. dezren39 commented on Nov 8, 2026

    @dezren39
    dezren39
    on Nov 8, 2026
    MemberAuthor
    More actions

    🤖 Agent note · filed

    • Agent: new-issue-creator job (new-issue-creator-code-a)
    • Session / ID: cron new-issue-creator-code-a, run 2026-11-07 18:05 CST
    • Found via: filed this run
    • Task: Validate the Google token-exchange response in the cold-store-reaper Worker's BundleFlight.accessToken() before caching it, so a wrong-shape 200 cannot poison the DO token cache.
    • Expectation: effort/s — done when accessToken() rejects non-object / missing-or-non-string access_token / non-JSON bodies with a shaped HttpError 502 and writes nothing to the cache, expires_in is used only when finite and positive, a poisoned cached entry self-heals, and regression tests in the package's node test style cover the shapes while the existing worker tests still pass.
    • Links: verified this run on laptop main @7c8fb3e1ee, probe ~/git/fleet/probe-reaper-token (real src/index.js + src/decoder.js, md5-checked; control cached-once OK, {} → undefined token cached ~1h, numeric token cached, null body raw TypeError, non-JSON raw SyntaxError)
  4. dezren39 commented on Nov 9, 2026

    @dezren39
    dezren39
    on Nov 9, 2026
    MemberAuthor
    More actions

    🤖 Agent note · handed off

    • Agent: repo queue worker, lane code-h (repo-worker-code)
    • Session / ID: cron repo-queue-worker-shift-h run 2026-11-09; task 11380
    • Found via: claimed task 11380 this shift; execution-lane assignment row 3659 returned opencode
    • Task: task 11380 for issue cold-store-reaper(worker): Google token response is shape-trusted and cached — a wrong-shape 200 poisons the DO token cache (Bearer undefined) for up to an hour #6989 (small_fix); attempts 2/4 on this claim. Fresh check: issue cold-store-reaper(worker): Google token response is shape-trusted and cached — a wrong-shape 200 poisons the DO token cache (Bearer undefined) for up to an hour #6989 is OPEN, no hard-stop labels (held / user/owned / do-not-merge / do-not-auto-edit). Handed off to the opencode claimant; this lane does not work it directly.
    • Expectation: claimant session drives task 11380 to a terminal state.
    • Links: task 11380 · issue cold-store-reaper(worker): Google token response is shape-trusted and cached — a wrong-shape 200 poisons the DO token cache (Bearer undefined) for up to an hour #6989
  5. dezren39
    added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/needs-triageNot yet triaged; needs a first look
    queue/queuedHas a queued queue task
    on Nov 10, 2026
  6. 18 remaining items

  7. dezren39
    added a commit that references this issue on Nov 11, 2026

    test(cold-store-reaper): property coverage for token-response validat…

    25b3d3c
  8. dezren39 commented on Nov 11, 2026

    @dezren39
    dezren39
    on Nov 11, 2026
    MemberAuthor
    More actions

    🤖 Agent note · parked (review wait)

    • Agent: repo queue worker, lane any-a
    • Task: task 11380 (queue task for issue cold-store-reaper(worker): Google token response is shape-trusted and cached — a wrong-shape 200 poisons the DO token cache (Bearer undefined) for up to an hour #6989)

    Both Codex P1s on PR #8702 are fixed in head 25b3d3c and dispositioned on their threads:

    • 4539080444 (property coverage): new test/token-response-properties.test.mjs — 64 seeded generated cases (cache states × response shapes) with named oracles (no-write-on-reject, accept-returns-supplied with oracle expiry, cache discipline incl. the 60s margin), wired into npm test. Reply 4539623579.
    • 4539080455 (stale deployment bundle): dist/worker.js rebuilt via the package's own npm run build and committed; the artifact now contains the validated accessToken. Reply 4539623887.

    Verified on the laptop at the new head: npm test green, 57 ok checks, no failures (56 prior + the property aggregate). Parked for the Codex re-review of 25b3d3c: if clean, merge PR #8702 and complete task 11380 as fixed_merged.

  9. dezren39
    added
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 11, 2026
  10. dezren39 commented on Nov 11, 2026

    @dezren39
    dezren39
    on Nov 11, 2026
    MemberAuthor
    More actions

    Agent note - picked up (resume)

    • Agent: queue worker (repo-worker-code), lane code-b
    • Task: task 11380 (small_fix) for issue cold-store-reaper(worker): Google token response is shape-trusted and cached — a wrong-shape 200 poisons the DO token cache (Bearer undefined) for up to an hour #6989; PR fix(cold-store-reaper): validate the Google token response before caching it (#6989) #8702
    • Found via: queue claim (code-only filter); lane assignment direct.
    • Fresh check: issue cold-store-reaper(worker): Google token response is shape-trusted and cached — a wrong-shape 200 poisons the DO token cache (Bearer undefined) for up to an hour #6989 OPEN, no hard-stop labels (held / user/owned / do-not-merge / do-not-auto-edit absent), no status/needs-triage. PR fix(cold-store-reaper): validate the Google token response before caching it (#6989) #8702 OPEN at head 25b3d3c, the head the previous park fixed both Codex P1s on.
    • Codex: the re-review summary on PR fix(cold-store-reaper): validate the Google token response before caching it (#6989) #8702 for commit 25b3d3c reports code review completed with has_any_findings=false and has_unresolved_findings=false - the park resume condition is met.
    • Next: re-run npm test in pkgs/cold-store-reaper/worker at PR head on the laptop, then squash-merge PR fix(cold-store-reaper): validate the Google token response before caching it (#6989) #8702 and complete task 11380 as fixed_merged.
    • Links: issue cold-store-reaper(worker): Google token response is shape-trusted and cached — a wrong-shape 200 poisons the DO token cache (Bearer undefined) for up to an hour #6989 cold-store-reaper(worker): Google token response is shape-trusted and cached — a wrong-shape 200 poisons the DO token cache (Bearer undefined) for up to an hour #6989 ; PR fix(cold-store-reaper): validate the Google token response before caching it (#6989) #8702 fix(cold-store-reaper): validate the Google token response before caching it (#6989) #8702
  11. dezren39
    added a commit that references this issue on Nov 11, 2026

    fix(cold-store-reaper): validate the Google token response before cac…

    50d73cc
  12. developing-today
    added
    status:done
    and removed
    status:in-review
    on Nov 11, 2026
  13. developing-today
    closed this as completedon Nov 11, 2026
  14. dezren39
    removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 11, 2026
  15. dezren39 commented on Nov 11, 2026

    @dezren39
    dezren39
    on Nov 11, 2026
    MemberAuthor
    More actions

    Agent note - done (fixed_merged)

    • Agent: queue worker (repo-worker-code), lane code-b
    • Task: task 11380 (small_fix) for issue cold-store-reaper(worker): Google token response is shape-trusted and cached — a wrong-shape 200 poisons the DO token cache (Bearer undefined) for up to an hour #6989; PR fix(cold-store-reaper): validate the Google token response before caching it (#6989) #8702 squash-merged, merge commit 50d73cc; issue cold-store-reaper(worker): Google token response is shape-trusted and cached — a wrong-shape 200 poisons the DO token cache (Bearer undefined) for up to an hour #6989 CLOSED.
    • Resume taken: the previous park fixed both Codex P1s in head 25b3d3c (property coverage + dist bundle rebuild, replies 4539623579 / 4539623887). The Codex re-review summary for that head reports completed with no findings and no unresolved findings; both review threads are now resolved.
    • Re-verified fresh this shift on the laptop at head 25b3d3c: npm test in pkgs/cold-store-reaper/worker - exit 0, 57 ok checks, all token-response and property checks passed. PR diff is exactly the five in-scope files (src/index.js, dist/worker.js, package.json, both token-response test files).
    • CI: PR check runs were CANCELLED in the repo-wide runner stall (not failures); the merge rests on the local targeted verification above plus the clean Codex re-review, per standing merge authority.
    • Labels: in-flight labels (status/in-progress, queue/claimed, work/assigned) removed at completion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/cold-store-reaperPackage/app: cold-store-reaper (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.