Decide whether an agent-authored PostgreSQL statement complies with an execution policy…
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…
by sqlpermit.schemasure.com · discovered, not yet claimed by its owner · updated 2026-10-11
Mirrored from Coinbase's public x402 Bazaar. The description is the provider's own text and has not been reviewed here; the payment requirements are copied as published.
What it does
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.
Tags: sql · postgresql · policy · guard · read-only · bazaar
Call contract
- Method
- POST
- Input
- json
- Output
- json
- Last paid call
- 2026-10-11
{
"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
}{
"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."
]
}Use with an agent
- Discover. Agents find this listing with
GET https://bazaar.saylorinnovations.com/discovery/search?query=…, the MCP toolsearch_resources, or/discovery/resources. - Inspect. Fetch
/resources/26949.jsonfor the price and payment options. - Pay. Call
GET https://sqlpermit.schemasure.com/v1/guard/sql. The provider answers402with its payment requirements. An x402 client signs one of the options below and retries withPAYMENT-SIGNATURE. - Execute. The provider returns
200with the data. Agent Bazaar is not in the request path and never sees your payment.
For humans
You don't need an account or an API key; you need a wallet holding a small amount of USDC on Base, and an x402-capable client (see the examples below). Call the endpoint unpaid first to see exactly what it asks for.
Pricing & payment
- Price
- $0.02 / request
- Protocol
- x402 v2
- Auth
- No account or API key. Pay per request.
- Networks
- Base
- Demand
- 37 calls · 6 unique payers in 30d (public x402 Bazaar data)
x402 payment requirements
| Scheme | Network | Asset | Amount | Pay to | Timeout |
|---|---|---|---|---|---|
| exact | Base eip155:8453 | USDC | $0.02 | 0x9876af0F6D8Ed5155Cd02d1ca56D128601612690 | 60s |
accepts[] (raw JSON)
[
{
"scheme": "exact",
"network": "eip155:8453",
"payTo": "0x9876af0F6D8Ed5155Cd02d1ca56D128601612690",
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"amount": "20000",
"amountUsd": 0.02,
"maxTimeoutSeconds": 60
}
]Schemas
Output schema (JSON Schema)
{
"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"
}Example shape — generated from the schema, not a captured live response
{
"example": {
"confidence": 0,
"data_versions": {},
"evidence": [
{
"code": "string",
"data": {},
"detail": "string",
"disposition": "block",
"severity": "info",
"source": "string",
"span": {
"end": 0,
"start": 0
}
}
],
"ok": true,
"policy_version": "string",
"request_hash": "string",
"result": {
"classification": "read_only",
"findings": [
{
"code": "string",
"data": {},
"detail": "string",
"disposition": "block",
"severity": "info",
"source": "string",
"span": {
"end": 0,
"start": 0
}
}
],
"grammar": "string",
"normalized_sql": "string",
"obligations": {
"max_rows": 0,
"require_read_only_tx": true,
"statement_timeout_ms": 0
},
"permit": "string",
"permit_expires_at": "string",
"permit_kid": "string",
"policy_hash": "string",
"referenced_functions": [
"string"
],
"referenced_schemas": [
"string"
],
"referenced_tables": [
"string"
],
"statement_count": 0,
"statement_types": [
"string"
],
"stmt_fingerprint": "string",
"stmt_hash": "string",
"target_pg_major": 0
},
"risk_codes": [
"string"
],
"verdict": "pass",
"warnings": [
"string"
]
},
"type": "string"
}Examples
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 paidconst 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
}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 headerDetails
- Provider
- sqlpermit.schemasure.com
- Endpoint
- https://sqlpermit.schemasure.com/v1/guard/sql
- Machine-readable
/resources/26949.json