Skip to content

Decode percent-encoded URL credentials before authentication - #225

Draft
Kayvan-Zahiri wants to merge 1 commit into
planetscale:mainfrom
Kayvan-Zahiri:codex/decode-url-credentials
Draft

Kayvan-Zahiri wants to merge 1 commit into
planetscale:mainfrom
Kayvan-Zahiri:codex/decode-url-credentials

Conversation

@Kayvan-Zahiri

Copy link
Copy Markdown

URL-based configuration reads username and password directly from the URL object, whose properties remain percent-encoded. This sends encoded characters in the Basic authentication header and rejects otherwise valid credentials containing characters such as @, /, spaces, or percent signs.

Decode both URL userinfo fields once before storing them. Three request-level regressions assert the exact Basic header and exposed configuration. A password containing literal %2F verifies that it is not decoded a second time.

Validation: all three regressions fail before the fix; all45 tests pass afterward. npm test builds the ESM and CommonJS variants before exercising the real driver with Undici's network-disabled MockAgent. npm run lint and git diff --check pass. Tested on Node24.1.0 with npm ci lockfile dependencies; the Node22/24 CI matrix and hosted database authentication were not run. All credentials in tests are synthetic.

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