-
Notifications
You must be signed in to change notification settings - Fork 456
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
[auth_dbname] introduce auto-registration option in case auto-database is configured #921
[auth_dbname] introduce auto-registration option in case auto-database is configured #921
Conversation
We discussed this topic when the I cannot imagine strong arguments to allow such option. You generally create some objects (table, view, function) to centralized the authentication into one specific database. This proposal is against this idea; indeed, it is similar to the pre-auth_dbname (create objects in multiple databases). What happen if you create a new database and forget to create the authentication objects? I'm also concerned about security. If you have a credentials table in database A and in database B but you shouldn't use that table from database B. Depending on your setup, you might allow access to it. |
Users are still required to configure their authentication databases manually, whether it is through setting "global" or per database. This change lifts the requirement where auth_dbname needs to be an entry under In terms of security, I do not think this PR poses any other risk than what already exists. Because: 1-> We enforce you to configure Please let me know if you can think of other potentially issues, would be happy to learn. Edit: I've updated the title as this might be misleading to other discussion where we discussed fallback option to client's database when |
@eulerto So to be clear, this idea in this PR is quite different from the one discussed in that comment (afaict from my memory and re-reading the comment). The type of config that we decided to disallow there was: [databases]
mydb = dbname=mydb host=localhost
[pgbouncer]
auth_dbname=postgres The initial version of #764 would then fall back to using The type of config that this PR intends to support instead is: [databases]
* = host=localhost
[pgbouncer]
auth_dbname=postgres And I think it makes sense to allow this type of config. We'd still connect to the postgres database. But instead of requiring a dedicated connection string to connect to it, we can generate the connection string using the wildcard connection string. |
When the database section has an auto-database, '*', the expected behavior for login experience to have client's database registered when not found. However, this experience would be blocked if we configure auth_dbname. This PR makes already existing function, find_or_register_database, public and uses it from various places to simplify code.
Make sure that the client's DB is not the same as the authdb. Othwerise, we would auto-register it during client's flow, missing the point of the test.
This commit ensures that we will not be exposed to potential regression that may surface by editing the test.ini configuration file.
5c33548
to
57e51ca
Compare
This commit rebases and drops the changes that was introduced previously where one of the test was removed. The change this commit introduces to the new test is to remove redundant steps, and instead have one sanity check after failure.
6ce8917
to
49048a2
Compare
I misunderstood the proposal because the description wasn't clear enough. I'm fine with this proposal. |
When the database section has an auto-database, '*', the expected behavior for login experience to have client's database registered when not found. However, this experience would be blocked if we configure
auth_dbname
to fall to auto-database. Hence, the main goal of this PR is to ensure thatauth_dbname
can still function on cases where it is not configured, but auto-database is provided.To achieve that, this PR makes already existing function, find_or_register_database, public and uses it from various places to simplify code.
Edit:
Quoting the targeted use case of this change from @JelteF 's comment, which makes the change more presentable:
Where, we will use
auth_dbname=postgres
with auto-registered database's connection string.