The user seeks guidance on securely provisioning PostgreSQL credentials without exposing plaintext passwords or verifiers in logs. They request clarification on supported procedures for creating and rotating custom LOGIN roles, and how logging channels handle sensitive information. They also inquire about temporary database access as an alternative.
The user seeks guidance on securely provisioning a restricted PostgreSQL LOGIN role in a staging environment without exposing credentials in logs. They require a method that maintains security logging and prevents plaintext passwords or SCRAM verifiers from being captured. They have paused provisioning until a supported procedure is confirmed by Supabase.
Thank you for clarifying the distinction between PostgreSQL password handling and hosted-platform logging. We understand that `psql \password` reduces plaintext password exposure but does not, by itself, establish that SCRAM verifier material is excluded from every relevant logging channel. Could you please provide a project-specific answer for our hosted PostgreSQL 17.11 staging environment? 1. Which supported procedure can we use to provision and rotate a restricted application LOGIN role while preventing both plaintext passwords and SCRAM verifiers from entering retained PostgreSQL statement/error logs, `pg_stat_statements`, pgAudit records, Supavisor diagnostics and Supabase platform logs, including failed operations? 2. What redaction or exclusion mechanism applies to each channel, and which deployed version provides that protection? 3. If Supabase cannot guarantee exclusion from any of these channels, please identify the uncovered channels and recommend a supported alternative. 4. Separately, can Supabase temporary database access be used by an unattended Railway application? Please clarify the required permissions, token handling and logging protections, expiry/revocation behaviour for existing pooled connections, and supported token renewal strategy. We intend to preserve security auditing and are not willing to disable necessary logging merely to provision credentials. We will keep provisioning paused until we can establish a supported approach that meets these requirements.
Thank you for the detailed explanation. Your response is helpful, particularly in distinguishing PostgreSQL statement logging, `pg_stat_statements`, pgAudit, Supavisor diagnostics, and temporary database access. I have reviewed your recommendations against the PostgreSQL 17 documentation and implementation, as well as the constraints of our Supabase-hosted staging environment. Before adopting either approach, I need to clarify a few security-critical points. **Our requirement is that neither the plaintext database password nor its SCRAM authentication verifier should be recorded in the relevant retained logs or diagnostic stores. We also need to preserve our existing security-audit logging rather than disable it simply to provision credentials.** Could you please clarify the following? **1. Provisioning a dedicated PostgreSQL LOGIN role** You recommended using `psql \password` as the cleanest method. I understand that it encrypts the password client-side before sending the password-change command, thereby protecting the plaintext password from exposure through command history and the server-side statement. However, the server receives an `ALTER ROLE` command containing the verifier. Our staging configuration reportedly retains `log_statement=ddl`. - Under this configuration, can the SCRAM verifier be recorded in PostgreSQL statement or error logs, including when an operation fails? - Does `pg_stat_statements` reliably normalize the verifier in this particular utility statement on PostgreSQL 17.11, or is that an assumption based on general query-normalization behaviour? - Does the deployed pgAudit implementation redact the verifier for the exact password-changing command, and is that behaviour guaranteed for the hosted version? - What evidence supports the claim that Supavisor and Supabase platform diagnostics do not retain the verifier or other authentication material? Please distinguish protection of the plaintext password from protection of the verifier. I am not looking to disable necessary auditing or rely on a statement simply succeeding rather than failing. **2. Supabase temporary database access** You also suggested token-based temporary access as an alternative to a persistent database password. Could you clarify: - Whether this method is officially supported for an unattended application running on Railway, rather than only interactive or operator-driven access. - The minimum permissions and database-role mapping required for the application. - Whether the token can appear in PostgreSQL, Supavisor, platform, application, or failure diagnostics, and what redaction protections apply before storage. - How token expiry and revocation affect existing pooled connections and how the application is expected to renew credentials without downtime. I understand that temporary access can avoid setting a persistent database password through role DDL. However, that alone does not establish that the token is protected from every relevant logging channel or that the application can use it reliably. **3. Practical, supported recommendation** For our hosted PostgreSQL 17.11 staging project, with `log_statement=ddl` and security auditing preserved, which supported method would you recommend to provision and rotate a restricted application LOGIN role while preventing both plaintext passwords and SCRAM verifiers from entering relevant retained logs and diagnostics? Please identify the applicable redaction mechanism, the version to which it applies, and whether protection occurs before the data is stored. If any logging channel is not covered or cannot be verified, please state that limitation explicitly. I appreciate your help. I am trying to establish a defensible, supportable approach before provisioning credentials or enabling customer authentication in staging.