Repository navigation
Field-level (column) permissions in the allowlist JSON (#3) - #4
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AYkdX5KFu9z9QH7uLgLSXG Signed-off-by: Claude <noreply@anthropic.com>
Allow entries may be { table, columns }. A column guard parses the query
and refuses unlisted columns, select *, unqualified columns and whole-row
expressions on restricted tables before any connection is opened. Config
is validated strictly and fails loudly.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AYkdX5KFu9z9QH7uLgLSXG
Signed-off-by: Claude <noreply@anthropic.com>
…ase (#3) Address review: refuse every unparseable query while column rules are active, refuse pg_stats and related relations, compare quoted identifiers as written, document limits. Record review feedback in the spec. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AYkdX5KFu9z9QH7uLgLSXG Signed-off-by: Claude <noreply@anthropic.com>
…gate (#3) Address second review: visit FROM-clause calls through the dynamic-SQL check, add AST-derived tables to the table gate, tidy docs. Record review feedback in the spec. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AYkdX5KFu9z9QH7uLgLSXG Signed-off-by: Claude <noreply@anthropic.com>
Address third review. Record feedback and a follow-up in the spec. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AYkdX5KFu9z9QH7uLgLSXG Signed-off-by: Claude <noreply@anthropic.com>
Owner
Author
|
Review leg: Aggy (AI review agent). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Simon · project thread
Closes #3
Before:
.pgr-agent.jsoncould only allow whole tables.After: an allow entry can be
{ "table": "memberships", "columns": ["id", "role"] }. Plain strings still allow every column. For an object entry, anything outsidecolumnsis refused before a connection is opened, with an error naming the column and the config file.What it does
{ table, columns }entries, in both the per-agent and working-directory files.src/column-guard.ts): parses the query and resolves columns through aliases, joins,USING, CTEs, subqueries,LATERALand set operations. Refuses unlisted columns,select *,m.*, unqualified columns, whole-row forms (to_jsonb(m), bare alias, cast), alias column lists, dynamic-SQL functions (including as FROM items),pg_stats*relations, and any query the parser cannot read while column rules are active.columns, wildcards and duplicate tables fail at load time naming the file and path.FROM(from interviews, secret_table), using the parser's view of FROM items. This applies to the table gate generally.How
Uses
pgsql-ast-parser(pure TS, new dependency) for the AST. Where a reference cannot be proven to be a permitted column, it is refused. Decisions, review feedback and responses are in.specs/3-column-level-allowlist/SPEC.md.Worth knowing
allowentries (for example42) or malformed JSON used to be tolerated silently (default-deny). They now exit 1 with an error naming the file. Existing tests that asserted the old behaviour were updated.bun run typecheckandbun testpass.🤖 Generated with Claude Code
https://claude.ai/code/session_01AYkdX5KFu9z9QH7uLgLSXG