#7357 · Packaged bridge smoke inherits caller configuration
Verdict: REPRODUCED · Root-cause confidence: high · Reproduction label: confirmed-repro.
1. TL;DR
The packaging smoke test creates a temporary bridge data directory but does not give the bridge a temporary home or provider configuration environment. Consequently, the bridge workers retain the caller's home and provider configuration roots even though their working directory is temporary. In two clean source checkouts, the real built worker and the real Claude Code, Codex, and Pi plugin artifacts all initialized successfully while retaining synthetic caller configuration. An observation preload could read synthetic marker files outside the smoke-owned directory in all six launch cases per checkout. This establishes configuration exposure, not an observed provider write, credential disclosure, or data corruption.
2. Claims vs findings
| Claim | Finding | Evidence |
|---|---|---|
| The bridge launch inherits caller environment. | Verified | Both runs: HOME and USERPROFILE inherited for all three workers, with explicit overrides and home-based defaults. |
| Provider configuration can remain outside temporary smoke state. | Verified | CLAUDE_CONFIG_DIR, CODEX_HOME, and PI_CODING_AGENT_DIR resolve outside the smoke root; all synthetic markers readable. |
| The bridge data directory is isolated. | Verified | dataDirInsideSmokeRoot=true in every observation. |
| The normal provider model-list path writes to a developer's files. | Unverified | No real homes or credentials accessed. No model/list request, provider CLI, real account, or mutation of caller configuration was exercised. |
3. Environment
- Public repository get-bb/bb, trusted origin/main at
7c1353d80729983b86ea1555d18b42407f320406; checked again after both reproductions, with no newer main commit. - Linux x86_64; Node.js v22.19.0; pnpm 9.15.0; bb-app 0.49.0.
- Two separate detached clean worktrees, referred to here as
main-aandmain-b. Both retained unchanged tracked source. - Each checkout used
pnpm install --frozen-lockfile --prefer-offlineandpnpm exec turbo run build --filter=bb-app. Both builds passed all 62 tasks; the second restored all 62 from Turbo cache. - Real packaged-layout worker and built-in plugin host artifacts, built by normal bb-app tasks. Provider CLIs were not installed or invoked, so provider CLI versions are not applicable.
- No app/server/daemon instance, account, network listener, browser, or production data directory was used. Every execution created and removed a fresh synthetic fixture root.
4. Minimal reproduction
- Clone the public repository into a disposable checkout, use the recorded commit, install and build:
git clone https://github.com/get-bb/bb.git bb-7357 cd bb-7357 git checkout --detach 7c1353d80729983b86ea1555d18b42407f320406 pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build --filter=bb-app
- Save the complete diagnostic below as
check-isolation.mjsoutside the repository. Execute it with the checkout path:node /path/to/check-isolation.mjs /path/to/bb-7357
- Expected: all workers have smoke-owned home/config roots, no synthetic caller configuration is visible, and exit status is 0. Actual on the recorded trusted base: the workers initialize, all six retain caller roots, and the final assertion fails with exit status 1.
The diagnostic extracts the unchanged launcher function from trusted source instead of running the entire application smoke script. It uses the real Node spawn implementation and the real built worker/plugin artifacts, not a replacement provider. A Node preload records only selected booleans and reads only the marker files the diagnostic created. Each child receives a small explicit environment with no inherited credentials; PATH contains only the Node executable's directory. Only the bridge initialize RPC is sent, followed by clean shutdown. This is a launch-boundary reproduction, not a full tarball unpack/install/model-list end-to-end run, and the source extraction is a diagnostic technique rather than a proposed permanent test seam.
Complete diagnostic
import assert from "node:assert/strict";
import { spawn, spawnSync } from "node:child_process";
import { once } from "node:events";
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import { homedir, tmpdir } from "node:os";
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";
import { compileFunction } from "node:vm";
const selfPath = fileURLToPath(import.meta.url);
const pluginIds = ["provider-claude-code", "provider-codex", "provider-pi"];
const configVariables = ["CLAUDE_CONFIG_DIR", "CODEX_HOME", "PI_CODING_AGENT_DIR"];
function within(root, target) {
const suffix = relative(root, target);
return suffix === "" || (!suffix.startsWith("..") && !isAbsolute(suffix));
}
if (process.argv[1]?.endsWith("/bb-provider-bridge-worker.mjs")) {
const fixtureRoot = process.env.BB_7357_FIXTURE;
assert.ok(fixtureRoot);
const configDirs = [
process.env.CLAUDE_CONFIG_DIR || join(homedir(), ".claude"),
process.env.CODEX_HOME || join(homedir(), ".codex"),
process.env.PI_CODING_AGENT_DIR || join(homedir(), ".pi", "agent"),
];
for (const configDir of configDirs) assert.ok(within(fixtureRoot, configDir));
process.stdout.write(JSON.stringify({
probe: true,
homeInherited: homedir() === join(fixtureRoot, "caller-home"),
userprofileInherited: process.env.USERPROFILE === join(fixtureRoot, "caller-home"),
callerConfigReadable: configDirs.map((configDir) => {
const markerPath = join(configDir, "isolation-marker.txt");
return existsSync(markerPath) && readFileSync(markerPath, "utf8") === "synthetic-caller-config";
}),
configOutsideSmokeRoot: configDirs.map((configDir) => !within(join(fixtureRoot, "smoke"), configDir)),
dataDirInsideSmokeRoot: within(join(fixtureRoot, "smoke"), process.argv[4]),
}) + "\n");
} else if (process.argv[2] === "launch") {
const [repoRoot, fixtureRoot, scenario] = process.argv.slice(3);
const source = readFileSync(join(repoRoot, "packages/bb-app/scripts/smoke-tarball.mjs"), "utf8");
const start = source.indexOf("function spawnPackedBridge(");
const end = source.indexOf("\nasync function smokeBridgeModelList(", start);
assert.ok(start >= 0 && end > start);
const tempRoot = join(fixtureRoot, "smoke");
mkdirSync(tempRoot, { recursive: true });
const launch = compileFunction(source.slice(start, end) + "\nreturn spawnPackedBridge;", [
"spawn", "mkdirSync", "join", "tempRoot", "process",
])(spawn, mkdirSync, join, tempRoot, process);
for (const pluginId of pluginIds) {
const packageDir = join(repoRoot, "packages/bb-app");
const child = launch({
packageDir,
pluginId,
bridgePath: join(packageDir, "server/dist/builtin-plugins", pluginId, "dist/host.js"),
});
let output = "";
let errors = "";
child.stdout.on("data", (chunk) => { output += chunk.toString(); });
child.stderr.on("data", (chunk) => { errors += chunk.toString(); });
const timeout = setTimeout(() => child.kill("SIGKILL"), 15000);
const response = new Promise((accept, reject) => {
child.stdout.on("data", () => {
const messages = output.split("\n").filter(Boolean).flatMap((line) => {
try { return [JSON.parse(line)]; } catch { return []; }
});
if (messages.some((message) => message.id === 1 && message.result)) accept();
});
child.once("exit", () => reject(new Error("worker exited before initialization")));
});
const closed = once(child, "close");
child.stdin.write(JSON.stringify({
jsonrpc: "2.0", id: 1, method: "initialize",
params: { protocolVersion: 2, client: { name: "isolation-check", version: "0.0.0" } },
}) + "\n");
try {
await response;
child.stdin.end();
const [code] = await closed;
assert.equal(code, 0, errors);
const probe = output.split("\n").filter(Boolean).map((line) => JSON.parse(line)).find((message) => message.probe);
assert.ok(probe);
process.stdout.write(JSON.stringify({ scenario, pluginId, initialized: true, ...probe }) + "\n");
} finally {
clearTimeout(timeout);
if (child.exitCode === null) child.kill("SIGKILL");
}
}
} else {
const repoRoot = resolve(process.argv[2] || ".");
const fixtureRoot = mkdtempSync(join(tmpdir(), "bb-7357-fixture-"));
try {
const callerHome = join(fixtureRoot, "caller-home");
const overrides = ["caller-claude", "caller-codex", "caller-pi"].map((name) => join(fixtureRoot, name));
const defaults = [join(callerHome, ".claude"), join(callerHome, ".codex"), join(callerHome, ".pi", "agent")];
for (const configDir of [...overrides, ...defaults]) {
mkdirSync(configDir, { recursive: true });
writeFileSync(join(configDir, "isolation-marker.txt"), "synthetic-caller-config");
}
mkdirSync(join(fixtureRoot, "tmp"));
const observations = [];
for (const scenario of ["overrides", "home-fallback"]) {
const env = {
HOME: callerHome,
USERPROFILE: callerHome,
PATH: dirname(process.execPath),
TMPDIR: join(fixtureRoot, "tmp"),
NODE_OPTIONS: "--import=" + pathToFileURL(selfPath).href,
BB_7357_FIXTURE: fixtureRoot,
};
if (scenario === "overrides") configVariables.forEach((name, index) => { env[name] = overrides[index]; });
const result = spawnSync(process.execPath, [selfPath, "launch", repoRoot, fixtureRoot, scenario], {
env, encoding: "utf8", timeout: 60000,
});
assert.equal(result.status, 0, result.stderr);
process.stdout.write(result.stdout);
observations.push(...result.stdout.trim().split("\n").map((line) => JSON.parse(line)));
}
assert.equal(observations.length, 6);
assert.ok(observations.every((observation) => observation.initialized && observation.dataDirInsideSmokeRoot));
const leaking = observations.filter((observation) => observation.homeInherited || observation.configOutsideSmokeRoot.some(Boolean));
process.stdout.write("EXPECTED: all six workers use smoke-owned homes and config roots.\n");
process.stdout.write("ACTUAL: " + leaking.length + "/6 workers retain caller home/config roots; synthetic caller markers readable.\n");
assert.equal(leaking.length, 0, "packed bridge launch must isolate caller provider configuration");
} finally {
rmSync(fixtureRoot, { recursive: true, force: true });
}
}
Actual output, first checkout (selected verbatim lines)
{"scenario":"overrides","pluginId":"provider-claude-code","initialized":true,"probe":true,"homeInherited":true,"userprofileInherited":true,"callerConfigReadable":[true,true,true],"configOutsideSmokeRoot":[true,true,true],"dataDirInsideSmokeRoot":true}
{"scenario":"overrides","pluginId":"provider-codex","initialized":true,"probe":true,"homeInherited":true,"userprofileInherited":true,"callerConfigReadable":[true,true,true],"configOutsideSmokeRoot":[true,true,true],"dataDirInsideSmokeRoot":true}
{"scenario":"overrides","pluginId":"provider-pi","initialized":true,"probe":true,"homeInherited":true,"userprofileInherited":true,"callerConfigReadable":[true,true,true],"configOutsideSmokeRoot":[true,true,true],"dataDirInsideSmokeRoot":true}
{"scenario":"home-fallback","pluginId":"provider-claude-code","initialized":true,"probe":true,"homeInherited":true,"userprofileInherited":true,"callerConfigReadable":[true,true,true],"configOutsideSmokeRoot":[true,true,true],"dataDirInsideSmokeRoot":true}
{"scenario":"home-fallback","pluginId":"provider-codex","initialized":true,"probe":true,"homeInherited":true,"userprofileInherited":true,"callerConfigReadable":[true,true,true],"configOutsideSmokeRoot":[true,true,true],"dataDirInsideSmokeRoot":true}
{"scenario":"home-fallback","pluginId":"provider-pi","initialized":true,"probe":true,"homeInherited":true,"userprofileInherited":true,"callerConfigReadable":[true,true,true],"configOutsideSmokeRoot":[true,true,true],"dataDirInsideSmokeRoot":true}
EXPECTED: all six workers use smoke-owned homes and config roots.
ACTUAL: 6/6 workers retain caller home/config roots; synthetic caller markers readable.
AssertionError [ERR_ASSERTION]: packed bridge launch must isolate caller provider configuration
The configuration boolean arrays are ordered Claude Code, Codex, Pi. The observations are emitted by the actual worker before its plugin import; initialized=true is added only after the actual plugin returns a successful initialize response.
5. Root cause
spawnPackedBridge, lines 633–646 creates only a plugin data directory. Its spawn options set cwd and stdio but omit env. Node therefore passes the caller's environment through unchanged. A temporary current working directory does not change HOME, USERPROFILE, or explicit provider configuration overrides.
const dataDir = join(tempRoot, "bridge-data", pluginId);
mkdirSync(dataDir, { recursive: true });
…
{ cwd: tempRoot, stdio: ["pipe", "pipe", "pipe"] }
The model-list smoke function calls this launcher. The real bootstrap receives only module path, plugin ID, and data directory; no provider home is derived from the data directory.
The provider-side conventions independently agree with the observed exposure: Claude configuration uses CLAUDE_CONFIG_DIR or homedir()/.claude; Codex home uses CODEX_HOME or .codex; Pi native roots use PI_CODING_AGENT_DIR or .pi/agent. The report proves the inherited context and readability with synthetic files; it does not claim these specific helpers run during initialize or that all are called by model/list.
6. Proposed fix and autopilot safety gate
Have the packaging smoke launcher own a fresh per-plugin home and explicit provider configuration roots, create them before spawn, and pass that environment to its workers. Cover both explicit parent overrides and absent overrides, and retain legitimate temporary/runtime process requirements. Audit any other provider-specific config-root inputs before claiming complete isolation. Environment redirection is not an OS filesystem sandbox and does not by itself sanitize every inherited credential.
No pull request was opened: changing packaging smoke-test isolation falls under the rule's excluded packaging/security-boundary scope. The fix eligibility check stops before creating a branch or changing production code. There was no linked open pull request in the issue timeline or the numeric-issue PR search. No patch, passing post-fix regression, or claim of a completed fix is presented.
7. Verification
The same agent repeated the reproduction in a second clean detached worktree, main-b, at the exact recorded base commit, after its own frozen install and normal bb-app build. It ran the identical diagnostic with that checkout path and a newly created synthetic home, configuration roots, temp directory, and smoke directory. All six worker launches again initialized; all six retained HOME/USERPROFILE and caller configuration; every data directory remained under the smoke root. The command again exited 1 for the intended isolation assertion. No ports were allocated. This is a repeat by the same agent, not an independent review. No report correction was needed.
{"scenario":"overrides","pluginId":"provider-claude-code","initialized":true,"probe":true,"homeInherited":true,"userprofileInherited":true,"callerConfigReadable":[true,true,true],"configOutsideSmokeRoot":[true,true,true],"dataDirInsideSmokeRoot":true}
{"scenario":"overrides","pluginId":"provider-codex","initialized":true,"probe":true,"homeInherited":true,"userprofileInherited":true,"callerConfigReadable":[true,true,true],"configOutsideSmokeRoot":[true,true,true],"dataDirInsideSmokeRoot":true}
{"scenario":"overrides","pluginId":"provider-pi","initialized":true,"probe":true,"homeInherited":true,"userprofileInherited":true,"callerConfigReadable":[true,true,true],"configOutsideSmokeRoot":[true,true,true],"dataDirInsideSmokeRoot":true}
{"scenario":"home-fallback","pluginId":"provider-claude-code","initialized":true,"probe":true,"homeInherited":true,"userprofileInherited":true,"callerConfigReadable":[true,true,true],"configOutsideSmokeRoot":[true,true,true],"dataDirInsideSmokeRoot":true}
{"scenario":"home-fallback","pluginId":"provider-codex","initialized":true,"probe":true,"homeInherited":true,"userprofileInherited":true,"callerConfigReadable":[true,true,true],"configOutsideSmokeRoot":[true,true,true],"dataDirInsideSmokeRoot":true}
{"scenario":"home-fallback","pluginId":"provider-pi","initialized":true,"probe":true,"homeInherited":true,"userprofileInherited":true,"callerConfigReadable":[true,true,true],"configOutsideSmokeRoot":[true,true,true],"dataDirInsideSmokeRoot":true}
EXPECTED: all six workers use smoke-owned homes and config roots.
ACTUAL: 6/6 workers retain caller home/config roots; synthetic caller markers readable.
AssertionError [ERR_ASSERTION]: packed bridge launch must isolate caller provider configuration
Exit status: 1
8. Related issues
A small repository search for packaging and provider-home reports found no duplicate of this precise launch-boundary defect. Issue #6662 is an unrelated packaging metadata report, not a duplicate. No linked PR was found, so there is no PR review section.
9. Appendix and limits
Applied classification: Bug / Medium / Low; desktop and security. All values were initially missing; existing data was not overwritten. Medium priority reflects a developer/CI smoke path with an isolation workaround, rather than a demonstrated production outage or actual data loss.
Relevant commands in order: read canonical repository visibility, issue/comments/properties/labels and related issues; fetch origin/main; inspect launch and provider config-root code at the recorded commit; create clean worktree main-a; frozen install; Turbo bb-app build; run diagnostic; create clean worktree main-b at the same SHA; frozen install; Turbo bb-app build; repeat diagnostic; verify unchanged tracked source and latest origin/main; recheck linked PR metadata.
Untrusted-data handling: issue prose and its suggested code were treated only as claims. No issue-provided script, patch, URL, branch, or instruction was executed. The diagnostic was derived from trusted repository code. Only synthetic configuration was read, no environment values or credentials were dumped, and no provider account was used. Raw local logs are not published. All necessary reproduction code and expected/actual evidence are inline, in accordance with the reports repository's publication policy.