PostgreSQL 17 — Safe SCRAM Password Provisioning for Custom Roles and Logging Redaction #52149
Replies: 4 comments
|
Hi, and thanks for raising this important security question. A few concrete points that may help you evaluate the risk:
If your environment allows it, consider adding a temporary SET log_statement = 'none';
ALTER ROLE my_role PASSWORD '...';
RESET log_statement;Note: I'd also recommend opening a support ticket with Supabase to confirm whether per-session GUC overrides are respected and whether there are any managed-environment constraints. Hope this helps with your security review. |
|
Here is an important technical clarification on PostgreSQL 17 and hosted Supabase permissions that corrects a critical limitation in the previous advice: 1. Crucial Gotcha:
|
|
Your concern about the verifier is valid. Client-side SCRAM hashing reduces plaintext exposure, but it does not meet a requirement that the verifier must also stay out of logs. One correction to the earlier advice: Upstream PostgreSQL also warns that SQL commands containing passwords can be exposed through statement logging. A client-generated verifier is still a literal in the submitted SQL. I would therefore keep the runtime roles disabled while you ask Supabase for a provisioning path that explicitly covers successful statements, failed statements, audit/diagnostic capture and pooler logs. A claim that Supavisor never records sensitive SQL needs a provider guarantee; I cannot establish that from your settings. Likewise, a temporary provisioning role does not erase statement text already captured elsewhere. If you evaluate a candidate, use a disposable project and synthetic credentials to inspect both success and failure cases. Do not test redaction using the intended production password or verifier. Such a test can validate observable logs, but cannot certify inaccessible internal logs. This is a limitation of the evidence available here, not proof that Supabase has no supported solution. I would not label the proposed client-hashing/direct-connection procedure “zero exposure” without that confirmation. |
|
Correction to the second reply: Without that, yes: Send each of these as a separate call, not one multi-statement string. Postgres logs a whole query string before running any of it. Supavisor vs direct doesn't change what Postgres logs. Redaction in Supabase's own log pipeline isn't documented, so get that in writing from support (https://www.postgresql.org/docs/17/runtime-config-logging.html). |
Uh oh!
There was an error while loading. Please reload this page.
Hello Supabase Community,
I am developing an Android application using
Supabase PostgreSQL, Cloudflare Workers and LiveKit.
We have successfully completed a production
PostgreSQL schema migration and created two
restricted custom runtime login roles.
Both roles currently have NULL passwords,
and the related application functionality
remains disabled.
We need a safe, officially supported method
to provision passwords for these roles.
Our PostgreSQL version is 17.11.
A read-only inspection confirmed:
log_statement = ddl
log_min_error_statement = error
password_encryption = scram-sha-256
pgaudit.log = none
log_destination = csvlog
logging_collector = on
We investigated libpq's PQchangePassword.
Although PQchangePassword hashes the password
client-side, it submits an ALTER USER/ROLE
statement containing a SCRAM verifier.
We consider SCRAM verifiers sensitive.
Our questions are:
Under Supabase's PostgreSQL logging
configuration, can successful ALTER ROLE
or ALTER USER password statements expose
SCRAM verifiers in logs?
Can failed password-change statements,
error logs or diagnostic logs expose them?
Does Supavisor session pooling introduce
additional logging exposure?
Would using a direct PostgreSQL connection
instead of Supavisor reduce this risk?
Does Supabase provide an officially
supported secure password provisioning
method for custom PostgreSQL roles?
Are there documented redaction guarantees
for database, audit, proxy and internal logs
covering both successful and failed operations?
Is there a safer supported alternative
that avoids verifier-bearing SQL statements
or minimizes their exposure?
We prefer not to modify the existing
production logging configuration.
We have not provisioned any passwords.
The operation remains blocked until a
suitable security approach is established.
Any official documentation, implementation
guidance or experience with this specific
Supabase/PostgreSQL configuration would
be appreciated.
Thank you.
All reactions