Skip to content

fix: derive per-role Postgres passwords from the shared RLS secret - #111

Merged
albertodonato merged 1 commit into
stacklet/integrationfrom
wgrant/fix/rls-secret
Oct 8, 2026
Merged

albertodonato merged 1 commit into
stacklet/integrationfrom
wgrant/fix/rls-secret

Conversation

@wgrant

@wgrant wgrant commented Oct 8, 2026

Copy link
Copy Markdown

what

Derive per-role Postgres passwords (PostgreSQL._gen_role_pass) from a new REDASH_RLS_SECRET setting instead of DATASOURCE_SECRET_KEY. If it is unset, raise a ValueError naming the variable rather than falling back to a key that would derive wrong passwords. DATASOURCE_SECRET_KEY (datasource encryption) and REDASH_COOKIE_SECRET are untouched.

why

Platform creates RLS roles with passwords derived from the shared RLS secret (/stacklet/<prefix>/rls/secret). Redash used DATASOURCE_SECRET_KEY, which can differ from it (it does on the ack deployment), so Redash could not log in as RLS roles. DATASOURCE_SECRET_KEY must keep its value because it decrypts stored datasource configs, so the RLS secret is a separate input. redash-infra supplies REDASH_RLS_SECRET from the shared secret.

testing

New unit tests in tests/query_runner/test_pg.py pin the derived password to the vector produced by platform's stacklet.shared.sql.rls.gen_role_pass (role sso_alice_at_example_com_a1b2c3, secret rls-test-secret), check that DATASOURCE_SECRET_KEY is ignored, and check that an unset secret raises. All tests in that file pass.

docs

None needed.

Role passwords were derived from DATASOURCE_SECRET_KEY, the key that also
encrypts stored data source options. Platform derives the same passwords
from the shared RLS secret, and on deployments where the two values
differ Redash cannot log in as an RLS role.

Read the secret from REDASH_RLS_SECRET instead and raise if it is unset,
rather than falling back to a key that would derive wrong passwords.
DATASOURCE_SECRET_KEY keeps encrypting data source options unchanged.
A test pins the derivation to the vector platform's gen_role_pass produces.

@albertodonato albertodonato left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

thanks @wgrant

@albertodonato
albertodonato merged commit aaacc31 into stacklet/integration Oct 8, 2026
3 checks passed
@albertodonato
albertodonato deleted the wgrant/fix/rls-secret branch October 8, 2026 13:44
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.

2 participants