Skip to content

fix(fleet): reject header-unsafe credentials at token resolution - #17025

Merged
developing-today-fleet[bot] merged 1 commit into
mainfrom
felix/16826-credential-shape
Nov 30, 2026
Merged

developing-today-fleet[bot] merged 1 commit into
mainfrom
felix/16826-credential-shape

Conversation

@developing-today-fleet

@developing-today-fleet developing-today-fleet Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Lane 0640-FL, for #16826 (0640-ET's defect record, comment 7264247126). Does not close #16826 — its tiers 2–4 timing remainder (laptop-gated) and the seat binary refresh stay open there.

Change

FleetTokenProvider::token_for now runs every resolved token through ensure_header_safe_token: non-empty, all bytes ASCII graphic (0x21–0x7E). A source resolving to anything else — a hosts.yml body where a token was expected, an error page, the wrong secret — returns a value-free Err, which every consumer already treats as a failed source:

  • the fleet gh rotation walk (run_with_provider_capturing) skips to the next source;
  • fleet git-credential's select_credential skips it the same way;
  • fleet gh tiers reports the source DOWN.

Before this, the value went straight to gh as GH_TOKEN and Go's net/http refused it at request construction (invalid header field value for "Authorization") — outside every failover classification — so no other source was tried. That is the failure that blocked this seat's write route for ~10 minutes on 2026-11-29 (ET's record). The 2026-11-22 instance was fixed by parsing the personal secret; this gate covers every resolution path, including tier-3's finished tokens and App mints, which were previously trusted raw.

Tests

  • header_safe_token_shape — oracle: the header shapes net/http accepts; GitHub's real token families pass, empty/multi-line/spaced/control/non-ASCII payloads are rejected.
  • token_for_rejects_a_misshaped_mint — oracle: ET's defect record; a daemon minting a hosts.yml-shaped body makes token_for error (value-free) instead of returning the payload.

Remote gate: fleet-command run 46325318508 (cargo test -p fleet --bin fleet gh::) — verdict to be posted here when it finalizes.

{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-29T23:51:54Z",
    "session_id": null,
    "lane": null,
    "host": "htch-runtime",
    "worktree": "/home/hatch",
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": {
      "kind": "worktree",
      "id": "/home/hatch",
      "repo": "developing-today/code",
      "branch": "main",
      "sha": "010b47d1c4cecdcd1b7d6ea260b7c9b0a61fb89e"
    },
    "auth_subject": "felix",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

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

A rotation source resolving to a value that cannot travel in an
Authorization header (a hosts.yml body where a token was expected,
an error page, the wrong secret) now fails in token_for, so the
rotation walk skips the source and tries the next — instead of
the value reaching gh as GH_TOKEN and dying in net/http at
request construction, outside every failover classification
(code#16826, 0640-ET's 2026-11-29 defect record).

Shape gate: non-empty, all bytes ASCII graphic. Covers every
resolution path — daemon and in-process mints, tier-3 finished
tokens, and the parsed personal token. Error is value-free.
@coderabbitai

coderabbitai Bot commented Nov 29, 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: 873c4b4b-ea6a-4592-b3f5-8bcc209a794a

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

@developing-today-fleet

Copy link
Copy Markdown
Contributor Author

Gate run 46325318508 is VOID for the test half — do not merge on its 'success' conclusion. Felix lane 0640-FL read the finalized job log firsthand: checkout was correct (felix/16826-credential-shape @ 9516611), but the build died in openssl-sys — 'Could not find openssl via pkg-config: The pkg-config command could not be found' — because the dispatch's nix shell carried the openssl package without pkg-config or the OPENSSL_* env. Zero tests executed; the trailing marker printed anyway because the test leg was guarded. The run's green conclusion is the conclusion-alone trap, not evidence. Corrected re-dispatch with the realised-dev-output OpenSSL recipe + pkg-config: run 46326321302. Verdict lands when it finalizes.

@developing-today-fleet

Copy link
Copy Markdown
Contributor Author

Gate run 46326321302 also VOID (zero tests) — Felix lane 0640-FL read its uploaded fleet-command-log artifact firsthand: the dispatch's double-quoted inner bash -c string was expanded by an intermediate shell layer, so DEV= executed during word expansion and the later $DEV reference died with 'DEV: unbound variable' (command exit code 1, 15 s). Not a code signal. Run 3 re-dispatched with the assignments at the target command's top level and no nested double quotes: run 46327263255.

@developing-today-fleet

Copy link
Copy Markdown
Contributor Author

Gate GREEN — merge-ready. Felix lane 0640-FL read the finalized job log of run 46327263255 firsthand: checkout felix/16826-credential-shape @ 9516611; test result: ok. 55 passed; 0 failed for cargo test -p fleet --bin fleet gh::, with both new oracle tests named ok — gh::tests::header_safe_token_shape and gh::tests::token_for_rejects_a_misshaped_mint. The command carried no failure-swallowing guard this time (marker FL-GATE3-DONE-16826 printed only on cargo's own exit 0). Runs 46325318508 + 46326321302 stand VOID as recorded above (dispatch-shell defects, zero tests). Felix: this PR is ready to merge on your call; it does not close #16826 (tiers 2–4 timings + seat binary refresh remain there).

@developing-today-fleet
developing-today-fleet Bot merged commit 9007c55 into main Nov 30, 2026
2 checks passed
@developing-today-fleet
developing-today-fleet Bot deleted the felix/16826-credential-shape branch November 30, 2026 00:19
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.

gh credential-cache daemon resilience + Cloudflare tier + fleet gh fallback chain

0 participants