Agent402 / tools / sql-guard

SQL execution certificate firewall

$0.004 per call · USDC via x402 · POST /api/sql-guard

Review a SQL statement an agent is about to run against production, and certify it. Returns a policy verdict (pass / warn / block) with named risks - unbounded UPDATE or DELETE, tautological WHERE, DROP, TRUNCATE, DROP COLUMN, statement stacking, COPY ... FROM PROGRAM, GRANT/role changes, session_replication_role and trigger/constraint bypass, writes to pg_catalog - and, when the verdict is pass, an Ed25519 certificate binding that verdict to the SHA-256 of the exact statement. Your database layer verifies the certificate with sql-cert-verify before executing, so the check cannot be skipped by a confused or compromised agent. Literals and comments are scrubbed before analysis, so a keyword inside a string is never a false alarm. HONEST SCOPE: a lexical guard over a fixed, published risk catalogue - it catches the shapes that destroy production data, it is not a SQL parser and cannot know that a WHERE clause names the wrong tenant.

TRY IN PLAYGROUND →

Input

FieldTypeDescription
sql *stringthe exact statement you are about to execute
allowarrayrisk ids to downgrade from block to warn (see riskCatalogue in the response)
allowMultiStatementbooleanpermit more than one statement in the submission (default false)
ttlSecondsnumbercertificate lifetime, 30-3600 (default 300)

Example output

{
  "verdict": "pass",
  "mutating": true,
  "statementCount": 1,
  "sha256": "635cf20a…",
  "risks": [],
  "certificate": {
    "token": "eyJ2Ijox….signature",
    "expiresAt": "2026-07-28T20:05:00Z"
  }
}

Try it - see the 402 challenge (free)

curl -i -X POST https://base-sentinel-production.up.railway.app/api/sql-guard \
  -H "Content-Type: application/json" \
  -d '{"sql":"UPDATE users SET plan = 'pro' WHERE id = 42"}'

The response is HTTP 402 Payment Required with exact payment requirements. Any x402 v2 client pays automatically and retries:

Paid call (JavaScript agent)

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://base-sentinel-production.up.railway.app/api/sql-guard", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "sql": "UPDATE users SET plan = 'pro' WHERE id = 42"
  }),
});
Wallet-only. This tool reaches the network/browser/storage, so it is paid in USDC via x402 (no proof-of-work tier).

Related tools

Email validate

$0.002 · POST /api/email-validate

Validate an email address: syntax check plus live MX record lookup on the domain (deliverability signal, not a guarantee…

try in playground →

URL parse

FREE w/ compute · or $0.001 · POST /api/url-parse

Parse a URL into components: protocol, host, port, path, query params (decoded), hash, origin, punycode hostname.

try in playground →

IP info

$0.002 · POST /api/ip-info

Classify an IP address: version, public/private/loopback/link-local, integer form, and reverse-DNS (PTR) lookup.

try in playground →