You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 983bc6b
Browse filesBrowse the repository at this point in the historyBrowse files
authored
fix(roles): prevent postgres from leaking role passwords in logs (cloudnative-pg#9950)
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.
Closescloudnative-pg#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]>
While role passwords are safely managed in Kubernetes using Secrets,
185
+
there is still a risk on the PostgreSQL side. If creating/altering a role with
186
+
password, PostgreSQL may print the password as part of the query statement
187
+
in some `postgres` logs, as mentioned in the [PostgreSQL documentation](https://www.postgresql.org/docs/current/sql-createrole.html):
188
+
189
+
> The password will be transmitted to the server in cleartext, and it might
190
+
> also be logged in the client's command history or the server log
191
+
192
+
CloudNativePG adds a safety layer by temporarily suppressing both statement
193
+
logging (`log_statement`) and error statement logging
194
+
(`log_min_error_statement`) for any CREATE or ALTER operation on a role with
195
+
password, thus preventing leakage in both success and failure scenarios.
196
+
The Status section of the cluster does not print the query statement for any
197
+
managed role operation.
198
+
182
199
## Unrealizable role configurations
183
200
184
201
In PostgreSQL, in some cases, commands cannot be honored by the database and
Copy file name to clipboardExpand all lines: docs/src/security.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -592,6 +592,14 @@ versions it is set to `md5`.
592
592
`postgres`user to `NULL` (de facto disabling remote access through password authentication).
593
593
:::
594
594
595
+
:::info[Important]
596
+
PostgreSQL may include cleartext role passwords in its logs for some role
597
+
operations, as mentioned in the [PostgreSQL documentation](https://www.postgresql.org/docs/current/sql-createrole.html).
598
+
CloudNativePG ensures that `postgres` logging (both statement logging and
599
+
error statement logging) is temporarily suppressed for CREATE/ALTER ROLE
600
+
operations with passwords, thus preventing any password leakage.
601
+
:::
602
+
595
603
See the ["Secrets" section in the "Connecting from an application" page](applications.md#secrets) for more information.
596
604
597
605
You can use those files to configure application access to the database.
0 commit comments