Repository navigation
Description
Finding
PR #4199 made parseDaemonUrl in bin/codedb-bridge.mjs reject a CODEDB_DAEMON_URL carrying a query string, fragment, or userinfo instead of silently stripping them (fixing #4198). But every error parseDaemonUrl throws interpolates the raw URL value, and the new branches additionally interpolate the sensitive components themselves — so the rejection prints the very secrets it is protecting into the error message:
- The userinfo branch fires exactly when the URL embeds credentials, and its message includes
CODEDB_DAEMON_URL="${value}"— the full raw URL, password included. - The query branch includes both
${value}and(query "${url.search}")— a query such as?token=secret(the shape used in PR fix(codedb-bridge): reject query/fragment/userinfo in CODEDB_DAEMON_URL (#4198) #4199's own test fixture) is printed verbatim, twice.
The caller prints the message to stderr and exits (console.error(err.message); process.exit(1)), and codedb-bridge runs as a stdio MCP server — stderr is captured into MCP host/client logs, so an embedded daemon password or token lands in log files that outlive the process.
Evidence
- Source PR: fix(codedb-bridge): reject query/fragment/userinfo in CODEDB_DAEMON_URL (#4198) #4199 — fix(codedb-bridge): reject query/fragment/userinfo in CODEDB_DAEMON_URL (#4198) #4199 (merge commit
cc5effd832a1d2587f61c6301c83f69643e86716, confirmed ancestor of main, compare statusbehind). The pre-existing throws already interpolated${value}; fix(codedb-bridge): reject query/fragment/userinfo in CODEDB_DAEMON_URL (#4198) #4199 added three new throws on the credential/token-bearing shapes. - Current main
60f92edfee0a70b6891a6d7da72593087924ccdc,bin/codedb-bridge.mjs:parseDaemonUrlthrows interpolating${value}at lines 54 (invalid URL), 58 (non-origin), 63 (query, also"${url.search}"), 68 (fragment, also"${url.hash}"), and ~73 (userinfo).- Caller at lines 352–355:
daemonUrl = parseDaemonUrl(process.env.CODEDB_DAEMON_URL)inside a try whose catch doesconsole.error(err.message); process.exit(1).
- PR fix(codedb-bridge): reject query/fragment/userinfo in CODEDB_DAEMON_URL (#4198) #4199's test (
bin/codedb-bridge.test.mjs) asserts the throws match/CODEDB_DAEMON_URL.*query/etc., but never asserts what the messages must not contain; its fixtures includehttp://user:pass@127.0.0.1:7719/andhttp://127.0.0.1:7719/?token=secret, both of which appear verbatim in the thrown messages today.
Why it matters
The triage decision on #4198 was "reject, do not honour" because credentials in this URL would otherwise be silently dropped. Echoing them into stderr defeats the other half of that protection: an operator who pasted a credential-bearing URL gets a startup failure whose log line contains the password/token in cleartext, in a log stream (MCP host logs) that is routinely shared for debugging. Error messages for secret-bearing input should name the offending component, never its value.
Acceptance criteria
- No
parseDaemonUrlerror message contains the URL's password, userinfo, query value, or fragment value; messages name the component only (e.g. "must not carry userinfo (embedded credentials)"), with the raw${value}interpolation removed or redacted in all branches ofparseDaemonUrl(including the pre-existing invalid-URL and non-origin branches). - Tests assert the negative: for inputs like
http://user:pass@127.0.0.1:7719/andhttp://127.0.0.1:7719/?token=secret, the thrown message matches the component name and does not containpassorsecret. - Rejection behavior is otherwise unchanged: query/fragment/userinfo still throw, valid origins still parse, and the existing codedb-bridge: parseDaemonUrl silently drops query, fragment and userinfo — CODEDB_DAEMON_URL validation rejects paths but strips the rest instead of failing fast #4198 tests keep passing.
Found by pr-diff-review lane B reviewing PR #4199 against current main. Dedupe: issue searches (codedb-bridge, CODEDB_DAEMON_URL) returned #4198 (closed — the silent-strip bug this PR fixed), #4191 (closed — fetch timeout), and unrelated items; no issue covers credential echo in the validation errors.
Activity
developing-today commentedon Nov 14, 2026
CODE-3356
dezren39 commentedon Nov 14, 2026
agent-note:v1
Agent: pr-diff-review-b
State: filed
Repo: developing-today/code
Source PR: #4199 (#4199, merged cc5effd); fixes #4198 (CLOSED)
Finding: parseDaemonUrl in bin/codedb-bridge.mjs rejects query/fragment/userinfo in CODEDB_DAEMON_URL (PR #4199), but every throw interpolates the raw URL value and the query branch also interpolates url.search — the userinfo rejection fires exactly when credentials are embedded and prints them (main lines 54-73); the caller console.errors the message and exits (lines 352-355), and the bridge is a stdio MCP server whose stderr lands in host logs.
Verified against main: 60f92ed (contents read of bin/codedb-bridge.mjs on main; PR #4199 merge confirmed ancestor of main, compare behind)
Evidence: hidden_files/pr-review-b-2026-11-14-0118-code/issue-codedb-echo-body.md + diff-4199.patch
dezren39 commentedon Nov 14, 2026
Agent note — task 16521 triaged inline (lane code-d)
Merge pull request #9834 from developing-today/queue/16521-9829-coded…
dezren39 commentedon Nov 14, 2026
Agent note — task 16521 done (lane code-d)
dezren39 commentedon Nov 14, 2026
Agent note — task 16527 done (lane code-d)