Sql injection

From zakirkun/ice-tea · View interactive version

Sql injection is an AI agent skill from the GitHub repository zakirkun/ice-tea. Detects SQL injection via string concatenation and fmt.Sprintf in database queries. Use when reviewing code for SQLi, unsafe query construction, or auditing parameterized query usage.

How to use this skill

Skill file

SQL Injection Detection

Identifies SQL queries built with string concatenation or format strings where user input reaches execution sinks. See patterns.yaml for detection rules.

Detection Workflow

  1. Import check — look for database packages (database/sql, gorm, sqlx, ORMs)
  2. Call check — find SQL execution functions (Query, QueryRow, Exec, Raw)
  3. Context check — check if arguments include string concatenation or fmt.Sprintf
  4. Taint check — trace whether the concatenated variable is user-controlled (request params, form data, headers)
  5. Validate — confirm the variable is not a compile-time constant or allow-listed value before reporting

Vulnerable

db.Query("SELECT * FROM users WHERE id = " + userInput)
db.Query(fmt.Sprintf("SELECT * FROM users WHERE id = %s", userInput))

Safe

db.Query("SELECT * FROM users WHERE id = $1", userInput)
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.