Skip to content

feat(postgres): inject and pin per-upstream session settings#189

Merged
mslipper merged 1 commit into
mainfrom
feat/postgres-session-settings
Jun 11, 2026
Merged

feat(postgres): inject and pin per-upstream session settings#189
mslipper merged 1 commit into
mainfrom
feat/postgres-session-settings

Conversation

@mslipper

Copy link
Copy Markdown
Contributor

Generalizes the existing single SET ROLE injection into a list of session variables (GUCs) the proxy SETs at session start, so an upstream can carry context like centaur.slack_channel_id = 'C123' for RLS policies to key off.

Settings are applied via set_config (bound params, no value quoting) before the SET ROLE downgrade, and the proxy pins them: clients may not SET / RESET / set_config a pinned name afterwards. The SQL classifier now reports every GUC a statement writes (not just role), and the relay rejects writes to pinned names. This also closes a latent gap in the role pin: RESET ALL / DISCARD ALL reset the managed role and were not previously blocked; they are now rejected whenever the proxy manages a role or settings.

Settings flow through both the YAML config and the control-plane sync path, with name validation (dotted GUC identifiers; role and session_authorization reserved). Values are static per-upstream.

Generalize the single SET ROLE injection into a list of session
variables (GUCs) the proxy SETs at session start, so an upstream can
carry context like `centaur.slack_channel_id = 'C123'` for RLS.

Settings are applied via set_config before the SET ROLE downgrade, and
the proxy pins them: clients may not SET / RESET / set_config a pinned
name afterwards. The SQL classifier now reports every GUC a statement
writes (not just role), and the relay rejects writes to pinned names.

This also closes a latent gap in the role pin: RESET ALL / DISCARD ALL
reset the managed role and were not previously blocked. They are now
rejected whenever the proxy manages a role or settings.

Settings flow through both the YAML config and the control-plane sync
path, with name validation (dotted GUC identifiers; role and
session_authorization reserved).
@mslipper mslipper merged commit 76f8203 into main Jun 11, 2026
6 checks passed
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.

1 participant