Tinplate 42 Edge APIs

Security & Secrets Tier 1 Ready POST /v1/command-sql-guard

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.

Try It Live in Your Browser · No API Key Required

1. Interactive Sandbox & Sample JSON Output

200 OK · Ready

Editable Request JSON (POST /v1/command-sql-guard)

Live 200 OK Response Envelope

{
  "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
  }
}

2. Quickstart Code Examples

Full TypeScript & Python SDK →
curl -X POST "https://api.tinplate.dev/v1/command-sql-guard" \
  -H "Content-Type: application/json" \
  -H "X-RapidAPI-Key: YOUR_RAPIDAPI_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"; // npm install @tinplate/sdk

const tinplate = new TinplateClient({
  rapidApiKey: process.env.RAPIDAPI_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",
        "X-RapidAPI-Key": "YOUR_RAPIDAPI_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",
    "X-RapidAPI-Key": "YOUR_RAPIDAPI_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)

Parameter Type & Constraints Description
inputrequired string
minLen: 1, maxLen: 100000
Raw shell command or SQL query emitted by an AI agent, coding assistant, or Text-to-SQL pipeline.
modeoptional "auto" | "shell" | "sql"
default: "auto"
Inspection mode: 'shell' for bash/sh/PowerShell commands, 'sql' for SQL queries, or 'auto' to classify automatically.
allow_chainingoptional boolean
default: false
In shell mode, whether command chaining (;, &&, ||) and subshells ($(), backticks) are permitted.
allowed_commandsoptional string[] Optional allowlist of binary/command names permitted in shell mode (e.g., ['git', 'npm', 'ls']).
sql_policyoptional "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_limitoptional boolean
default: false
In SQL mode, flag SELECT queries that omit a LIMIT/FETCH FIRST clause.

Response data Object Fields (200 OK)

Field Type Description
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'

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

Honest Engineering Boundaries

4. Known Limitations & Test Verification

Release Version: v1.0.7 · Last Verified / Benchmarked: 14 November 2026 · Latency Note: Sub-millisecond figures measure in-Worker V8 compute time (typical client HTTPS network RTT to the nearest Cloudflare PoP is 15–65 ms) · See Full Portfolio Benchmarks & Corpora →

5. Marketplace Plans & Payload Quotas

Plan Monthly Price Included Requests Rate Limit Max Request Payload Best For
BASIC $0.00 / month 500 / month (hard limit) 10 req / min 64 KB Evaluation, local development & CI smoke tests
PRO $9.99 / month 15,000 / month 60 req / min 128 KB Solo developers & production apps
ULTRA $29.99 / month 100,000 / month 300 req / min 256 KB Growing SaaS & multi-agent pipelines
MEGA $79.99 / month 500,000 / month 1,000 req / min 256 KB High-volume enterprise workloads

6. 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

7. Data Handling, Privacy & Marketplace 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 in configuration (observability.enabled = false, head_sampling_rate = 0, invocation_logs = false). Payloads are processed strictly in volatile V8 memory and never logged or stored by Tinplate.

Marketplace Proxies vs. Direct Bearer Key: Requests sent via RapidAPI or Zyla API Hub pass through those marketplaces' proxy infrastructure (subject to their respective privacy policies). Security-sensitive workloads requiring end-to-end zero-intermediary processing can connect directly to https://api.tinplate.dev using a Direct Bearer Key (Authorization: Bearer <API_KEY>). Read our full Privacy Notice and OpenAPI 3.0.3 JSON Schema.

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.