Skip to content

pgvector: a USING (true) policy for the auditor is not a read gap - #19

Merged
xkimopro merged 1 commit into
Vecshield:mainfrom
nnbakirtzis:fix/pgvector-rls-admitted-auditor
Nov 21, 2026
Merged

xkimopro merged 1 commit into
Vecshield:mainfrom
nnbakirtzis:fix/pgvector-rls-admitted-auditor

Conversation

@nnbakirtzis

Copy link
Copy Markdown
Contributor

What this changes

docs/pgvector.md tells operators to admit the auditor with an RLS policy. But any table where row_security_active() held was reported as partly unread. As a result, about a dozen checks per table came back inconclusive ("content-read failures").

  • The catalog query also checks pg_policy for a permissive USING (true) policy that reaches the connecting role, with no restrictive policy narrowing it. The policy can reach the role directly, through membership, or via PUBLIC. Such a table is read in full and records row_security_admits_all.
  • Anything else is still a read gap, exactly as before.
  • docs/pgvector.md: the RLS trade-off section explains which policy counts.

How you verified it

  • ruff check .: clean
  • pytest -rs with VECSHIELD_PG_DSN pointing at PostgreSQL 17.12 / pgvector 0.8.7, so the live tests ran instead of skipping. Across tests/test_pgvector.py, test_pgvector_unit.py, test_pg_access_hardening.py, test_store_facts_selfhosted.py and test_isolation.py: 274 passed, 0 skipped.
  • Full suite, with this PR merged together with the five sibling pgvector PRs: 17 failed / 3 errors. These are the same Windows-only and flaky failures main shows on this machine (symlinks, /proc, webhook sockets, test_demo). No new failures.
  • npm test: console unchanged
  • benchmark: no detector changed
  • Audited a local lab of realistic pgvector layouts as a least-privileged auditor, before and after. The layouts were LangChain, LlamaIndex, RLS multi-tenant, partitioned halfvec, and a least-privilege control.

Tests added:

  • Unit: admitted means no gap; filtered still means a gap; the SQL shape; every column row must agree.
  • Live, as a non-superuser role: open is read in full; open plus a restrictive policy is a gap; tenant-only is a gap.

This is one of six independent pgvector PRs, all based on main (0041576). They merge cleanly with each other in any order.

Checklist

  • No route changed.
  • No check added or renamed.
  • No detector changed.
  • Nothing reports unknown coverage as a pass, and no partial read is reported as clean.
  • No secrets or real data: fixtures are synthetic.
  • No interface, security boundary or user-facing default changed.

docs/pgvector.md tells operators to admit the auditor with a row-security
policy, but any table where row_security_active() held was reported as
partly unread, leaving its classification, integrity and isolation checks
inconclusive. The catalog query now also asks pg_policy whether a permissive
USING (true) policy reaches the connecting role (directly, by membership, or
via PUBLIC) and no restrictive policy narrows it; such a table is read in
full and records row_security_admits_all. Anything else is still a gap.
@xkimopro
xkimopro merged commit 375d1c3 into Vecshield:main Nov 21, 2026
7 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.

2 participants