Skip to content

fix: harden related-subquery policy enforcement - #28

Merged
kholdrex merged 89 commits into
masterfrom
refactor/extract-between-bind-collaborator
Aug 2, 2026
Merged

kholdrex merged 89 commits into
masterfrom
refactor/extract-between-bind-collaborator

Conversation

@kholdrex

@kholdrex kholdrex commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Summary

Hardens SQL policy enforcement so related-subquery authorization remains fail-closed across compiled and relation-converted queries. The change preserves the original BETWEEN bind cleanup while strengthening policy evidence, adapter-aware identifier handling, and SQL structure scanning against bypasses discovered during adversarial review.

Changes

  • extract the shared BETWEEN bind collaborator and preserve false-valued or legacy bind keys
  • issue opaque compiler policy contracts and reject direct or replayed policy-bearing queries without matching evidence
  • enforce explicit and policy-derived table/column allowlists across related EXISTS and NOT EXISTS occurrences
  • harden adapter-aware SQL scanning for quoted identifiers, PostgreSQL TABLE/ONLY, dynamic query functions, literals, comments, and derived-table bypasses
  • isolate query state by returning detached copies from public SQL, params, intent, and metrics readers
  • document policy-query lifecycle, configuration identity, and compatibility behavior
  • expand regression coverage across SQLite, PostgreSQL, and MySQL policy and scanner paths

Test plan

  • Full local test suite and style checks passed.
  • GitHub Actions package verification and the complete SQLite, PostgreSQL, and MySQL matrix pass on supported Ruby and Active Record versions.

@kholdrex kholdrex changed the title refactor: extract between bind collaborator fix: harden related-subquery policy enforcement Jul 5, 2026
kholdrex added 28 commits July 13, 2026 14:17
@kholdrex
kholdrex merged commit 5ff2b5c into master Aug 2, 2026
34 checks passed
@kholdrex
kholdrex deleted the refactor/extract-between-bind-collaborator branch August 2, 2026 18:31
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.

1 participant