Skip to content

Tighten the DB_URI shape refusal: a fragment's query, false doc sentences, and the echoed near-miss #1126

Open

Description

@chappie-daemon

Found by a scoped security read of the DB_URI shape refusal added to #1125. None of it blocks that PR; all of it is in the refusal or in the redaction around it.

What

  1. The new fallback reads a ? inside a fragment as a query. postgres://#?host=/sock is now accepted and dials localhost, where before the gate it was refused. The scan should end the authority at the first /, ? or # and ignore anything after a # when looking for a host/hostaddr query key.
  2. Two doc sentences in the refusal are false. "a refused string is one with no ://" is untrue for postgres://, postgres://// and postgres:///db, which have :// and are refused; and "everything sqlx can dial is left alone" is untrue for the same three, which sqlx parses to localhost. The doc should state the deliberate divergence and the three cases.
  3. Base behaviour, unchanged by feat(cli): migrate a Postgres relay into LMDB, with resume, verify and a reported throughput #1125: a string containing :// outside a valid scheme (password=ab://cd, alice:s3cret@host://db) passes the gate and is echoed whole in could not read the source at. Either such a string should be refused, or the echo should print nothing of the value.
  4. Minor, from the same read: postgres://user@:5432/db is newly accepted (sqlx: empty host, no dial), %68ost as a query key is refused, and the socket-form test asserts less than the hostaddr one.

Acceptance

  • A test per shape in 1 and 3, each failing without the change.
  • The doc comment matches the predicate, including the deliberate strictness and its reason.
  • The socket and hostaddr forms still dial (they are what a Unix-socket relay uses).

Related: #1125, #1115.

Activity

  1. added
    bugSomething isn't working
    rewritenostream 4.0 Rust/LMDB rewrite
    rustRust implementation work
    factoryBuilt by the software factory
    on Nov 12, 2026
  2. chappie-daemon commented on Nov 12, 2026

    @chappie-daemon
    CollaboratorAuthor

    Items 1–3 landed at 8be97bc on factory/029-pg-to-lmdb (PR #1125):

    1. The fragment is dropped before the query is read, so postgres://#?host=/sock is refused instead of dialling localhost. Red at the previous rule: could not read the source at postgres:// … Connection refused.
    2. The doc comment now states the predicate and the deliberate strictness, naming postgres://, postgres://// and postgres:///db as localhost to sqlx and refused here with the reason.
    3. Only postgres/postgresql (either case) count as a scheme, so password=ab://cd — a libpq keyword string with an accidental :// — is refused before anything is dialled. Red at the previous rule: the failure printed the string verbatim, could not read the source at password=ab://cd, which is the leak this item named.

    From item 4, postgres://user@:5432/db is now refused (empty host, matching sqlx), and an IPv6 literal is pinned as a host. Still open here: a percent-encoded query key (%68ost) is refused, which is stricter than sqlx and harmless, and the socket-form test asserts only that the gate passes it rather than naming the socket error.

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

    bugSomething isn't workingfactoryBuilt by the software factoryrewritenostream 4.0 Rust/LMDB rewriterustRust implementation work

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions