GeezerVison is showing github.com — fleet-proxy(broker): a present-but-non-string token_file is silently discarded — the request is authenticated with the default token instead of the named credential, or refused · Issue #6518 · developing-today/code
fleet-proxy(broker): a present-but-non-string token_file is silently discarded — the request is authenticated with the default token instead of the named credential, or refused #6518DescriptionSummary
The fleet session broker's request-frame parser silently discards a present-but-non-string token_file — a number, boolean, object, or array collapses to None, and the broker then authenticates the request with the default token file instead of the credential the caller named, or instead of refusing the frame. The request is delivered and answered (200) with a credential substitution that neither the caller nor the service can see. A present-but-invalid token_file is not an absent one; only an absent one should take the default. Sibling of #6516 (the same collapse for the frame port, in the same function).
Evidence
pkgs/fleet/crates/fleet-proxy/src/serve.rs (at 6046e1d7bc):
parse_request (:610; the token_file chain at :640-643): frame.get("token_file").and_then(|v| v.as_str()).map(|s| s.to_string()) — every non-string shape (123, true, {"x":1}, ["x"]) fails as_str() and collapses to None, indistinguishable from the field being absent.
Broker::do_request (:507; the fallback at :512-514): None becomes self.config.default_token_file() ($HOME/tools/laptop-agent-token, fleet-config default_token_file()), whose contents are read, trimmed, and sent to the target service as the X-Agent-Token header (pkgs/fleet/crates/fleet-proxy/src/http.rs:195).
- Contrast in the same call path: a
token_file that is a string but names a missing file is a loud 502 — broker: cannot read token file /nonexistent/token: No such file or directory. The invalid shapes are not even consistent: a bad string errors, a non-string is silently replaced with a different credential.
- Contrast in the same function:
method and path are strictly validated and refused when malformed (fleet-proxy(broker): method/path CRLF injection — one frame smuggles a second request onto the pooled tunnel #5750). The module comment describes the leniency as mirroring the Python's defaults — the Python takes its default only when the key is absent.
Verified (probe, laptop, real crates)
Probe ~/git/fleet/probe-broker-tokenfile (path-deps on the real fleet-proxy/fleet-config/fleet-proxy-proto crates at 6046e1d7bc): a stub HTTP service on 127.0.0.1:4799 that echoes the X-Agent-Token header it received; the real broker (serve::run, direct mode, temp socket) in front of it; HOME pointed at the probe dir so the broker's default token file is the probe's own (default-token); a custom token file holding custom-token:
token_file: <custom path> → 200, service received custom-token (control)
token_file absent → 200, service received default-token (control — the documented default)
token_file: 123 → 200, service received default-token (bug — the named credential was silently replaced)
token_file: true → 200, service received default-token (bug)
token_file: {"x":1} → 200, service received default-token (bug)
token_file: ["x"] → 200, service received default-token (bug)
token_file: "/nonexistent/token" → 502 broker: cannot read token file /nonexistent/token: No such file or directory (os error 2) (the inconsistent contrast)
token_file: null → 200, service received default-token (JSON null; arguably absent-equivalent — triage's call, listed for completeness)
Why it matters
The broker is the fleet's local RPC router, and token_file is how a frame names the credential its request should carry. Silently substituting the default credential means a request can succeed against a service under an identity the caller never named — or fail confusingly elsewhere — with nothing in the response or logs saying a substitution happened. Client bugs that serialize the field wrong (a config object, a boolean flag, a numeric id) become silent credential swaps instead of loud errors at the frame boundary, exactly where #5750 established strict validation and #6516 is establishing it for port.
Acceptance criteria
parse_request distinguishes an absent token_file (→ the default token file) from a present-but-non-string one, and the broker answers the latter with the standard {status: 502, body: {error: "broker: …"}} frame naming the bad shape — no connection is opened and no token is read.
- The rule for
token_file: null is chosen explicitly (absent-equivalent or refused) and pinned by a test.
- Tests in
fleet-proxy pin: a string token_file sends that file's token, an absent one sends the default token, and each non-string shape (number, boolean, object, array) is refused without touching any service.
- Existing fleet-proxy tests keep passing (
cargo test -p fleet-proxy on the laptop or CI).
Scope notes
Activitydeveloping-today commented on Nov 6, 2026 added task/triageQueue packet kind: verify, reproduce, and route this item app/fleetpkgs/fleet multicall binary + platform crates kind/bugSomething isn't working (prefixed form of the classic bug label) on Nov 6, 2026dezren39 commented on Nov 6, 2026 🤖 Agent note · filed
- Agent: new-issue-creator (new-issue-creator-code-b)
- Session / ID: cron job new-issue-creator-code-b, run 2026-11-06T13:34Z
- Found via: filed this run
- Task: Filed after verifying with a laptop probe (~/git/fleet/probe-broker-tokenfile, real fleet-proxy broker + header-echoing stub service) that a present-but-non-string token_file (123 / true / object / array) is silently discarded and the request is served with the default token, while a string naming a missing file correctly 502s. Sibling of fleet-proxy(broker): a present-but-invalid request-frame port silently reroutes to the default 4799 service — 70000, -1, 4801.5 and "4801" are all served by laptop-agent instead of refused #6516 (port field, same function).
- Expectation: effort s — triage confirms the frame-boundary refusal shape (and the null rule), then a small-fix refuses non-string token_file in parse_request with tests pinning string/absent/non-string shapes.
- Links: probe ~/git/fleet/probe-broker-tokenfile (laptop); body file hidden_files/issue-fleet-proxy-broker-tokenfile-fallback.md
dezren39 commented on Nov 6, 2026 🤖 Agent note · handed off
dezren39 commented on Nov 8, 2026 dezren39 commented on Nov 8, 2026 dezren39 commented on Nov 8, 2026 🤖 Agent note · parked — CI pending
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|