Skip to content
onelayer.
All tools

Tool detail

SQLPermit

Checks a PostgreSQL statement against a policy using Postgres's own parser and can issue a signed, statement-bound execution permit.

Categories: Security

Use when

  • check if an agent-written SQL statement is safe to run
  • get a signed permit authorizing one exact SQL statement
  • block stacked statements or writes hidden in a CTE

Not for

  • never connects to or executes against your database

Inputs

POST JSON body: dialect='postgresql', target_pg_major=18, sql (required); policy object, audience, subject, issue_permit (optional)

Admitted input schema

{
  "type": "object",
  "properties": {
    "audience": {
      "type": "string",
      "minLength": 0,
      "maxLength": 4096,
      "description": "Identity of the ONE executor the permit is for. Required when issue_permit is true. Wildcards are rejected."
    },
    "dialect": {
      "type": "string",
      "minLength": 0,
      "maxLength": 4096,
      "enum": [
        "postgresql"
      ]
    },
    "issue_permit": {
      "type": "boolean"
    },
    "policy": {
      "type": "object",
      "properties": {
        "allow_multi_statement": {
          "type": "boolean",
          "description": "Permit more than one statement in the input. Defaults to false."
        },
        "allow_returning": {
          "type": "boolean",
          "description": "Accept RETURNING on a permitted write without a warning."
        },
        "allow_row_locks": {
          "type": "boolean",
          "description": "Accept SELECT ... FOR UPDATE without a warning."
        },
        "allowed_functions": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 0,
            "maxLength": 4096
          },
          "minItems": 0,
          "maxItems": 100,
          "description": "Added to the built-in allowlist. Bare name, or schema.function to admit one of your own."
        },
        "allowed_languages": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 0,
            "maxLength": 4096
          },
          "minItems": 0,
          "maxItems": 100,
          "description": "Permitted CREATE FUNCTION languages. Defaults to none."
        },
        "allowed_schemas": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 0,
            "maxLength": 4096
          },
          "minItems": 0,
          "maxItems": 100,
          "description": "Schemas the statement may reference."
        },
        "allowed_tables": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 0,
            "maxLength": 4096
          },
          "minItems": 0,
          "maxItems": 100,
          "description": "Permitted relations as schema.table, or a bare name to match an unqualified reference."
        },
        "max_rows": {
          "type": "integer",
          "minimum": 1,
          "maximum": 9007199254740991,
          "description": "Row ceiling. Becomes a permit obligation the executor enforces."
        },
        "read_only": {
          "type": "boolean",
          "description": "Reject anything that can change data or schema, including writes reached through a CTE."
        },
        "statement_timeout_ms": {
          "type": "integer",
          "minimum": 1,
          "maximum": 9007199254740991,
          "description": "Timeout written into the permit obligations. Defaults to 30000."
        }
      },
      "required": [],
      "additionalProperties": false
    },
    "sql": {
      "type": "string",
      "minLength": 1,
      "maxLength": 4096
    },
    "subject": {
      "type": "string",
      "minLength": 0,
      "maxLength": 4096,
      "description": "Opaque caller label recorded as the permit subject."
    },
    "target_pg_major": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991,
      "enum": [
        18
      ],
      "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."
    }
  },
  "required": [
    "dialect",
    "target_pg_major",
    "sql"
  ],
  "additionalProperties": false
}

Endpoint

Method
POST
URL
https://sqlpermit.schemasure.com/v1/guard/sql

Payment

Protocol
x402
Listed price
0.01 USDC per call on Base
Payment method
exact
Network
eip155:8453
Asset
0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913

Listed terms are catalog metadata. The caller supplies inputs and calls the tool outside Onelayer. If payment is required, the caller uses a compatible wallet to pay.

Source

Record
POST https://sqlpermit.schemasure.com/v1/guard/sql
Retrieved
2026-09-30T20:37:07.382Z
Catalog file SHA-256
6837ccddf886f0007cf3727ea9d27faaa5047b51b4f425345c554ce1c271a524
Catalog built
2026-09-30T22:31:58.034Z