Conversation
Contributor
|
❗ By default, the pull request is configured to backport to all release branches.
|
Collaborator
Author
|
/test depth=push |
Contributor
|
@jsilvela, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/21868436248 |
Collaborator
Author
|
Manually tested. {"level":"info","ts":"2026-02-11T08:47:52.86477304Z","msg":"Triggered a managed role reconciliation",
"logger":"instance-manager","logging_pod":"cluster-example-with-roles-1",<- snip ->}
{"level":"info","ts":"2026-02-11T08:47:52.902391931Z",
"logger":"postgres","msg":"record",
"logging_pod":"cluster-example-with-roles-1",
"record":{
"log_time":"2026-02-11 08:47:52.902 UTC",
"user_name":"postgres","database_name":"postgres", <- snip ->,
"command_tag":"ALTER ROLE" <-snip->,
"error_severity":"ERROR","sql_state_code":"42704",
"message":"role \"dante\" does not exist","application_name":"cnpg-instance-manager",<- snip ->,
"query_id":"0"
}
}and in the Cluster CR's Status, we don't have any password leakage. ....
managedRolesStatus:
byStatus:
pending-reconciliation:
- dante
...
cannotReconcile:
dante:
- 'could not perform ALTER on role dante: role "dante" does not exist'The same is verified when ensuring errors by forcing CREATE when updating a role. |
Collaborator
Author
|
And testing on replica clusters, as per the original Issue, note the "query" field is absent: {"level":"info","ts":"2026-02-11T13:57:39.049732289Z",
"logger":"postgres","msg":"record","logging_pod":"cluster-replica-tls-1",
"record":{"log_time":"2026-02-11 13:57:39.049 UTC",
"user_name":"postgres","database_name":"postgres","process_id":"156","connection_from":"[local]",
"session_id":"698c8ad3.9c","session_line_num":"1",
"command_tag":"ALTER ROLE","session_start_time":"2026-02-11 13:57:39 UTC",
"virtual_transaction_id":"26/2","transaction_id":"0",
"error_severity":"ERROR",
"sql_state_code":"25006",
"message":"cannot execute ALTER ROLE in a read-only transaction",
"application_name":"cnpg-instance-manager","backend_type":"client backend",
"query_id":"0"}
} |
Member
|
promoting to |
armru
approved these changes
Feb 16, 2026
Signed-off-by: Jaime Silvela <[email protected]>
Signed-off-by: Jaime Silvela <[email protected]>
Signed-off-by: Jaime Silvela <[email protected]>
Signed-off-by: Jaime Silvela <[email protected]>
Signed-off-by: Jaime Silvela <[email protected]>
Signed-off-by: Jaime Silvela <[email protected]>
…_error_statement Fixed three issues: 1. SetUserPassword used db.Exec instead of tx.Exec, executing the ALTER ROLE outside the transaction and completely bypassing the SET LOCAL protection 2. Only log_min_error_statement was suppressed (error case), but log_statement (success case with ddl/mod/all) was not, leaving passwords exposed in normal statement logging 3. In Create(), the debug log was emitted after appending the password to the query, leaking it in application-level logs Signed-off-by: Armando Ruocco <[email protected]>
Signed-off-by: Marco Nenciarini <[email protected]>
Signed-off-by: Marco Nenciarini <[email protected]>
Signed-off-by: Marco Nenciarini <[email protected]>
mnencia
approved these changes
Feb 21, 2026
Signed-off-by: Marco Nenciarini <[email protected]>
cnpg-bot
pushed a commit
that referenced
this pull request
Feb 21, 2026
When PostgreSQL executes CREATE/ALTER ROLE with a cleartext password, it can log the password via log_statement and log_min_error_statement. Wrap password-carrying role statements in a transaction that suppresses logging with SET LOCAL, preventing leakage in both success and failure scenarios. Closes #9799 Signed-off-by: Jaime Silvela <[email protected]> Signed-off-by: Armando Ruocco <[email protected]> Signed-off-by: Marco Nenciarini <[email protected]> Co-authored-by: Armando Ruocco <[email protected]> Co-authored-by: Marco Nenciarini <[email protected]> (cherry picked from commit 983bc6b)
cnpg-bot
pushed a commit
that referenced
this pull request
Feb 21, 2026
When PostgreSQL executes CREATE/ALTER ROLE with a cleartext password, it can log the password via log_statement and log_min_error_statement. Wrap password-carrying role statements in a transaction that suppresses logging with SET LOCAL, preventing leakage in both success and failure scenarios. Closes #9799 Signed-off-by: Jaime Silvela <[email protected]> Signed-off-by: Armando Ruocco <[email protected]> Signed-off-by: Marco Nenciarini <[email protected]> Co-authored-by: Armando Ruocco <[email protected]> Co-authored-by: Marco Nenciarini <[email protected]> (cherry picked from commit 983bc6b)
cnpg-bot
pushed a commit
that referenced
this pull request
Feb 21, 2026
When PostgreSQL executes CREATE/ALTER ROLE with a cleartext password, it can log the password via log_statement and log_min_error_statement. Wrap password-carrying role statements in a transaction that suppresses logging with SET LOCAL, preventing leakage in both success and failure scenarios. Closes #9799 Signed-off-by: Jaime Silvela <[email protected]> Signed-off-by: Armando Ruocco <[email protected]> Signed-off-by: Marco Nenciarini <[email protected]> Co-authored-by: Armando Ruocco <[email protected]> Co-authored-by: Marco Nenciarini <[email protected]> (cherry picked from commit 983bc6b)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When PostgreSQL executes CREATE/ALTER ROLE with a cleartext password, it
can log the password via log_statement and log_min_error_statement. Wrap
password-carrying role statements in a transaction that suppresses
logging with SET LOCAL, preventing leakage in both success and failure
scenarios.
Closes #9799