Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing string values for ssl query string in PostgreSQL URL #575

Closed
Exagone313 opened this issue Nov 28, 2023 · 1 comment · Fixed by #576
Closed

Allow passing string values for ssl query string in PostgreSQL URL #575

Exagone313 opened this issue Nov 28, 2023 · 1 comment · Fixed by #576

Comments

@Exagone313
Copy link
Contributor

Exagone313 commented Nov 28, 2023

When using the PostgreSQL backend, you can pass the ssl key in the query string, with the values true or false. These are converted to boolean and passed as arguments to asyncpg.create_pool

The asyncpg library accepts other values than only True and False, which can be used to choose how certificate validation is done (or not done).

For the record, when setting ssl=true, the ssl mode used is prefer, which will fallback to plain if SSL connection fails, so it is not a secure default. (Edit: This is not true, certificate is checked with ssl=true, the documentation is not clear on that topic).

I'm going to send a PR that permits to send string values, but it will not change the default settings.

Exagone313 added a commit to Exagone313/python-databases that referenced this issue Nov 28, 2023
…ode#575)

The underlying library asyncpg accepts string values in the ssl
parameter. The old code only accepted the values true and false, which
are converted to boolean.
Exagone313 added a commit to Exagone313/python-databases that referenced this issue Nov 28, 2023
…ode#575)

The underlying library asyncpg accepts string values in the ssl
parameter. The old code only accepted the values true and false, which
are converted to boolean.
@Exagone313
Copy link
Contributor Author

I found later on that you can pass the ssl parameter directly as a keyword argument when initializing the Database class.

But I still believe it could be useful to pass it in the URL.

@Exagone313 Exagone313 changed the title Allow passing string values for ssl parameter in PostgreSQL backend Allow passing string values for ssl query string in PostgreSQL URL Nov 28, 2023
Exagone313 added a commit to Exagone313/python-databases that referenced this issue Nov 28, 2023
…ode#575)

The underlying library asyncpg accepts string values in the ssl
parameter. The old code only accepted the values true and false, which
are converted to boolean.
zanieb pushed a commit that referenced this issue Nov 28, 2023
… (#576)

The underlying library asyncpg accepts string values in the ssl
parameter. The old code only accepted the values true and false, which
are converted to boolean.
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 a pull request may close this issue.

1 participant