Go Gin (Go) · CWE-89

Go Gin: SQL & ORM Query Injection

Stop concatenated user strings from altering SQL predicates, ORDER BY clauses, or JSON operators. Applied specifically to Go Gin: Validate JWT claims explicitly and bind outbound HTTP clients against private IPs.

Primary AegisSec skill
owasp-web-audit ->
Companion: zap-active-daemon-triage
Coverage ledger tracking key
surface:go-gin::boundary:sql-injection::principal:c.GetString("userId")
ZAP 40018 SQL Injection active rule in staging-only safe policy
Risk boundary
// Unverified Go Gin path (CWE-89)
// Handler accepts client input without validating c.GetString("userId") or boundary invariants before sink.
Hardened guard
// Hardened Go Gin pattern (CWE-89)
// 1. Validate JWT claims explicitly and bind outbound HTTP clients against private IPs
// 2. Use parameterized query bindings everywhere and strict allowlists for dynamic sort columns.

Verification steps

  1. 01Seed coverage-ledger.json for every Go Gin route handling this boundary.
  2. 02Inspect the code trace from request input down to the persistence or egress sink.
  3. 03Confirm with paired User A vs User B requests (or staging baseline-vs-payload replay) via zap-active-daemon-triage.