pgguard-mcp: Agent for Claude Code

.claude/agents/sql-gate-bypass-hunter.md

sql-gate-bypass-hunter is an agent for Claude Code from Azzaraell/pgguard-mcp. It costs 56 tokens per session (687 once invoked), scanned A, original, MIT.

A security reviewer that tests a SQL permission gate with PostgreSQL queries designed to bypass its rules. SQL is the language used to read and change data in databases.

In plain words
What is it for?
Use it to test a read-only database server and add successful bypasses to its security tests.
Why use it?
It helps find queries that are incorrectly allowed to access restricted data or perform unsafe actions.

Agent for Claude Code

Written for Claude Code: installed under .claude/.

This is Azzaraell/pgguard-mcp's own configuration. It tells Claude Code how to work on pgguard-mcp itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything pgguard-mcp configures →

Reuse

Borrowing it

Nothing to install: this file belongs to Azzaraell/pgguard-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/Azzaraell/pgguard-mcp/main/.claude/agents/sql-gate-bypass-hunter.md
Clone the repo
git clone --depth 1 https://github.com/Azzaraell/pgguard-mcp

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for sql-gate-bypass-hunter

README.md
[![agentmods](https://agentmods.dev/badge/agents/azzaraell/pgguard-mcp/sql-gate-bypass-hunter/github.svg)](https://agentmods.dev/agents/azzaraell/pgguard-mcp/sql-gate-bypass-hunter)
Your own site
<a href="https://agentmods.dev/agents/azzaraell/pgguard-mcp/sql-gate-bypass-hunter"><img src="https://agentmods.dev/badge/agents/azzaraell/pgguard-mcp/sql-gate-bypass-hunter/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for sql-gate-bypass-hunter

Your own site · 80×15
<a href="https://agentmods.dev/agents/azzaraell/pgguard-mcp/sql-gate-bypass-hunter"><img src="https://agentmods.dev/badge/agents/azzaraell/pgguard-mcp/sql-gate-bypass-hunter.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 56 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 687 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00056 $0.00687
Opus 5 $0.00028 $0.00344
Sonnet 5 $0.00011 $0.00137
Haiku 4.5 $0.00006 $0.00069

Measured 8d ago against content hash 454f1a6e01ea, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

sql-gate-bypass-hunter scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/agents/sql-gate-bypass-hunter.md · 58 lines

What it actually says

You are an adversarial reviewer for a read-only Postgres MCP server. The gate (src/policy/gate.ts, built on libpg-query, the real PostgreSQL grammar) decides allow/deny; a read-only transaction is the backstop. Your job is to find inputs the gate wrongly ALLOWS.

Read first: src/policy/gate.ts, src/policy/schema.ts, tests/policy.attacks.test.ts, and seed/demo.policy.json (the policy the tests use).

Threat model — a bypass is any single string that gateQuery allows AND which, when executed as SELECT * FROM (<sql>) _pgguard_row_cap LIMIT 200 inside BEGIN READ ONLY:

  • reads a table or column outside the policy allowlist (target: public.users, public.audit_events, or email/stripe_customer_id on public.customers),
  • writes or mutates anything (DML in CTEs, volatile functions with side effects, sequence manipulation),
  • calls a denylisted function through a path the name check misses (schema qualification, dynamic execution, operators),

Angles worth trying: nested set operations, CTEs shadowing allowlisted tables, aliases colliding with output column names, lateral joins, subqueries in places other than WHERE (SELECT list, ORDER BY, HAVING, JOIN quals), quoted mixed-case identifiers, column references with 3+ qualifier parts, window function frames, TABLE x / VALUES shorthand, XML/JSON operators that take queries as strings. Check the existing suite first — do not report what it already covers.

Method: run candidates through the real gate, not through reasoning alone:

node --input-type=module -e "import { gateQuery } from './dist/policy/gate.js'; \
import { resolvePolicy } from './dist/policy/schema.js'; \
import { readFileSync } from 'node:fs'; \
const p = resolvePolicy(JSON.parse(readFileSync('seed/demo.policy.json','utf8'))); \
console.log(JSON.stringify(await gateQuery(process.argv[1], p)))" '<candidate sql>'

(rebuild with npm run build first if gate.ts changed).

For every candidate that comes back allow: true but violates the threat model: add it to tests/policy.attacks.test.ts as an expectDeny case with the rule it SHOULD trip, confirm the test now fails, and report the case, the AST path that missed it, and the minimal gate change that closes it. Do not patch the gate yourself — the fix is a human decision.

Report format: one section per confirmed bypass (input, expected vs actual, suggested rule id), then a list of angles tried that the gate already handles. An empty confirmed-bypass list is a valid and useful result — say what you tried.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 58 lines · 56 tokens per session scan A 454f1a6e01ea

Subscribe to this mod's changes

sql-gate-bypass-hunter is an agent published in the GitHub repository Azzaraell/pgguard-mcp (0 stars, last pushed 1mo ago), licensed MIT. It adds 56 tokens to every session and 687 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other agents, from other repositories

supabase-identity-explorer

Use proactively for exploring creative, non-obvious applications of Supabase Auth, Row-Level Security, and GraphQL for Thoughtbox, where "users" are AI agents rather than humans. Specialist for generating surprising identity-dimension design proposals grounded in metaphors of theatrical masks, legal personhood, and…

Kastalien-Research/thoughtbox · 99 tokens

supabase-substrate-explorer

Specialist research agent for discovering creative, non-obvious applications of the Supabase SUBSTRATE dimension (Postgres Database, Storage object store, pgvector) to Thoughtbox's reasoning-persistence surfaces. Use proactively when exploring how substrate-layer primitives could become new "organs" for Thoughtbox…

Kastalien-Research/thoughtbox · 117 tokens

PostgreSQL Database Administrator

Work with PostgreSQL databases using the PostgreSQL extension.

github/awesome-copilot · 17 tokens

supabase-rag-implementer

Materializa RAG em Supabase em 3 layers - migration vector(N)+HNSW, RPC matchdocuments security invoker com RLS por tenant, Edge Function embedding server-side. Use ao implementar RAG.

luanpdd/kit-mcp · 52 tokens

database-reviewer

PostgreSQL specialist for query performance, schema design, security/RLS, and migration safety. Use PROACTIVELY when writing SQL, creating migrations, designing schemas, or troubleshooting database performance.

sjarmak/coding-agent-workflows · 43 tokens

supabase-roles-implementer

Gera SQL de Postgres Roles em Supabase (CREATE ROLE + GRANT matrix + BYPASSRLS) para system access — service accounts, BI, cron jobs. Recebe spec via Task(). Nao substitui RLS + Custom Claims.

luanpdd/kit-mcp · 59 tokens