Skip to content

Handle missing password authentication cleanly - #1351

Merged
elprans merged 4 commits into
MagicStack:masterfrom
aryansk:fix/1286-missing-password-error
Sep 24, 2026
Merged

elprans merged 4 commits into
MagicStack:masterfrom
aryansk:fix/1286-missing-password-error

Conversation

@aryansk

@aryansk aryansk commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Avoid an internal AttributeError when PostgreSQL requests cleartext password authentication but the connection parameters do not contain a password.

Changes

  • detect a missing password before building the cleartext password message
  • raise an asyncpg InterfaceError with an actionable message instead of calling .encode() on None
  • add regression coverage for connecting to a password-authenticated role without supplying a password

Test plan

python -m unittest tests.test_connect.TestAuthentication.test_auth_password_cleartext_without_password

Fixes #1286

@elprans
elprans marked this pull request as ready for review September 24, 2026 03:42
@elprans
elprans enabled auto-merge (squash) September 24, 2026 03:42
@elprans
elprans merged commit 6be5915 into MagicStack:master Sep 24, 2026
53 checks passed
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.

Connect with passwordless DSN does not work

2 participants