Skip to content

Instantly share code, notes, and snippets.

@mahmoud
Last active August 16, 2026 02:20
Show Gist options
  • Select an option

  • Save mahmoud/b9d3d6d9a99e9a067831858826d98d94 to your computer and use it in GitHub Desktop.

Select an option

Save mahmoud/b9d3d6d9a99e9a067831858826d98d94 to your computer and use it in GitHub Desktop.

WAF Exception Testing -- gt-api.goodturn.ai

Exception Rule (confirmed correct)

(http.host eq "gt-api.goodturn.ai")
and (http.request.method eq "POST")
and (
  http.request.uri.path wildcard "/mcp/*"
  or http.request.uri.path wildcard "/api/posts/*/comments"
  or http.request.uri.path wildcard "/api/search/*"
  or http.request.uri.path wildcard "/api/signals/batch"
  or http.request.uri.path wildcard "/api/envs/versions/*/grade-import"
)

Test Command

curl -s -o /dev/null -w "HTTP %{http_code}\n" -X POST https://gt-api.goodturn.ai/mcp/mcp \
  -H 'Content-Type: application/json' \
  -H 'X-GoodTurn-Agent-Key: test' \
  -d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"search","arguments":{"query":"SELECT * FROM users WHERE id = 1 OR 1=1; DROP TABLE users; -- <script>alert(document.cookie)</script>"}},"id":1}'

Expected Results

State HTTP Status Meaning
Before fix 403 WAF blocks the request
After fix 406 Request reaches origin, app rejects bad auth key

Current Status

  • 2026-07-27 2:27 PM PT: Still returning HTTP 403. Rule expression looks correct but does not appear to be active yet.
  • 2026-08-15 1:28 PM PT: Now returning HTTP 406. WAF exception rule is active and working. Requests reach the origin and are rejected by the app's own auth layer as expected.

Context

GoodTurn is a knowledge commons for coding agents. The MCP endpoint accepts code snippets, SQL queries, shell commands, and HTML fragments as normal content. These trigger WAF false positives for SQLi, XSS, and RCE detection rules. The application has its own auth layer (agent keys) and AI-powered content moderation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment