Skip to content

Reject database URLs carrying embedded credentials at the proxy boundary - #2255

Merged
kmcginnes merged 1 commit into
mainfrom
reject-embedded-credentials-in-db-url
Sep 23, 2026
Merged

kmcginnes merged 1 commit into
mainfrom
reject-embedded-credentials-in-db-url

Conversation

@kmcginnes

Copy link
Copy Markdown
Collaborator

Description

A database URL carrying a username or password passed the proxy server's request validation, even though node-fetch refuses to build a request from such a URL. That connection has never been able to run a query, so the only outcome was a failure further along with a less useful message.

Validation now rejects a database URL with userinfo, which turns it into a 400 before any URL object is built from it. Nothing that used to work stops working.

Header values included in the log line for a failed request are also normalised to drop any userinfo.

Validation

All six database routes return 400 for such a URL and dispatch no outbound fetch. A URL carrying only a username is rejected too, and a URL without userinfo still proxies normally. The log-line tests cover a URL value, a URL without userinfo, a value that is not a URL at all, and a value outside the allowed list.

pnpm checks and pnpm test clean: 223 files, 2720 tests.

Notes

This replaces #2250, which GitHub closed as merged when a stack reorder made its head commit an ancestor of its own base branch. Nothing from it reached main. Same commit, rebased directly onto main, and independent of any other open PR.

Related Issues

None.

Check List

  • I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • I have verified pnpm checks passes with no errors.
  • I have verified pnpm test passes with no failures.
  • I have covered new added functionality with unit tests if necessary.
  • I have updated documentation if necessary.

node-fetch cannot build a request from a URL with a username or
password, so such a connection has never been able to run a query. The
request header schema now rejects one, which turns it into a 400 before
any URL object exists. Header values logged for a failed request also
get their userinfo replaced.
@kmcginnes
kmcginnes merged commit 7e770d2 into main Sep 23, 2026
6 checks passed
@kmcginnes
kmcginnes deleted the reject-embedded-credentials-in-db-url branch September 23, 2026 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant