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 user mismatch in postgres backend #12467

Merged
merged 7 commits into from
May 10, 2022
Merged

Fix user mismatch in postgres backend #12467

merged 7 commits into from
May 10, 2022

Conversation

jimbishopp
Copy link
Contributor

Always set the user field of the database connection string to the same user defined in the CommonName field of the client certificate.

The pgx library always includes a user field in the connection string and defaults to $USER. The database connection will fail when $USER is not the same as the value defined in the CommonName field of the client certificate.

Fixes: #12221

@jimbishopp jimbishopp requested review from r0mant and webvictim May 5, 2022 17:32
@github-actions github-actions bot requested a review from russjones May 5, 2022 17:32
@jimbishopp jimbishopp self-assigned this May 5, 2022
lib/backend/postgres/driver.go Show resolved Hide resolved
jimbishopp added 2 commits May 5, 2022 15:10
Always set the user field of the database connection string to the same
user defined in the CommonName field of the client certificate.

The pgx library always includes a user field in the connection string
and defaults to $USER. The database connection will fail when $USER is
not the same as the value defined in the CommonName field of the client
certificate.
@jimbishopp jimbishopp enabled auto-merge (squash) May 5, 2022 22:11
@jimbishopp jimbishopp requested a review from smallinsky May 9, 2022 14:21
Copy link
Collaborator

@zmb3 zmb3 left a comment

Choose a reason for hiding this comment

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

bot

@jimbishopp jimbishopp merged commit b96cff3 into master May 10, 2022
@github-actions
Copy link

@jimbishopp See the table below for backport results.

Branch Result
branch/v9 Create PR

@zmb3 zmb3 deleted the jim/pgfix branch April 26, 2023 21:31
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.

Postgres backend always uses system username to connect
5 participants