Decide whether an agent-authored PostgreSQL statement complies with an execution policy, u
Decide whether an agent-authored PostgreSQL statement complies with an execution policy, using PostgreSQL's own parser rather than pattern matching. Detects statement stacking, data-modifying CTEs, COPY PROGRAM, privilege changes, and dangerous functions that read as ordinary SELECTs. Returns reason codes and an optional short-lived signed permit bound to the exact normalized statement. Never connects to your database.
10000 (raw units)
price
36
calls / 30d
6
unique payers
2026-09-18
updated
Provider
sqlpermit.schemasure.com · discovered, not yet claimed by its owner
Payment (x402 accepts[])
[
{
"scheme": "exact",
"network": "eip155:8453",
"payTo": "0x9876af0F6D8Ed5155Cd02d1ca56D128601612690",
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"amount": "10000",
"maxTimeoutSeconds": 60
}
]Output schema
{
"bazaar": {
"info": {
"input": {
"body": {
"audience": "executor:acme-prod-01",
"dialect": "postgresql",
"issue_permit": true,
"policy": {
"allow_multi_statement": false,
"allowed_functions": [
"count",
"sum",
"avg"
],
"allowed_schemas": [
"analytics"
],
"allowed_tables": [
"analytics.orders"
],
"max_rows": 1000,
"read_only": true
},
"sql": "SELECT id, total FROM analytics.orders ORDER BY created_at DESC LIMIT 100",
"target_pg_major": 18
},
"bodyType": "json",
"method": "POST",
"type": "http"
},
"output": {
"example": {
"confidence": 1,
"data_versions": {
"grammar": "pg18/[email protected]",
"parser": "[email protected]",
"pg_parse_version": "180004"
},
"evidence": [],
"ok": true,
"policy_version": "sqlpermit-policy-1.0.0",
"request_hash": "sha256:1c2d0f4c1d8e2b7a9c5d3e6f8a1b2c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b",
"result": {
"classification": "read_only",
"findings": [],
"grammar": "pg18/[email protected]",
"normalized_sql": "SELECT id, total FROM analytics.orders ORDER BY created_at DESC LIMIT 100",
"obligations": {
"max_rows": 1000,
"require_read_only_tx": true,
"statement_timeout_ms": 30000
},
"permit": "eyJhbGciOiJFZDI1NTE5Iiwia2lkIjoi…",
"permit_expires_at": "2026-08-03T12:00:45.000Z",
"permit_kid": "uGzLTTwi4LTsOiBLgwf2wMU7ILTecj18Y_71Y37bVD8",
"policy_hash": "sha256:2b7a9c5d3e6f8a1b2c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d0f4c1d8e",
"referenced_functions": [],
"referenced_schemas": [
"analytics"
],
"referenced_tables": [
"analytics.orders"
],
"statement_count": 1,
"statement_types": [
"SelectStmt"
],
"stmt_fingerprint": "a1b2c3d4e5f60718",
"stmt_hash": "sha256:0f4c1d8e2b7a9c5d3e6f8a1b2c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d",
"target_pg_major": 18
},
"risk_codes": [],
"verdict": "pass",
"warnings": [
"stmt_fingerprint is ADVISORY and must not be used for authorization: libpg-query fingerprints discard literal constants, so two statements differing only in a value share one fingerprint. stmt_hash is the binding value."
]
},
"type": "json"
}
},
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"input": {
"additionalProperties": false,
"properties": {
"body": {
"additionalProperties": false,
"properties": {
"audience": {
"description": "Identity of the ONE executor the permit is for. Required when issue_permit is true. Wildcards are rejected.",
"type": "string"
},
"dialect": {
"enum": [
"postgresql"
],
"type": "string"
},
"issue_permit": {
"type": "boolean"
},
"policy": {
"additionalProperties": false,
"properties": {
"allow_multi_statement": {
"description": "Permit more than one statement in the input. Defaults to false.",
"type": "boolean"
},
"allow_returning": {
"description": "Accept RETURNING on a permitted write without a warning.",
"type": "boolean"
},
"allow_row_locks": {
"description": "Accept SELECT ... FOR UPDATE without a warning.",
"type": "boolean"
},
"allowed_functions": {
"description": "Added to the built-in allowlist. Bare name, or schema.function to admit one of your own.",
"items": {
"type": "string"
},
"type": "array"
},
"allowed_languages": {
"description": "Permitted CREATE FUNCTION languages. Defaults to none.",
"items": {
"type": "string"
},
"type": "array"
},
"allowed_schemas": {
"description": "Schemas the statement may reference.",
"items": {
"type": "string"
},
"type": "array"
},
"allowed_tables": {
"description": "Permitted relations as schema.table, or a bare name to match an unqualified reference.",
"items": {
"type": "string"
},
"type": "array"
},
"max_rows": {
"description": "Row ceiling. Becomes a permit obligation the executor enforces.",
"minimum": 1,
"type": "integer"
},
"read_only": {
"description": "Reject anything that can change data or schema, including writes reached through a CTE.",
"type": "boolean"
},
"statement_timeout_ms": {
"description": "Timeout written into the permit obligations. Defaults to 30000.",
"minimum": 1,
"type": "integer"
}
},
"type": "object"
},
"sql": {
"maxLength": 100000,
"minLength": 1,
"type": "string"
},
"subject": {
"description": "Opaque caller label recorded as the permit subject.",
"type": "string"
},
"target_pg_major": {
"description": "Required. The PostgreSQL major the statement will run on. Only 18 is supported in v1: a permit issued under one grammar and verified against another is a parser differential.",
"enum": [
18
],
"type": "integer"
}
},
"required": [
"dialect",
"target_pg_major",
"sql"
],
"type": "object"
},
"bodyType": {
"enum": [
"json",
"form-data",
"text"
],
"type": "string"
},
"method": {
"enum": [
"POST"
],
"type": "string"
},
"type": {
"const": "http",
"type": "string"
}
},
"required": [
"type",
"method",
"bodyType",
"body"
],
"type": "object"
},
"output": {
"properties": {
"example": {
"properties": {
"confidence": {
"type": "number"
},
"data_versions": {
"type": "object"
},
"evidence": {
"items": {
"properties": {
"code": {
"description": "Stable reason code, e.g. DATA_MODIFYING_CTE.",
"type": "string"
},
"data": {
"type": "object"
},
"detail": {
"type": "string"
},
"disposition": {
"enum": [
"block",
"warn",
"info"
],
"type": "string"
},
"severity": {
"enum": [
"info",
"low",
"medium",
"high",
"critical"
],
"type": "string"
},
"source": {
"type": "string"
},
"span": {
"properties": {
"end": {
"type": "integer"
},
"start": {
"type": "integer"
}
},
"type": "object"
}
},
"required": [
"code",
"severity",
"detail",
"disposition"
],
"type": "object"
},
"type": "array"
},
"ok": {
"type": "boolean"
},
"policy_version": {
"type": "string"
},
"request_hash": {
"type": "string"
},
"result": {
"properties": {
"classification": {
"enum": [
"read_only",
"write",
"ddl",
"mixed"
],
"type": "string"
},
"findings": {
"items": {
"properties": {
"code": {
"description": "Stable reason code, e.g. DATA_MODIFYING_CTE.",
"type": "string"
},
"data": {
"type": "object"
},
"detail": {
"type": "string"
},
"disposition": {
"enum": [
"block",
"warn",
"info"
],
"type": "string"
},
"severity": {
"enum": [
"info",
"low",
"medium",
"high",
"critical"
],
"type": "string"
},
"source": {
"type": "string"
},
"span": {
"properties": {
"end": {
"type": "integer"
},
"start": {
"type": "integer"
}
},
"type": "object"
}
},
"required": [
"code",
"severity",
"detail",
"disposition"
],
"type": "object"
},
"type": "array"
},
"grammar": {
"type": "string"
},
"normalized_sql": {
"description": "Deparsed canonical statement. This, not your original text, is what a permit binds.",
"type": "string"
},
"obligations": {
"properties": {
"max_rows": {
"type": [
"integer",
"null"
]
},
"require_read_only_tx": {
"type": "boolean"
},
"statement_timeout_ms": {
"type": "integer"
}
},
"required": [
"max_rows",
"statement_timeout_ms",
"require_read_only_tx"
],
"type": "object"
},
"permit": {
"description": "Compact JWS. Present only when requested and the verdict is not block.",
"type": "string"
},
"permit_expires_at": {
"type": "string"
},
"permit_kid": {
"type": "string"
},
"policy_hash": {
"type": "string"
},
"referenced_functions": {
"items": {
"type": "string"
},
"type": "array"
},
"referenced_schemas": {
"items": {
"type": "string"
},
"type": "array"
},
"referenced_tables": {
"items": {
"type": "string"
},
"type": "array"
},
"statement_count": {
"type": "integer"
},
"statement_types": {
"items": {
"type": "string"
},
"type": "array"
},
"stmt_fingerprint": {
"description": "ADVISORY ONLY — never authorize on this. libpg-query fingerprints discard literal constants, so 'WHERE id = 1' and 'WHERE id = 999999' share one fingerprint.",
"type": "string"
},
"stmt_hash": {
"description": "BINDING. sha256 of normalized_sql. The executor recomputes this from the statement it is about to run.",
"type": "string"
},
"target_pg_major": {
"type": "integer"
}
},
"required": [
"statement_count",
"statement_types",
"referenced_schemas",
"referenced_tables",
"referenced_functions",
"classification",
"findings",
"normalized_sql",
"stmt_hash",
"stmt_fingerprint",
"policy_hash",
"grammar",
"target_pg_major",
"obligations"
],
"type": "object"
},
"risk_codes": {
"items": {
"type": "string"
},
"type": "array"
},
"verdict": {
"enum": [
"pass",
"warn",
"block"
],
"type": "string"
},
"warnings": {
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"ok",
"verdict",
"confidence",
"risk_codes",
"evidence",
"result",
"policy_version",
"request_hash",
"data_versions",
"warnings"
],
"type": "object"
},
"type": {
"type": "string"
}
},
"required": [
"type"
],
"type": "object"
}
},
"required": [
"input"
],
"type": "object"
}
}
}Use it
curl
curl "https://sqlpermit.schemasure.com/v1/guard/sql" # -> 402 Payment Required, accepts[] lists how to pay # retry with a PAYMENT-SIGNATURE (or PAYMENT header) once paid
JavaScript
const res = await fetch("https://sqlpermit.schemasure.com/v1/guard/sql");
if (res.status === 402) {
const { accepts } = await res.json();
// pay one of accepts[] via an x402 client, then retry with the payment header
}Python
import httpx
res = httpx.get("https://sqlpermit.schemasure.com/v1/guard/sql")
if res.status_code == 402:
accepts = res.json()["accepts"]
# pay one of accepts[] via an x402 client, then retry with the payment headerMachine-readable
Everything on this page is also available as clean JSON at /resources/1477.json, and this resource appears in /discovery/resources and /discovery/search.