You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
the issue with a local PostgreSQL install?: Irrelevant
Python version: 3.10.9
Platform: Arch Linux x86_64
Do you use pgbouncer?: No
Did you install asyncpg with pip?: No
If you built asyncpg locally, which version of Cython did you use?: Didn't
Can the issue be reproduced under both asyncio and uvloop?: Irrelevant
When asyncpg is run with a home-dir-less user, it cannot connect to a database because pathlib.Path.Home() may resolve to /dev/null or similar.
In connect_utils.py, around line 551, asyncpg attempts to load an SSL client certificate from the executing user's home dir. If the user doesn't have a home dir, this may result in a path like /dev/null/.postgresql/postgresql.crt and throw a NotADirectoryError. The intent was to ignore such errors, but only FileNotFoundException is caught.
The result is that users whose home directories aren't directories, as such, at all... can't connect to database servers even without using SSL.
I think the catch should be more comprehensive, and for a non-SSL-mandated connection we should proceed regardless of the reason the file can't be read.
The text was updated successfully, but these errors were encountered:
If `HOME` points to a regular file (or `/dev/null`), make sure we don't
crash unnecessarily, and if we do need to crash, so so informatively.
Fixes: #1014
If `HOME` points to a regular file (or `/dev/null`), make sure we don't
crash unnecessarily, and if we do need to crash, so so informatively.
Fixes: #1014
If `HOME` points to a regular file (or `/dev/null`), make sure we don't
crash unnecessarily, and if we do need to crash, so so informatively.
Fixes: #1014
the issue with a local PostgreSQL install?: Irrelevant
uvloop?: Irrelevant
When asyncpg is run with a home-dir-less user, it cannot connect to a database because
pathlib.Path.Home()
may resolve to/dev/null
or similar.In
connect_utils.py
, around line 551, asyncpg attempts to load an SSL client certificate from the executing user's home dir. If the user doesn't have a home dir, this may result in a path like/dev/null/.postgresql/postgresql.crt
and throw aNotADirectoryError
. The intent was to ignore such errors, but onlyFileNotFoundException
is caught.The result is that users whose home directories aren't directories, as such, at all... can't connect to database servers even without using SSL.
I think the catch should be more comprehensive, and for a non-SSL-mandated connection we should proceed regardless of the reason the file can't be read.
The text was updated successfully, but these errors were encountered: