#6373 · RPC validation diagnostics omit structured field paths
Verdict: REPRODUCED · Root-cause confidence: high. Trusted base: b6743a36bd9eae1408c35cfc2c7ab1d2419dc79d.
1. TL;DR
A plugin's invalid RPC argument receives an informative HTTP error, but its server warning loses the failing field path. The validator supplies normalized structured issues; the boundary error's ordinary Error message contains only the generic summary, and the runtime logs only that summary. A real plugin loaded by the existing server test harness reproduces the mismatch through the actual HTTP route. Both input and output validation exhibit it. Two clean trusted checkouts reproduce the same missing-path assertions without a live BB instance or private runtime data.
2. Claims vs findings
| Claim | Finding | Evidence |
|---|---|---|
| RPC rejection warnings omit the failing field | Verified | Both route tests receive path entries / 0 / count in the HTTP error, but neither warning contains it. |
| The detail is computed before logging | Verified | The real normalized issue survives in PluginRpcBoundaryError.rpcError and reaches the HTTP response. |
| The wrapper discards the original cause | Refined | invokeWrapped retains cause for the caller; it is specifically its warning and status summary that use only Error.message. |
| Schema messages can safely be logged without values | Not generally safe | The RPC contract accepts arbitrary Standard Schema issue.message strings. A validator can echo sensitive input in that text. The reproduction uses a synthetic custom-message sentinel to guard against forwarding it to logs. |
| Frequency and behavior in the reported release | Unverified | Only the pinned current main commit was executed; no historical release, external plugin, or claimed historical frequency was tested. |
3. Environment
- Linux x86_64; Node v22.19.0; pnpm 9.15.0; Vitest 4.1.1; Zod from the frozen repository lockfile.
- Two detached worktrees at the same trusted commit; fresh frozen dependency installs and SDK/server builds in each.
- Real migrated temporary SQLite databases and freshly created plugin/data directories, cleaned by the harness. HTTP is exercised in-process with Hono app.request: no listening ports, host daemons, production instance, account, or provider.
- A first broad build hit an existing SDK dist build-order prerequisite. Building SDK runtime/types explicitly and then the server succeeded in both checkouts; this is setup, not the reproduction failure.
4. Minimal reproduction
- Clone trusted main and pin the recorded base:
git clone https://github.com/get-bb/bb.git bb-6373 cd bb-6373 git checkout --detach b6743a36bd9eae1408c35cfc2c7ab1d2419dc79d pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build build:types --filter=@get-bb/plugin-sdk pnpm exec turbo run build --filter=@bb/server
- Copy the complete inline reproduction test to
apps/server/test/services/plugins/plugin-rpc-validation-logging.test.ts. - Run:
pnpm exec turbo run test --filter=@bb/server -- test/services/plugins/plugin-rpc-validation-logging.test.ts
Expected: the warning identifies the normalized field path while omitting the supplied value and arbitrary custom validation text. The response must retain the structured issue and original generic message.
Actual: HTTP 400 for input / 500 for output includes issues[0].path = ["entries",0,"count"], but warnings are only:
[plugin:rpc-diagnostics] rpc inspect failed: rpc input validation failed [plugin:rpc-diagnostics] rpc inspect failed: rpc output validation failed
Both tests fail at the final path assertion; all HTTP-contract, handler-invocation, and no-payload assertions pass first. These are intentionally failing desired-behavior regression tests against unmodified production code.
Complete reproduction test
import { mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { expect, it, vi } from "vitest";
import { defineRpcContract } from "@get-bb/plugin-sdk";
import { z } from "zod";
import { createTestAppHarness } from "../../helpers/test-app.js";
it.each(["input", "output"] as const)(
"logs RPC %s validation paths without payloads or custom issue messages",
async (phase) => {
const harness = await createTestAppHarness();
const rootDir = await mkdtemp(join(tmpdir(), "bb-rpc-diagnostics-"));
const warn = vi.spyOn(harness.deps.logger, "warn");
try {
await writeFile(
join(rootDir, "package.json"),
JSON.stringify({
name: "bb-plugin-rpc-diagnostics",
version: "0.1.0",
bb: {
name: "RPC diagnostics fixture",
description: "Validation logging fixture",
branding: { icon: "Zap" },
server: "./server.ts",
},
}),
);
await writeFile(
join(rootDir, "server.ts"),
"export default function plugin() {}",
);
expect((await harness.pluginService.installPath(rootDir)).status).toBe(
"running",
);
const api = harness.pluginService.getApi("rpc-diagnostics");
if (!api) throw new Error("fixture plugin did not start");
const schema = z.object({
entries: z.array(
z.object({ count: z.number({ error: "private-validator-detail" }) }),
),
});
const invalid = { entries: [{ count: "private-payload-content" }] };
const handler = vi.fn(() => (phase === "output" ? invalid : null));
api.rpc.register(
defineRpcContract({
inspect: {
input: phase === "input" ? schema : z.null(),
output: phase === "output" ? schema : z.null(),
},
}),
{ inspect: handler },
);
const response = await harness.app.request(
"/api/v1/plugins/rpc-diagnostics/rpc/inspect",
{
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify(phase === "input" ? invalid : null),
},
);
const body = await response.json();
expect(response.status).toBe(phase === "input" ? 400 : 500);
expect(body).toMatchObject({
ok: false,
error: {
code: `invalid_${phase}`,
message: `rpc ${phase} validation failed`,
issues: [
{
path: ["entries", 0, "count"],
message: "private-validator-detail",
},
],
},
});
expect(handler).toHaveBeenCalledTimes(phase === "input" ? 0 : 1);
const warning = warn.mock.calls
.map(([message]) => String(message))
.find((message) => message.includes("rpc inspect failed:"));
console.log(JSON.stringify({ phase, response: body, warning }));
expect(warning).toBeDefined();
expect(warning).not.toContain("private-payload-content");
expect(warning).not.toContain("private-validator-detail");
expect(warning).toContain('["entries",0,"count"]');
} finally {
warn.mockRestore();
await harness.pluginService.stop();
await harness.cleanup();
await rm(rootDir, { recursive: true, force: true });
}
},
);
5. Root cause
packages/plugin-sdk/src/internal/host-policy.ts:3637normalizes string/numeric issue paths and keeps issue.message.packages/plugin-sdk/src/internal/host-policy.ts:3688packages a generic message alongside normalized issues on validation failure.apps/server/src/services/plugins/plugin-service.ts:473constructs the Error withsuper(rpcError.message); issues remain on its separate rpcError field.apps/server/src/services/plugins/plugin-runtime.ts:827logs onlyerror.message. The cause is returned, not discarded.apps/server/src/services/plugins/plugin-service.ts:2142returns the retained structured rpcError to the route;apps/server/src/routes/plugins.ts:986serializes it and maps input/output errors to HTTP statuses.
6. Proposed fix
Append a small bounded summary of normalized issue paths to the internal boundary Error message, leaving rpcError itself unchanged. JSON-encode paths to preserve array indices and escape control characters. Cap the number of paths and summary length; represent a pathless issue as the root. Do not blindly append arbitrary Standard Schema issue messages or input/output objects: messages can contain values and are not a safe logging primitive. Unknown-key names and expected-type prose are not separate trusted metadata in this normalized issue contract; obtaining them without exposing values needs a separately designed contract, not message parsing.
7. Related issues and PR metadata
No open pull request in get-bb/bb links to this issue in the checked metadata. The issue timeline includes a cross-reference from a separate plugin repository's PR #438, which was merged by the final metadata check and does not close this issue. No external PR code or branches were fetched or executed. Nearby plugin-boundary issue #2519 concerns a different caller contract and is not evidence for this logging defect.
8. Verification
The same agent repeated the reproduction, not an independent reviewer. A second clean detached worktree named second was created at the recorded base commit. Before copying the reproduction test it had no source changes. Dependencies were freshly installed; SDK and server builds passed; the same Turbo test command ran with fresh harness data directories and no ports. Both cases again failed only because the warning omitted the normalized path. No report correction was needed after the second run. Confidence is high for this unit/in-process HTTP path; packaged release and a long-running production instance were not exercised.
repro-first.log
@bb/server:test: {"phase":"input","response":{"ok":false,"error":{"code":"invalid_input","message":"rpc input validation failed","issues":[{"message":"private-validator-detail","path":["entries",0,"count"]}]}},"warning":"[plugin:rpc-diagnostics] rpc inspect failed: rpc input validation failed"}
@bb/server:test: {"phase":"output","response":{"ok":false,"error":{"code":"invalid_output","message":"rpc output validation failed","issues":[{"message":"private-validator-detail","path":["entries",0,"count"]}]}},"warning":"[plugin:rpc-diagnostics] rpc inspect failed: rpc output validation failed"}
@bb/server:test: AssertionError: expected '[plugin:rpc-diagnostics] rpc inspect …' to contain '["entries",0,"count"]'
@bb/server:test: Expected: "["entries",0,"count"]"
@bb/server:test: Received: "[plugin:rpc-diagnostics] rpc inspect failed: rpc input validation failed"
@bb/server:test: AssertionError: expected '[plugin:rpc-diagnostics] rpc inspect …' to contain '["entries",0,"count"]'
@bb/server:test: Expected: "["entries",0,"count"]"
@bb/server:test: Received: "[plugin:rpc-diagnostics] rpc inspect failed: rpc output validation failed"
@bb/server:test: Test Files 1 failed (1)
@bb/server:test: Tests 2 failed (2)
@bb/server:test: Duration 9.51s (transform 5.15s, setup 1.54s, import 5.17s, tests 857ms, environment 0ms)
repro-second.log
@bb/server:test: {"phase":"input","response":{"ok":false,"error":{"code":"invalid_input","message":"rpc input validation failed","issues":[{"message":"private-validator-detail","path":["entries",0,"count"]}]}},"warning":"[plugin:rpc-diagnostics] rpc inspect failed: rpc input validation failed"}
@bb/server:test: {"phase":"output","response":{"ok":false,"error":{"code":"invalid_output","message":"rpc output validation failed","issues":[{"message":"private-validator-detail","path":["entries",0,"count"]}]}},"warning":"[plugin:rpc-diagnostics] rpc inspect failed: rpc output validation failed"}
@bb/server:test: AssertionError: expected '[plugin:rpc-diagnostics] rpc inspect …' to contain '["entries",0,"count"]'
@bb/server:test: Expected: "["entries",0,"count"]"
@bb/server:test: Received: "[plugin:rpc-diagnostics] rpc inspect failed: rpc input validation failed"
@bb/server:test: AssertionError: expected '[plugin:rpc-diagnostics] rpc inspect …' to contain '["entries",0,"count"]'
@bb/server:test: Expected: "["entries",0,"count"]"
@bb/server:test: Received: "[plugin:rpc-diagnostics] rpc inspect failed: rpc output validation failed"
@bb/server:test: Test Files 1 failed (1)
@bb/server:test: Tests 2 failed (2)
@bb/server:test: Duration 8.86s (transform 4.83s, setup 1.47s, import 4.77s, tests 827ms, environment 0ms)
9. Appendix
The complete repeatable test and exact relevant output from both runs are embedded above. Raw logs and a separate test copy remain in local investigation storage, not the public reports repository. Local checkout paths are replaced by $WORK. All payload/message sentinels are synthetic, not credentials or user data.
Issue content was treated solely as untrusted claims; none of its commands, patches, external links, or instructions was executed. Investigation commands were trusted-repository fetch/worktree creation, frozen installs, Turbo builds/tests, repository source reads, and read-only GitHub metadata queries. Publication uses the authorized SlopCop GitHub wrapper. No browser or screenshots are needed for a server logging defect.