Support: support@tinplate.dev · Zero-Retention Edge Security Support Trust Center DPA GitHub Issues
Security & Secrets Tier 1 All-Access

AI Agent Command & SQL Firewall API — Block Destructive Bash Commands & Unsafe SQL Before Execution

Audit agent shell commands and Text-to-SQL queries for RCE, reverse shells, and destructive SQL. Pre-execution security firewall for coding agents, MCP bash/database tools, and Text-to-SQL pipelines. Blocks rm -rf, curl|sh, reverse shells, stacked SQL queries, and missing WHERE clauses.

Interactive Sandbox · No API Key Required 200 OK · Ready
POST /v1/command-sql-guardinput
200 OK sample / live responsejson
{
  "ok": true,
  "data": {
    "detected_mode": "sql",
    "verdict": "block",
    "safe": false,
    "risk_score": 100,
    "findings": [
      {
        "category": "stacked_sql_queries",
        "severity": "critical",
        "description": "Stacked SQL execution detected (2 semicolon-separated statements)",
        "snippet": "DROP TABLE users"
      },
      {
        "category": "destructive_ddl_dml",
        "severity": "critical",
        "description": "Destructive DDL or privilege statement (DROP) violates sql_policy='read_only'",
        "snippet": "DROP TABLE users"
      }
    ],
    "parsed_summary": {
      "primary_operation": "SELECT",
      "statement_count": 2,
      "referenced_targets": [
        "users"
      ],
      "read_only": false
    }
  },
  "meta": {
    "request_id": "req_csg_01",
    "ms": 1
  }
}
OpenAPI 3.0.3 Get All-Access Key ($29/mo) No signup. No payload storage.
Quickstart Code Examples
curl -X POST "https://api.tinplate.dev/v1/command-sql-guard" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TINPLATE_KEY" \
  -d '{"input":"SELECT id, email FROM users WHERE active = 1; DROP TABLE users;","mode":"auto","sql_policy":"read_only"}'
import { TinplateClient } from "@tinplate/sdk";

const tinplate = new TinplateClient({
  apiKey: process.env.TINPLATE_API_KEY!,
});

const { data, meta } = await tinplate.call("/v1/command-sql-guard", {
  "input": "SELECT id, email FROM users WHERE active = 1; DROP TABLE users;",
  "mode": "auto",
  "sql_policy": "read_only"
});
console.log(`[${meta.ms} ms]`, data);
import requests

response = requests.post(
    "https://api.tinplate.dev/v1/command-sql-guard",
    headers={
        "Content-Type": "application/json",
        "Authorization": "Bearer YOUR_TINPLATE_KEY",
    },
    json={
  "input": "SELECT id, email FROM users WHERE active = 1; DROP TABLE users;",
  "mode": "auto",
  "sql_policy": "read_only"
}
)
print(response.json())
const response = await fetch("https://api.tinplate.dev/v1/command-sql-guard", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_TINPLATE_KEY",
  },
  body: JSON.stringify({
  "input": "SELECT id, email FROM users WHERE active = 1; DROP TABLE users;",
  "mode": "auto",
  "sql_policy": "read_only"
}),
});
const result = await response.json();
console.log(result);
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "tinplate_command_sql_guard",
    "arguments": {
      "input": "SELECT id, email FROM users WHERE active = 1; DROP TABLE users;",
      "mode": "auto",
      "sql_policy": "read_only"
    }
  }
}
OpenAPI 3.0.3 Schema Contract

Request Parameters & Response Schema Reference

Request Body Parameters (POST /v1/command-sql-guard)

ParameterType & ConstraintsDescription
input required string
minLen: 1, maxLen: 100000
Raw shell command or SQL query emitted by an AI agent, coding assistant, or Text-to-SQL pipeline.
mode optional "auto" | "shell" | "sql"
default: "auto"
Inspection mode: 'shell' for bash/sh/PowerShell commands, 'sql' for SQL queries, or 'auto' to classify automatically.
allow_chaining optional boolean
default: false
In shell mode, whether command chaining (;, &&, ||) and subshells ($(), backticks) are permitted.
allowed_commands optional string[] Optional allowlist of binary/command names permitted in shell mode (e.g., ['git', 'npm', 'ls']).
sql_policy optional "read_only" | "dml_allowed" | "ddl_allowed"
default: "read_only"
In SQL mode, 'read_only' allows only SELECT/EXPLAIN/SHOW/WITH; 'dml_allowed' allows INSERT/UPDATE/DELETE with WHERE; 'ddl_allowed' allows schema changes.
require_sql_limit optional boolean
default: false
In SQL mode, flag SELECT queries that omit a LIMIT/FETCH FIRST clause.

Response data Object Fields (200 OK)

FieldTypeDescription
detected_mode "shell" | "sql" Field 'detected_mode'
verdict "allow" | "review" | "block" Field 'verdict'
safe boolean Field 'safe'
risk_score integer Field 'risk_score'
findings object[] Field 'findings'
parsed_summary object Field 'parsed_summary'

What Agent Shell Command & SQL Query Safety Firewall API Detects & Validates

  • Shell mode: command chaining (;, &&, ||), subshells ($(), backticks), curl/wget|sh RCE pipes, and reverse shells (/dev/tcp, nc -e, socat)
  • Shell mode: destructive filesystem commands (rm -rf /, mkfs, dd, fork bombs), privilege escalation (sudo, chmod +s), and credential harvesting (~/.ssh, .aws, /etc/shadow, .env)
  • SQL mode: enforces read_only (SELECT-only) policies for Text-to-SQL agents, blocks stacked queries, DROP/TRUNCATE/ALTER, and DELETE/UPDATE without a WHERE clause
  • SQL mode: detects boolean tautology SQLi (OR 1=1), UNION schema probes, file/command functions (INTO OUTFILE, COPY PROGRAM, pg_read_file, xp_cmdshell), and sleep DoS
Honest Engineering Boundaries

Known Limitations & Test Verification

Release: v1.0.39 · Verified: 16 November 2026 · Portfolio Median: 0.318 ms in-Worker V8 compute (add 15–65 ms HTTPS RTT) · See Full Portfolio Benchmarks →

  • Performs deterministic lexical and structural command/SQL analysis (typically under 5 ms in deterministic mode); always pair with least-privilege OS/DB credentials and container sandboxing.
  • Tested v1.0.4 (14 November 2026).

Direct All-Access & Marketplace Plans

Direct Polar All-Access Keys unlock all 42 APIs (49 endpoints), /v1/pipeline, and /mcp on api.tinplate.dev: Pro ($29/mo · 120 req/min · 100k/mo · 128 KB) or Team ($79/mo · 300 req/min · 500k/mo · 256 KB).

PlanMonthly PriceIncluded RequestsRate LimitMax PayloadBest For
BASIC$0.00 / mo500 / month10 req / min64 KBEvaluation & CI smoke tests
PRO$9.99 / mo15,000 / month60 req / min128 KBSolo devs & production apps
ULTRA$29.99 / mo100,000 / month300 req / min256 KBGrowing SaaS & multi-agent pipelines
MEGA$79.99 / mo500,000 / month1,000 req / min256 KBHigh-volume enterprise workloads

Frequently Asked Questions

How do I use this with an MCP server or coding agent?

Call POST /v1/command-sql-guard inside your tool-execution hook before passing an LLM's bash command or SQL query to child_process or your database driver.

Can I restrict an agent to specific CLI binaries?

Yes—pass allowed_commands (e.g. ['git', 'npm', 'pytest']) and allow_chaining: false to reject any unlisted binary or subshell.

Does it catch UPDATE or DELETE statements missing a WHERE clause?

Yes, even when sql_policy is set to 'dml_allowed', any UPDATE or DELETE lacking a WHERE clause raises a critical 'unbounded_mutation_no_where' finding.

Zero Payload Logging

Data Handling, Privacy & Proxy Disclosure

Commands and SQL queries are evaluated in memory and never logged or persisted.

Worker Zero-Logging Guarantee: Cloudflare Workers Observability and invocation logging are disabled (observability.enabled = false, head_sampling_rate = 0, invocation_logs = false). Requests via RapidAPI or Zyla traverse marketplace proxies; use a Direct Bearer Key for zero-intermediary routing.

Related Tinplate APIs

POST /v1/mcp-manifest-linter Tier 1

MCP Server Manifest & Tool Security Linter API

Audit MCP server manifests for hidden tool poisoning, shell risks, and excessive permissions.

POST /v1/tool-call-validator AI Safety & Agents

Agent Tool-Call Validator & Repairer API

Validate and auto-repair broken LLM tool-call arguments against your JSON Schema.

POST /v1/agent-action-receipts/issue AI Safety & Agents

Agent Action Receipts API

Issue and verify tamper-evident HMAC-signed receipts for autonomous AI agent actions.