SQLPermit

Deterministic PostgreSQL statement policy checks with a signed, statement-bound execution permit.

SQLPermit parses a candidate statement with PostgreSQL's own grammar (libpg-query, PG 18), walks the syntax tree, and reports whether it complies with the policy you supply — read-only, schema and table allowlists, row ceilings, a function allowlist, single-statement enforcement. Detection is structural, so comments, dollar quoting, Unicode escapes, and stacked statements cannot hide a construct from it. On a compliant statement it can issue a signed Ed25519 permit, valid for seconds, bound to the sha256 of the deparsed canonical statement so it cannot be moved onto a different one. An offline reference verifier is published for your executor. What it cannot do: it never connects to your database, so it cannot see your schema, cannot resolve search_path, and cannot know the role a statement will run as. It is defence in depth alongside a least-privilege database role, not a replacement for one.

Endpoints

RouteWhat it doesPrice
POST /v1/guard/sqlCheck a PostgreSQL statement against an execution policy and optionally issue a signed permit$0.01

Call it

Send the request unpaid to see the live quote. You get HTTP 402 and a PAYMENT-REQUIRED header.

curl -i -sS -X POST https://sqlpermit.schemasure.com/v1/guard/sql \
  -H 'content-type: application/json' \
  -d '{"dialect":"postgresql","target_pg_major":18,"sql":"SELECT id, total FROM analytics.orders ORDER BY created_at DESC LIMIT 100","policy":{"read_only":true,"allowed_schemas":["analytics"],"allowed_tables":["analytics.orders"],"max_rows":1000,"allowed_functions":["count","sum","avg"],"allow_multi_statement":false},"audience":"executor:acme-prod-01","issue_permit":true}'

Payment

Honest uncertainty

Every response carries a verdict. When this service cannot determine an answer it returns unknown with evidence explaining why. It never reports an undetermined result as a clean one.

For agents