Repository navigation
pgvector: audit partitioned tables through the parent - #18
Merged
xkimopro merged 1 commit intoNov 21, 2026
Merged
Conversation
A partitioned table was skipped (relkind p) and each partition audited as a table of its own, without the parent's row security, so a BYPASSRLS retrieval role on a partitioned RLS table went unreported and per-tenant partitions looked single-tenant. The parent is now the collection, read as the application reads it, with its partitions named in metadata. Partitions are still tables to PostgreSQL: queried by name, only their own policies apply. New HIGH rule partition_bypasses_row_security reports a partition without row security, under an RLS parent, that the retrieval role or PUBLIC can SELECT (ddl-inherit.html).
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.
What this changes
Partitioned parents (relkind
p) were skipped, and each partition was audited as its own table, outside the parent's RLS. As a result:The changes:
metadata["partitions"]viapg_partition_tree(PG 12+), and the listing degrades gracefully without it.store_factsuses the same catalog filter.partition_bypasses_row_security: a partition with no RLS of its own, under an RLS parent, that the retrieval role or PUBLIC canSELECT.pg_hardening_rules.json.docs/pgvector.md: new section "Partitioned tables".How you verified it
ruff check .: cleanpytest -rswithVECSHIELD_PG_DSNpointing at PostgreSQL 17.12 / pgvector 0.8.7, so the live tests ran instead of skipping. Acrosstests/test_pgvector.py,test_pgvector_unit.py,test_pg_access_hardening.py,test_store_facts_selfhosted.pyandtest_isolation.py: 279 passed, 0 skipped.mainshows on this machine (symlinks,/proc, webhook sockets,test_demo). No new failures.npm test: console unchangedhalfvec, and a least-privilege control.Tests added:
pg_partition_tree; access-model partition facts; rule firing per partition (role or PUBLIC); skipped for privileged or assumed principals; rule registry.This is one of six independent pgvector PRs, all based on
main(0041576). They merge cleanly with each other in any order.Checklist
access_grantsgains a rule inside the existing check, so it can now fail where it used to pass.