feat: detect and protect if pg_grapqhl on#159
Closed
zsolt-p wants to merge 1 commit into
Closed
Conversation
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.
Added a WARN-level security lint that fires when both:
pg_graphql extension is installed (the /graphql/v1 endpoint exists), and
the anon role has SELECT on a user-schema table
For each matching table, the lint reports the schema/table and links to the
new doc page that walks through the full Introspection Lockdown Guide
(table-level revoke, blanket revoke, default-privileges fix, graphql.resolve
revoke, and authenticated re-grant pattern).
Files
lints/0026_pg_graphql_anon_table_exposed.sql — view in lint schema; uses
pg_catalog.has_table_privilege('anon', oid, 'SELECT') gated by an EXISTS
against pg_extension
docs/0026_pg_graphql_anon_table_exposed.md — full guide (rationale, options
1–3, example, verification, quick reference, false-positive note)
test/sql/0026_pg_graphql_anon_table_exposed.sql + test/expected/0026_…out —
baseline / negative (no extension) / positive (extension + anon SELECT) /
resolution (revoke)
bin/installcheck — added -f lints/0026*.sql
test/sql/queries_are_unionable.sql + expected — added new view to the union
check
splinter.sql — regenerated via bin/compile.py
Test result: All 25 tests passed. on supabase/postgres:15.1.1.13.