#6795 · Updater requests discard configured proxy headers
Verdict: REPRODUCED · Root-cause confidence: high. Scope: the real self-updater HTTP code, automatic attempt and forced retry. A full enrolled-daemon protocol-bump/reconnect lifecycle was not run.
1. TL;DR
The daemon's updater does not send its configured server headers when checking the server version or downloading its package. A real local HTTP fixture that requires one synthetic header returns 401, and the updater returns failed, even though an authenticated control request succeeds. A forced retry repeats the failure. The same updater succeeds against the fixture without the header gate, isolating the defect from artifact integrity and installation setup. The application also omits these headers when constructing the updater, so both configuration plumbing and request construction need correction.
2. Claims vs findings
| Claim | Finding | Evidence |
|---|---|---|
| The version request omits configured headers. | Verified | Real HTTP listener sees no header on either attempt; both return 401. |
| The package request also omits them. | Verified | A separately gated package endpoint returns 401 after a successful version response. |
| A requested retry fails the same way. | Verified at updater boundary | Both cases call the normal method and then handleProtocolMismatch({ force: true }); both return failed. |
| Normal daemon traffic has configured headers. | Verified statically | Server-client header builder spreads serverHeaders; app passes them to its server session. |
| The enrolled host remains disconnected after a real server upgrade. | Not exercised end to end | Only the update transaction is reproduced. Static connection handling requests restart only for an updated result. |
| Manual reinstall is necessary in every deployment. | Not established | No real proxy deployment or reinstall was attempted. The report establishes the failed automatic path, not the exclusivity of any workaround. |
| Earlier related work was closed rather than merged. | Verified metadata | GitHub metadata shows related PRs #6665 and #6796 are closed and unmerged; no open PR linking #6795 was found at investigation time. |
3. Environment
- Linux 4.19.0-gvisor x86_64; Node v22.19.0; pnpm 9.15.0; Vitest 4.1.1.
- Public repository get-bb/bb, trusted origin/main at the full commit above. The legacy origin URL resolves to that same GitHub repository.
- No provider session, production bb instance, desktop app, proxy account, or real credential used.
- Each case allocates a new OS-selected loopback TCP port and an isolated mkdtemp directory under the system temporary directory; finally closes sockets and removes that directory.
- The installer callback records validated downloaded bytes instead of invoking npm. This deliberately tests HTTP request behavior without changing packaging or a local installation.
4. Minimal reproduction
- Clone the trusted repository and select the recorded main commit.
- Copy the inline original test to
apps/host-daemon/src/slopcop-6795-repro.test.ts. - Run from the repository root:
git clone https://github.com/get-bb/bb.git bb-6795 cd bb-6795 git checkout --detach 916d684ac23d0b0de82c09cfc7553a50287d2188 pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build --filter=@bb/host-daemon pnpm exec turbo run test --force --filter=@bb/host-daemon -- src/slopcop-6795-repro.test.ts
Expected: the version-gated and package-gated cases should complete both automatic and forced attempts with ["updated","updated"], just like the ungated control.
Actual: exit 1; 2 failed, 1 passed. Both gated cases return ["failed","failed"]; the server records the configured header absent. The preliminary request made with the same synthetic header returns 200 in each case.
Version check failed: 401 Unauthorized Package download failed: 401 Unauthorized Daemon self-update failed; keeping the current daemon running and retrying normally. AssertionError: expected [ 'failed', 'failed' ] to deeply equal [ 'updated', 'updated' ] Tests 2 failed | 1 passed (3)
The version gate blocks before a package request can occur. The package-only gate intentionally permits the version endpoint, so the second missing-header defect is independently observable.
Complete original reproduction test
import { createHash } from "node:crypto";
import { once } from "node:events";
import { mkdtemp, readFile, rm } from "node:fs/promises";
import { createServer } from "node:http";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { HOST_DAEMON_PROTOCOL_VERSION } from "@bb/host-daemon-contract";
import { expect, it } from "vitest";
import type { HostDaemonLogger } from "./logger.js";
import { createProtocolSelfUpdater } from "./protocol-self-update.js";
it.each(["version", "tarball", "none"])(
"completes self-update with configured headers when gate=%s",
async (gate) => {
const dataDir = await mkdtemp(join(tmpdir(), "bb-6795-repro-"));
const headerName = "x-bb-repro-key";
const headerValue = "fixture-only";
const tarball = Buffer.from("local fixture artifact");
const digest = createHash("sha256").update(tarball).digest("hex");
const requests: { path: string; hasHeader: boolean; status: number }[] = [];
const errors: string[] = [];
const installed: string[] = [];
const logger: HostDaemonLogger = {
debug() {},
info() {},
warn() {},
error(fields, message) {
if (fields.err instanceof Error) errors.push(fields.err.message);
errors.push(message);
},
};
const server = createServer((request, response) => {
const path = request.url ?? "";
const hasHeader = request.headers[headerName] === headerValue;
const gated =
(gate === "version" && path === "/install/version") ||
(gate === "tarball" && path === "/install/bb-app.tgz");
const status = gated && !hasHeader ? 401 : 200;
requests.push({ path, hasHeader, status });
response.statusCode = status;
if (status === 401) {
response.end("fixture gate requires configured header");
} else if (path === "/install/version") {
response.setHeader("content-type", "application/json");
response.end(
JSON.stringify({
version: "9.0.0-repro",
protocolVersion: HOST_DAEMON_PROTOCOL_VERSION + 1,
}),
);
} else {
response.setHeader("content-type", "application/gzip");
response.setHeader("content-length", String(tarball.byteLength));
response.setHeader("x-bb-artifact-sha256", digest);
response.end(tarball);
}
});
server.listen(0, "127.0.0.1");
await once(server, "listening");
try {
const address = server.address();
if (address === null || typeof address === "string") {
throw new Error("Expected local TCP listener");
}
const serverUrl = `http://127.0.0.1:${address.port}`;
const probePath =
gate === "tarball" ? "/install/bb-app.tgz" : "/install/version";
const probe = await fetch(new URL(probePath, serverUrl), {
headers: { [headerName]: headerValue },
});
await probe.arrayBuffer();
expect(probe.status).toBe(200);
requests.length = 0;
const options = {
dataDir,
enabled: true,
logger,
serverUrl,
serverHeaders: { [headerName]: headerValue },
installTarball: async (path: string) => {
installed.push(await readFile(path, "utf8"));
},
};
const updater = createProtocolSelfUpdater(options);
const outcomes = [
await updater.handleProtocolMismatch(),
await updater.handleProtocolMismatch({ force: true }),
];
console.log(
JSON.stringify({ gate, outcomes, requests, errors, installed }),
);
expect(outcomes).toEqual(["updated", "updated"]);
expect(installed).toEqual([tarball.toString(), tarball.toString()]);
} finally {
server.closeAllConnections();
await new Promise<void>((resolve, reject) => {
server.close((error) => (error ? reject(error) : resolve()));
});
await rm(dataDir, { force: true, recursive: true });
}
},
);
5. Root cause
There are two losses of configuration. The app constructor supplies serverHeaders to the session but not to the nested updater. The updater options have no serverHeaders field, so even supplying an object containing the field directly cannot affect its requests.
The version fetch supplies only a method:
const versionResponse = await fetchFn(versionUrl, { method: "GET" });
The package fetch supplies no headers on the first download, and only a cache validator when an installed digest exists:
headers: {
"if-none-match": `"sha256-${installedDigest}"`,
}
In contrast, the normal client header builder merges the configured headers. For the same origin, ordinary daemon API calls and updater downloads therefore authenticate differently.
The updater catches non-success responses and returns failed. The connection handler passes its retry flag into the updater and requests restart only when the result is updated. This explains why retry does not fix the missing-header failure; it does not prove a complete live enrollment lifecycle.
6. Proposed fix and automation safety
Carry the existing typed server-header configuration from the app into the updater, then use it on both install requests while preserving the digest cache validator. Keep the existing secure-transport and integrity checks. Add a real request-boundary regression for automatic and forced attempts; include cache-header coexistence and ordinary no-header behavior.
No automated fix PR: sending previously omitted proxy credentials changes authentication behavior on installer HTTP requests. That fails this rule's explicit no-authentication/security-boundary-change condition, even though the mechanical patch is small. Maintainer review should settle credential forwarding and redirect/destination handling. No claim of an exploitable vulnerability is made.
7. Static PR review
PR #6796 — closed, unmerged
Read GitHub metadata and diff only, after authoring and running the original reproduction. Its production diff adds header plumbing in the app and updater and merges those headers with the package cache validator. This addresses both missing configuration paths in principle. Its test records injected fetch options for normal and forced attempts. No PR branch, script, patch, or test was checked out or executed.
Review limit: static agreement with the root cause is not approval of credential-forwarding semantics or a verified passing implementation. The only executed code is trusted main plus the attached original test. No additional line-level defect was established from this limited static review.
8. Related contributions
PR #6665 is a prior related contribution named in the issue; GitHub metadata confirms closed and unmerged. Its behavior was not executed or independently reviewed. No separate duplicate issue was established by the targeted search.
9. Verification
The same agent repeated the test in a second, initially clean detached Git worktree at the identical full trusted commit. A frozen dependency install and focused host-daemon build both succeeded. Only the original reproduction file was then copied into that worktree; no production files changed. The second test run used --force to bypass Turbo's task cache and allocated fresh local listeners and temporary directories.
pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build --filter=@bb/host-daemon pnpm exec turbo run test --force --filter=@bb/host-daemon -- src/slopcop-6795-repro.test.ts Second result: exit 1; 2 failed, 1 passed. Version gate: missing header, 401, failed on both attempts. Package gate: version 200, package missing header and 401, failed on both attempts. Ungated control: passed.
The second clean run supports the final report without correction. This is a repeat verification by the same agent, not an independent investigation. The existing trusted updater suite also passes unchanged: 21 tests. That confirms existing coverage does not catch this configuration-dependent failure.
10. Appendix and evidence
The full reproduction source is inline above. Raw transcripts and the source file are retained locally, not committed, in accordance with the reports repository's publication policy. Exact request observations from both runs follow. The token in the local HTTP fixture is a public synthetic test value, never an enrollment credential. Nonvisual bug: no screenshot required.
First run
{"gate":"version","outcomes":["failed","failed"],"requests":[{"path":"/install/version","hasHeader":false,"status":401},{"path":"/install/version","hasHeader":false,"status":401}],"errors":["Version check failed: 401 Unauthorized","Daemon self-update failed; keeping the current daemon running and retrying normally.","Version check failed: 401 Unauthorized","Daemon self-update failed; keeping the current daemon running and retrying normally."],"installed":[]}
{"gate":"tarball","outcomes":["failed","failed"],"requests":[{"path":"/install/version","hasHeader":false,"status":200},{"path":"/install/bb-app.tgz","hasHeader":false,"status":401},{"path":"/install/version","hasHeader":false,"status":200},{"path":"/install/bb-app.tgz","hasHeader":false,"status":401}],"errors":["Package download failed: 401 Unauthorized","Daemon self-update failed; keeping the current daemon running and retrying normally.","Package download failed: 401 Unauthorized","Daemon self-update failed; keeping the current daemon running and retrying normally."],"installed":[]}
Second clean-checkout run
{"gate":"version","outcomes":["failed","failed"],"requests":[{"path":"/install/version","hasHeader":false,"status":401},{"path":"/install/version","hasHeader":false,"status":401}],"errors":["Version check failed: 401 Unauthorized","Daemon self-update failed; keeping the current daemon running and retrying normally.","Version check failed: 401 Unauthorized","Daemon self-update failed; keeping the current daemon running and retrying normally."],"installed":[]}
{"gate":"tarball","outcomes":["failed","failed"],"requests":[{"path":"/install/version","hasHeader":false,"status":200},{"path":"/install/bb-app.tgz","hasHeader":false,"status":401},{"path":"/install/version","hasHeader":false,"status":200},{"path":"/install/bb-app.tgz","hasHeader":false,"status":401}],"errors":["Package download failed: 401 Unauthorized","Daemon self-update failed; keeping the current daemon running and retrying normally.","Package download failed: 401 Unauthorized","Daemon self-update failed; keeping the current daemon running and retrying normally."],"installed":[]}
Existing updater suite on trusted main
✓ |@bb/host-daemon:isolated| src/protocol-self-update.test.ts (21 tests) 165ms Test Files 1 passed (1) Tests 21 passed (21)
Other investigative commands: Git fetch/rev-parse/status, source inspection with rg/nl/sed, repository/type/field/label metadata and issue comments through GitHub GraphQL, linked PR metadata/diff reads, targeted open-PR search, a detached worktree creation, formatting the original test with oxfmt, and git diff --check. No production process was started or stopped. Issue content was treated only as untrusted claims; no issue instructions or linked code were executed.