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

fix: disable automatic fallback from SSL to non-SSL DB connection #1249

Closed
wants to merge 1 commit into from

Conversation

icehaunter
Copy link
Contributor

Postgrex connector we're using now doesn't support fallback behavior like this, so we're disabling it for epgsql connections as well. This commit also fixes application of the default value for requiring SSL, which was erroneously "false" before. This means that if your DB doesn't support SSL, you need to explicitly specify it via DATABASE_REQUIRE_SSL=false env variable or ?sslmode=disable in the connection string.

`Postgrex` connector we're using now doesn't support fallback behavior like this, so we're disabling it for `epgsql` connections as well.
This commit also fixes application of the default value for requiring SSL, which was erroneously "false" before. This means that if your DB doesn't support SSL, you need to explicitly specify it via `DATABASE_REQUIRE_SSL=false` env variable or `?sslmode=disable` in the connection string.
@icehaunter icehaunter requested review from samwillis and alco May 9, 2024 11:01
Copy link

linear bot commented May 9, 2024

{nil, nil} -> default_database_require_ssl
{nil, _} -> false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@alco match order made it so {nil, nil} case never matched before this change

Copy link
Member

Choose a reason for hiding this comment

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

Addressed in #1261.

@samwillis
Copy link
Contributor

@icehaunter
Does this require a docs change and calling out in the release notes as it changes the default. Whats the impact on existing setups?

@icehaunter
Copy link
Contributor Author

icehaunter commented May 9, 2024

@samwillis
This impacts any setups where the DB does not support SSL - docker-compose, same-cluster k8s, or local dev. Probably does warrant a callout in release notes, yeah. Without this change any setups without an explicit flag but with DBs expecting SSL are broken until it's set. With this change setups without an explicit flag but with DBs not supporting SSL are broken, but broken better with explicit error on startup instead of a hidden one later on.

We can also change the default to NOT use ssl - so that we break setups expecting SSL but with a better explicit error on startup stating "hey set this flag probably"

Copy link
Contributor

@samwillis samwillis left a comment

Choose a reason for hiding this comment

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

Approved, but don't merge until there is a docs PR please.

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.

None yet

3 participants