Skip to content

codedb-bridge: parseDaemonUrl silently drops query, fragment and userinfo — CODEDB_DAEMON_URL validation rejects paths but strips the rest instead of failing fast #4198

Closed

Description

@dezren39

Problem

parseDaemonUrl in bin/codedb-bridge.mjs:37-51 is meant to accept only a bare http:// origin — it rejects a non-URL, a non-http: protocol, and any path other than /:

if (url.protocol !== 'http:' || (url.pathname !== '/' && url.pathname !== '')) {
  throw new Error(`CODEDB_DAEMON_URL="${value}" must be an http:// origin with no path ...`);
}
return url.origin;

But it never inspects url.search, url.hash, or url.username/url.password, and url.origin silently strips all three. So configuration the operator wrote is silently discarded instead of either honoured or rejected:

  • CODEDB_DAEMON_URL=http://127.0.0.1:7719/?token=abc → accepted, query dropped
  • CODEDB_DAEMON_URL=http://user:pass@127.0.0.1:7719/ → accepted, credentials dropped
  • CODEDB_DAEMON_URL=http://127.0.0.1:7719/#frag → accepted, fragment dropped
  • CODEDB_DAEMON_URL=http://127.0.0.1:7719/?next=/explore/tree → accepted, query dropped

Evidence (verified this run)

Laptop probe ~/git/fleet/probe-2026-11-01-laneA-codedb/ (verbatim copy of bin/codedb-bridge.mjs from main 199a7d27, md5 ca05ede20d2ae1a4760297bbe9320c58, node v24.21.0), calling parseDaemonUrl directly: all four inputs above returned "http://127.0.0.1:7719" with no error.

Controls in the existing suite (bin/codedb-bridge.test.mjs:16-24) confirm the intended strictness for the cases that are checked: https://… throws, http://127.0.0.1:7719/explore throws, a non-URL throws. Query/fragment/userinfo are simply untested and unchecked.

Why it matters

This is the bridge's only configuration knob, and its errors are supposed to fail fast at startup with a message naming the bad value (that is the whole design of parseDaemonUrl, and main exits 1 on its throw, :245-250). A typo'd or pasted URL carrying a query or credentials instead starts the bridge against a different effective configuration than the operator wrote, with no trace — a silent third path of the kind issue #3352 bans, at the config layer. Dropping embedded credentials silently is the worst case: the operator believes the daemon is being reached with auth; it is not, and nothing says so.

Acceptance criteria

  • parseDaemonUrl rejects (with the existing error style naming the value) any URL with a non-empty query string, fragment, username, or password — or, if one of those is deliberately supported, it is honoured and documented in the header instead of stripped.
  • Tests in bin/codedb-bridge.test.mjs cover query, fragment, and userinfo inputs alongside the existing protocol/path cases; the default and trailing-slash cases still pass.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    source/creatorFiled by the new-issue-creator job
    priority/lowNice to have; do when convenient
    effort/sSmall: expected under 2 hours of work
    app/codedb-bridgebin/codedb-bridge.mjs — stdio MCP bridge to the shared codedb daemon
    on Nov 2, 2026
  2. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator job (new-issue-creator-code-a)
    • Session / ID: new-issue-creator-code-a run 2026-11-01 23:05 CST (2026-11-02T05:14Z)
    • Found via: filed this run
    • Task: Triage parseDaemonUrl's silent dropping of query/fragment/userinfo in bin/codedb-bridge.mjs and route the fail-fast fix
    • Expectation: effort/s — done when non-origin CODEDB_DAEMON_URL values are rejected by name (or honoured and documented), with tests
    • Links: evidence in the issue body; laptop probe ~/git/fleet/probe-2026-11-01-laneA-codedb/
  3. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 2, 2026
  4. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  5. 1 remaining item

  6. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 2, 2026
  7. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  8. added a commit that references this issue on Nov 2, 2026
  9. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

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/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions