-
Notifications
You must be signed in to change notification settings - Fork 13
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
DEVOPS-30643: adds pgbouncer config to set the role before running SQL commands. #391
Conversation
leandrorichardtoledo
commented
Jan 14, 2025
- This adds the server_reset_query configuration to pgbouncer.ini file to allow the queries to be executed with the role (spire-user) and not the user (spire-user_a);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any test you can add to verify the role permission behavior?
dbproxy/pgbouncer/config.go
Outdated
@@ -156,6 +96,9 @@ func parseURI(c *PGBouncerConfig, dsn string) error { | |||
return fmt.Errorf("invalid_scheme: %s", u.Scheme) | |||
} | |||
|
|||
// Remove the _<a|b> suffix from the username. | |||
c.RoleName = strings.Split(u.User.Username(), "_")[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we be more explicit here and pass in the exact role name ?
We don't prevent developers from putting _ in their username and then this parsing would fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed the change.
I ran the test I described in the ticket DEVOPS-30643; |
Co-authored-by: Drew Wells <dwells@infoblox.com>