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
8000
switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Field-level (column) permissions in the allowlist JSON #3
The per-agent / per-project allowlist (.pgr-agent.json) only controls access by table. Add optional field (column) level permissions in the same file, so a caller can be allowed a table but only some of its columns.
Why
Today the only ways to hide a sensitive column are to create a database view that leaves it out and allow the view, or to grant the database role only some columns, which applies to every caller of that role rather than one agent. A per-caller column allowlist in the config would make "this agent may read clients but not the email column" a one-line change.
Proposal
Keep the existing shape working and allow an object form for a table:
A plain string entry keeps today's meaning (all columns).
With columns set, queries that reference any other column of that table (including select *, which would expand to all columns) are rejected before they run, with a denial message that names the column and the config file.
Default-deny stays: a column not listed is denied.
Things to decide
Parsing: the current guard works on table names. Column checks need the guard to resolve which table each column belongs to, including aliases, joins, CTEs and subqueries. A conservative first version could reject select * and unqualified columns on any table that has a column list.
Expressions that read a restricted column indirectly (functions over a whole row, to_jsonb(t)) need rejecting.
Config validation: unknown shapes should fail loudly, not silently allow.
Tests: aliases, joins, CTEs, select *, row-to-json, and the string-entry backward compatibility.
Not in scope
Row-level filtering (the role bypasses RLS by design; a per-caller tenant filter is a separate question).
Activity
Fail closed on unparseable SQL, refuse stats views, keep identifier c…
Check functions in FROM, see comma-separated FROM items in the table …
Refuse ts_rewrite as dynamic SQL (#3)
Field-level (column) permissions in the allowlist JSON (#3) (#4)