## Verify it yourself Each guarantee in this README has a test that attacks it on purpose and checks the database from a superuser's side -- not the gate's own answer: ``` make verify PG_CONFIG=/path/to/pg_config # your PostgreSQL 18+, a throwaway cluster make clean-machine # the same, in a fresh container that only gets git HEAD ``` | suite | what it attacks | checks | |---|---|---| | `adversarial.sh` | every channel a session can type, and what can be slipped past `propose` | 59 | | `hostile.sh` | garbage into the verbs, the record rewritten, the world moved between propose and commit | 40 | | `privileges.sh` | the privilege boundary between agents, roles and the record | 31 | | `rls_isolation.sh` | moving the context a row-level policy reads: `SET`, startup parameters, `set_config` | 22 | | `dump_restore.sh` | the record across `pg_dump` and restore | 10 | | `upgrade.sh` | an installation of the oldest schema, upgraded | 13 | | `flushes.sh` | the WAL flushes each act pays against its durability | 8 | | `plan_time.sh` | what runs while the gate verifies and plans | 45 | | `pg_temp.sh` | a temporary catalog of the agent hiding what a write sets off; an assertion's path left in the session | 18 | | `rollback.sh` | what a rollback takes from the record | 12 | | `audit3.sh` | the third audit: fast-path, the gate's path, foreign proposals, DDL, roles, 2PC, dump | 18 | | `audit4.sh` | the rest of it: settings between dry_run and commit, side effects of a read, a reused name, record size | 18 | | `isolation.sh` | one proposal committed twice under REPEATABLE READ / SERIALIZABLE | 5 | | `session_preload.sh` | a client parameter taking a per-session load out from behind the gate | 4 | | `approvals.sh` | an agent that needs an approver committing its own proposal | 7 | | `budget.sh` | a write split into slices that each fit `max_rows` (0.4.0) | 21 | | `membership.sh` | another role becoming the agent with `SET ROLE` (0.4.1) | 16 | | `audit5.sh` | SQL passed as text, `CREATE TABLE AS` over a writing CTE, functions the agent can alter or with a `SET` clause (0.4.3) | 44 | | `audit6.sh` | code the tree does not show: a range type's support function, a domain's `CHECK`, an aggregate, a DDL's `DEFAULT`; large objects; a foreign key over `citext` (0.4.3) | 44 | | `audit7.sh` | a verb's parameter of an agent's domain, a temporary table under a DBA's helper, a `DROP ... CASCADE` or `ALTER TYPE` reaching a DBA's table, a read that ends another session, code handed to a `NOINHERIT` role; and a module's `SET` parameter, an event trigger, `MERGE`, `lo_get()`, intagg, `serial` (0.4.3) | 58 | | `audit8.sh` | an extension's C function in an agent's domain `CHECK`, `CREATE OR REPLACE FUNCTION` under a DBA's index, an index or `DETACH` reaching a DBA's partition; a `varchar[]` argument, a read-only transaction (0.4.3) | 43 | | `audit9.sh` | a volatile function in a DBA's column `DEFAULT`, an `UPDATE` that moves rows between partitions, a pool's `DISCARD ALL` (0.4.3) | 44 | | pgrx unit tests | the verbs, from inside the server | 13 | For 0.4.4, whose code is 0.4.3's, the CI of 2026-11-23 ([run 45242582748](https://github.com/Manuelreyesbravo/pg_agent_gate/actions/runs/45242582748)): **592 checks passed, 0 failed** on PostgreSQL 18.7 and on 19.0, the first release of 19: 579 of the suites above and the 13 pgrx unit tests, with one case not run on each (a case of `audit7.sh` needs pgvector, which the CI container does not have). A case whose module is missing does not run, and `make verify` says so in its summary ("N passed, 0 failed, M skipped"). That CI is a fresh Debian container receiving only what git has committed, with 18 and 19 from PGDG; it runs on every push and every Monday. Before that, 0.4.3 was measured locally: 580 passed, 0 failed on 18.6 with its contrib modules and pgvector, and 578 on 19beta2 and again 19rc1 (2026-11-12), whose builds had no pgcrypto for two of `audit9.sh`'s checks. `VERIFY_DRIVERS=1` adds real pgjdbc and node-pg sessions. Those are the hand-written suites above. The amplification class that `0.2.2` and `0.2.3` closed -- a writing CTE, a cascading foreign key, a trigger, a rule, an opaque (volatile or `SECURITY DEFINER`) function, and the commit-time row-count backstop and per-agent allow-list that back them -- is guarded by **`make fuzz`**, not by `make verify`. Its teeth build each of those and assert the gate refuses or aborts it (and that `discover` says the same thing `propose` does, through the one shared function), and a `k=1..8` differential oracle checks `max_rows` against the row count a superuser actually measures. `make fuzz` also throws generated and mutated adversarial SQL at the gate and checks, from a superuser's side: nothing the agent runs directly changes the database, and every proposal the gate *accepts*, once **committed**, leaves the catalog, the role and another tenant untouched and stays within `max_rows` -- the surface the two 0.2.1 bugs lived on. Two teeth checks run first so neither half can pass vacuously (a known change must move the fingerprint; `propose` must refuse a known `DROP` and `GRANT`), and run against the `v0.2.0` tag the fuzzer reports the historical `set_config` hole. **CI runs `FUZZ_ITERS=0 make fuzz` -- the teeth and the oracle, no generation -- on every push, in the required `end-to-end` job**; the generative fuzz (`FUZZ_ITERS` > 0) runs weekly. Each tooth asserts WHICH check refuses a statement (via `failed_check`), not merely that one did, so it cannot pass unless the right check fired -- a refusal by a parse error or a missing privilege does not count. That is the structural guard against a vacuous pass. As a spot negative control (measured 2026-10-08), disabling `no_amplification` turns `FUZZ_ITERS=0` red: 9 checks fail (the cascade and trigger teeth, the allow-list breach checks, the discover/propose parity). `tests/fuzz.py` says plainly what it does and does not catch. Two of these suites were green while a hole was open: see [what found the 0.2.1 fixes](measurements.md#what-found-the-021-fixes). A green suite is a claim about the cases it has, which is why the threat model below says what is not covered.