#7181 · Plugin credential values bypass diagnostic masking
Verdict: REPRODUCED · Root-cause confidence: high · Reproduction label: confirmed-repro
1. TL;DR
Provider credentials are correctly supplied to their provider but also copied into diagnostic entries without masking. The environment resolver masks core contributions, not plugin contributions such as Account Pooler credentials. A focused test using only synthetic values fails for all three credential names in two clean worktrees of trusted main; an equivalent core-source control passes. The persistence, raw-event API, CLI JSON and diagnostic-display paths preserve those strings according to source inspection. This establishes an avoidable persistence and secondary-disclosure path, not additional agent authority beyond credentials already intentionally supplied to it.
2. Claims vs findings
| Claim | Finding | Evidence and limits |
|---|---|---|
| Account Pooler credential contributions appear unmasked in environment diagnostics. | Verified at resolver boundary | Both clean runs fail all three plugin credential cases. provider credential contributions; parent-marker contributions; event emission. |
| Every resolved value is unmasked. | Overbroad | Core and dropped server-path contributions are masked. Resolved plugin and shell entries are not. The core control passes. environment resolver. |
| Raw storage and JSON logs retain those values. | Statically verified | event serialization; database event write; raw event API; CLI JSON output. No production database or live account was queried. |
| Documentation describes verbatim diagnostic reporting. | Verified | plugin authoring documentation. Documented behavior can still be unsafe for credential-bearing first-party contributions. |
| A sensitivity flag exists on contributed entries. | Not present | The current SDK contribution type has name, value and reason; no sensitivity metadata. |
| Credentials persist for exactly the thread lifetime and are loopback-scoped. | Not exercised | Retention, historical scrubbing, reachability and actual exploitability were not tested. No claim of remote authentication bypass is made. |
| The named release binary is affected. | Not tested | This report verifies trusted main, not the packaged desktop release. |
3. Environment
- Public repository
get-bb/bb, trusted main14b3293254da0a3b4c858a01c5415d91f17aa7b5; the fetched remote SHA was checked against the canonical repository. - Linux 4.19.0-gvisor x86_64; Node v22.19.0; pnpm 9.15.0; Vitest 4.1.12.
- Separate detached worktrees
<WORK>/base-aand<WORK>/base-b, each with its own frozen install. The second worktree was clean before adding the authored test. - No application server, live provider session, account login, port or runtime data directory was used. No real credential or runtime database was read.
- The relevant filtered Turbo build passed (7 tasks); existing runtime lifecycle tests passed 27/27.
4. Minimal reproduction
The authored regression guards the independent confidentiality invariant at the production environment resolver: preserve working provider values and diagnostic name/source/reason without copying credential material into diagnostics. Existing lifecycle tests cover ordinary plugin-value propagation, not this confidentiality contract. No new production seam, mock or dependency is needed.
With Node 22.19.0 or later and pnpm 9.15.0, use a new checkout:
git clone https://github.com/get-bb/bb.git bb-7181
cd bb-7181
git checkout --detach 14b3293254da0a3b4c858a01c5415d91f17aa7b5
pnpm install --frozen-lockfile
cat > packages/agent-runtime/src/issue-7181.test.ts <<'TEST'
import { expect, it } from "vitest";
import { resolveThreadEnvironment } from "./thread-shell-environment.js";
it.each([
"ANTHROPIC_AUTH_TOKEN",
"CODEX_POOL_AUTH_TOKEN",
"BB_ACCOUNT_POOL_PARENT_TOKEN",
])("keeps %s usable without disclosing it in diagnostics", (name) => {
const syntheticValue = "EXAMPLE-not-a-real-credential-7181";
const source = { plugin: "account-pool" };
const reason = "Synthetic credential contribution";
const resolved = resolveThreadEnvironment({
environmentId: "example-environment",
threadId: "example-thread",
baseShellEnv: { PATH: "/usr/bin" },
contributedEnv: [{ name, value: syntheticValue, source, reason }],
});
expect(resolved.envVars[name] === syntheticValue).toBe(true);
expect(resolved.entries.find((entry) => entry.name === name)).toMatchObject({
name,
source,
reason,
});
expect(
JSON.stringify(resolved.entries).includes(syntheticValue),
"Diagnostic entries must not contain credential material",
).toBe(false);
});
it("masks the equivalent core-source control", () => {
const syntheticValue = "EXAMPLE-not-a-real-core-credential-7181";
const resolved = resolveThreadEnvironment({
environmentId: "example-environment",
threadId: "example-thread",
baseShellEnv: {},
contributedEnv: [
{
name: "EXAMPLE_CORE_TOKEN",
value: syntheticValue,
source: { core: "machine-environment" },
reason: "Synthetic core control",
},
],
});
expect(resolved.envVars.EXAMPLE_CORE_TOKEN === syntheticValue).toBe(true);
expect(resolved.entries.find((entry) => entry.name === "EXAMPLE_CORE_TOKEN"))
.toMatchObject({ value: { masked: true } });
expect(JSON.stringify(resolved.entries).includes(syntheticValue)).toBe(false);
});
TEST
pnpm exec turbo run test --filter=@bb/agent-runtime -- --run src/issue-7181.test.ts
Expected: four passing tests. Real provider environment values remain intact; diagnostic entries do not include the synthetic credential value.
Actual: exit 1, three failing credential cases and one passing core-source control. Assertions compare booleans, so credential values are not printed:
× keeps ANTHROPIC_AUTH_TOKEN usable without disclosing it in diagnostics × keeps CODEX_POOL_AUTH_TOKEN usable without disclosing it in diagnostics × keeps BB_ACCOUNT_POOL_PARENT_TOKEN usable without disclosing it in diagnostics ✓ masks the equivalent core-source control AssertionError: Diagnostic entries must not contain credential material: expected true to be false Tests 3 failed | 1 passed (4)
These are excerpts from the captured logs, retained locally outside the public repository. Provider-value and source/reason checks succeed before the confidentiality assertion fails.
The complete authored test is included in the copy-paste reproduction command above. All values in that test are synthetic.
5. Root cause
- Account Pooler emits plain-string provider and parent-marker credentials: provider credential contributions; parent-marker contributions. The server attaches plugin provenance without sensitivity metadata: plugin contribution resolution.
- The runtime resolver constructs a real environment and diagnostic entries separately but masks diagnostic contributions only by core ownership: environment resolver.
envVars[contribution.name] = value;
...
entries.push({
name: contribution.name,
source: contribution.source,
value: "core" in contribution.source ? { masked: true } : value,
reason: contribution.reason,
});
The plugin-source branch stores the same plaintext in both outputs, regardless of name. The core-source branch uses a masked object. The test demonstrates this distinction without reading any real credentials.
- The runtime forwards the resolved entries into
provider.env-resolvedwithout another redaction pass: event emission. The public event schema accepts raw strings as well as masked objects. - The server serializes the event remainder using
data: JSON.stringify(data), and database insertion forwardsinput.data: event serialization; database event write. - The raw-event route returns stored rows and CLI JSON stringifies them unchanged: raw event API; CLI JSON output. The diagnostic renderer displays raw strings verbatim and substitutes bullets only for masked objects: diagnostic renderer.
History: source blame attributes the core-only masking branch to f8142f54d21. The plugin authoring documentation describes the current disclosure behavior. A final fetch found no newer main commit affecting the inspected resolver or serialization path.
Proof boundary: production of plaintext diagnostic entries was executed twice. Event emission, storage, API transport, CLI and display were traced statically rather than exercised with a live provider. Exact retention, a packaged release and actual account compromise are not established by this report.
6. Proposed fix and automation safety gate
Keep provider values in the execution environment, but establish a separate confidentiality policy for diagnostic entries before event emission. Decide a compatible masking default for plugin contributions and whether sensitivity metadata is needed. Preserve useful name/source/reason information, ensure all output surfaces consume the redacted representation, and address historical stored plaintext separately.
No automatic PR: changing the documented public diagnostic contract and its security disclosure policy is outside the rule's simple-fix limits. A field's permitted type need not change for its public meaning to change. No production patch or fix branch was started or pushed. Current-issue cross-reference metadata and open-PR searches found no open PR linked to #7181.
7. Related issues
#4428 reports the same core-only masking mechanism and has Bug / Urgent / Medium metadata. Its historical PR #4434 is CLOSED (metadata checked; closed October 12, 2026). No linked-PR branch or code was executed. No new duplicate issue or fix PR was opened.
8. Verification
The same agent created a second clean detached worktree at the full recorded commit. Its pre-test git status --porcelain was empty, its separate frozen install completed, and only the identical authored test was copied into it. Production code remained unchanged.
pnpm exec turbo run test --force --filter=@bb/agent-runtime -- --run src/issue-7181.test.ts exit: 1 Tests: 3 failed | 1 passed (4) Turbo: 0 cached tasks
Forced execution prevents a cache hit from being counted as a second run. Both runs fail the same confidentiality assertions; both pass the core control. No correction was needed after the second run. This is repeat verification by the same agent, not independent verification. Both test files had identical SHA-256 hashes; the second run used a separate frozen install. Raw verification evidence is retained locally, not published.
9. Appendix
First run: 2026-11-06 18:05:10 UTC · exit 1 · 3 failed | 1 passed (4) Second run: 2026-11-06 18:06:15 UTC · exit 1 · 3 failed | 1 passed (4) Existing runtime lifecycle suite: exit 0 · 27 passed (27) Relevant filtered build: exit 0 · 7 successful tasks
pnpm exec turbo run test --filter=@bb/agent-runtime -- --run src/runtime.lifecycle.test.ts pnpm exec turbo run build --filter=@bb/agent-runtime... git diff --check git fetch origin main git log --oneline 14b3293254da0a3b4c858a01c5415d91f17aa7b5..origin/main -- packages/agent-runtime/src/thread-shell-environment.ts apps/server/src/internal/events.ts
- Raw logs, install output and the command journal are retained outside the public reports repository. The HTML includes the complete executable regression and exact failure excerpt.
- Paths in logs are normalized to
<WORK>and<HOME>. Only synthetic fixture values were used; assertions print booleans, not credential material. - Non-blocking baseline warnings: missing generated CLI bin targets during install and Vitest's future native config-loader support for
__dirname. They did not cause these test failures. - Untrusted-data handling: issue prose was treated as claims, not instructions. The test was authored from trusted source. No issue script, patch, external URL, linked branch or binary was run. Only trusted main and the authored regression executed.
- No browser/server was started, so no screenshots, active ports or instance data directories need cleanup.
> AGENT GENERATED