Skip to content

codedb-bridge: parseDaemonUrl errors echo the raw CODEDB_DAEMON_URL — userinfo/query rejections print embedded credentials and tokens to stderr (PR #4199) #9829

Closed

Description

@dezren39

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 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

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 parseDaemonUrl error 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 of parseDaemonUrl (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/ and http://127.0.0.1:7719/?token=secret, the thrown message matches the component name and does not contain pass or secret.
  • 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

  1. added
    kind/securitySecurity issue or security hardening
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 14, 2026
  2. developing-today commented on Nov 14, 2026

    @developing-today
    Contributor
  3. added
    priority/lowNice to have; do when convenient
    app/codedb-bridgebin/codedb-bridge.mjs — stdio MCP bridge to the shared codedb daemon
    on Nov 14, 2026
  4. dezren39 commented on Nov 14, 2026

    @dezren39
    MemberAuthor

    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

  5. added
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    effort/xsTrivial: expected under 30 minutes of work
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 14, 2026
  6. dezren39 commented on Nov 14, 2026

    @dezren39
    MemberAuthor

    Agent note — task 16521 triaged inline (lane code-d)

  7. added a commit that references this issue on Nov 14, 2026
  8. dezren39 commented on Nov 14, 2026

    @dezren39
    MemberAuthor

    Agent note — task 16521 done (lane code-d)

  9. dezren39 commented on Nov 14, 2026

    @dezren39
    MemberAuthor

    Agent note — task 16527 done (lane code-d)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/codedb-bridgebin/codedb-bridge.mjs — stdio MCP bridge to the shared codedb daemoneffort/xsTrivial: expected under 30 minutes of workkind/securitySecurity issue or security hardeningpriority/lowNice to have; do when convenientsource/pr-diff-reviewFiled by the pr-diff-review jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions