Skip to content

Preserve spaces in connection URL passwords - #670

Merged
toluaina merged 1 commit into
toluaina:mainfrom
fooklook:fix/url-password-spaces
Oct 23, 2026
Merged

toluaina merged 1 commit into
toluaina:mainfrom
fooklook:fix/url-password-spaces

Conversation

@fooklook

Copy link
Copy Markdown
Contributor

Passwords containing spaces fail authentication when PGSync builds database, search, or Redis connection URLs. For example, demo password+with@symbols is encoded with quote_plus and decoded by URL consumers as demo+password+with@symbols.

Use URL percent-encoding (quote(..., safe="")) for passwords in the URL userinfo component, so spaces become %20 and literal plus signs remain %2B. Keep existing auth-plugin precedence and explicit-URL overrides.

Validation:

  • Added 12 round-trip regression cases covering database, search, Redis with a username, and Redis with the default user; passwords include spaces, reserved characters, and Unicode.
  • Reproduced the failure before applying the fix. All 18 tests in tests/test_urls.py pass after the fix.
  • isort --profile black --check-only, black --check, flake8, and git diff --check pass for the changed Python files.

The tests do not require external services. The full database/backend matrix is left to upstream CI.

@toluaina toluaina left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for this

@toluaina
toluaina merged commit f4e9454 into toluaina:main Oct 23, 2026
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.

2 participants