Works with the AI Agents you already use
SQL Injection Scanner for App Code
by Saizul Amin
Secure PostgreSQL and MySQL/MariaDB access end to end - scan application code (Python, JS/TS, PHP, Ruby, Go, Java, C#) for SQL injection via string interpolation and concatenation (with a baseline so CI fails only on new findings), review GRANTs, roles and users for least privilege (ALL ON *.*, S...
$8
SQL Injection Scanner for App Code
Example session with this skill installed
Scan my application code for SQL injection risks and show me how to fix each one.
- Read your context and instructions
- Compiled the sql injection scanner
I ran the bundled script from the sql-security skill and reviewed its findings.
Demo data: this is the real, unedited output of the skill's script on the test fixture that ships with its source repo.
Script output
sqli-scan: 10 high, 3 medium (6 files)
HIGH tests/fixtures/sql-security/app_bad/Repo.java:3 SQL built with string concatenation
return stmt.executeQuery("SELECT * FROM users WHERE email = '" + email + "'");
fix: use PreparedStatement with ? placeholders (JPA: setParameter)
HIGH tests/fixtures/sql-security/app_bad/orders.ts:2 SQL built with template literal from request input
const rows = await pool.query(`SELECT * FROM orders WHERE customer_id = ${req.query.id}`);
fix: use placeholders: db.query('... WHERE id = $1', [id]) / mysql2 '?' / a tagged template sql`... ${id}` / Prisma $queryRaw`...`
HIGH tests/fixtures/sql-security/app_bad/orders.ts:3 SQL built with Prisma *Unsafe raw query
const more = await prisma.$queryRawUnsafe("SELECT * FROM users WHERE email = '" + email + "'");
fix: use placeholders: db.query('... WHERE id = $1', [id]) / mysql2 '?' / a tagged template sql`... ${id}` / Prisma $queryRaw`...`
HIGH tests/fixtures/sql-security/app_bad/posts_controller.rb:3 SQL built with #{} interpolation from request input
@posts = Post.where("title LIKE '%#{params[:q]}%'")
fix: use bind params: where("name = ?", name) / where(name: name); sanitize_sql_array for raw SQL
HIGH tests/fixtures/sql-security/app_bad/store.go:4 SQL built with fmt.Sprintf
q := fmt.Sprintf("SELECT id FROM users WHERE name = '%s'", name)
fix: use placeholders: db.QueryContext(ctx, "... WHERE id = $1", id) (MySQL driver: ?)
HIGH tests/fixtures/sql-security/app_bad/user.php:3 SQL built with variable interpolation in a double-quoted string
$result = mysqli_query($conn, "SELECT * FROM users WHERE id = $id");
fix: use PDO/mysqli prepared statements: $stmt = $pdo->prepare('... WHERE id = ?'); $stmt->execute([$id]);
HIGH tests/fixtures/sql-security/app_bad/user.php:4 SQL built with variable interpolation in a double-quoted string from request input
$rows = $pdo->query("SELECT name FROM posts WHERE author = '" . $_POST['author'] . "'");
fix: use PDO/mysqli prepared statements: $stmt = $pdo->prepare('... WHERE id = ?'); $stmt->execute([$id]);
HIGH tests/fixtures/sql-security/app_bad/views.py:7 SQL built with f-string
cur.execute(f"SELECT id, email FROM users WHERE name = '{name}'")
fix: pass values as parameters: cur.execute("... WHERE id = %s", (user_id,)) (sqlite3: ?, SQLAlchemy: text("... :id").bindparams(id=...))
HIGH tests/fixtures/sql-security/app_bad/views.py:8 SQL built with % formatting from request input
cur.execute("SELECT id FROM orders WHERE status = '%s'" % request.GET["status"])
fix: pass values as parameters: cur.execute("... WHERE id = %s", (user_id,)) (sqlite3: ?, SQLAlchemy: text("... :id").bindparams(id=...))
HIGH tests/fixtures/sql-security/app_bad/views.py:12 SQL built with f-string
rows = Product.objects.raw(f"SELECT * FROM products ORDER BY {order}")
fix: pass values as parameters: cur.execute("... WHERE id = %s", (user_id,)) (sqlite3: ?, SQLAlchemy: text("... :id").bindparams(id=...)); identifiers (column/table names, ASC/DESC) cannot be parameters: map them through an allow-list
MEDIUM tests/fixtures/sql-security/app_bad/orders.ts:4 SQL built with string concatenation
const sql = "UPDATE users SET name = '" + name + "' WHERE id = " + id;
fix: use placeholders: db.query('... WHERE id = $1', [id]) / mysql2 '?' / a tagged template sql`... ${id}` / Prisma $queryRaw`...`
MEDIUM tests/fixtures/sql-security/app_bad/views.py:9 SQL built with string concatenation
query = "SELECT * FROM products WHERE sku = '" + sku + "'"
fix: pass values as parameters: cur.execute("... WHERE id = %s", (user_id,)) (sqlite3: ?, SQLAlchemy: text("... :id").bindparams(id=...))
MEDIUM tests/fixtures/sql-security/app_bad/views.py:10 SQL built with .format()
sql = "DELETE FROM carts WHERE id = {}".format(cart_id)
fix: pass values as parameters: cur.execute("... WHERE id = %s", (user_id,)) (sqlite3: ?, SQLAlchemy: text("... :id").bindparams(id=...))
Next steps
- Replace string-built queries with parameterised queries.
- Allow-list any dynamic identifiers like column or sort names.
- Re-run the scan in CI on every pull request.
Connects securely to your tools. The creator never sees your data.
About this skill
Secure PostgreSQL and MySQL/MariaDB access end to end - scan application code (Python, JS/TS, PHP, Ruby, Go, Java, C#) for SQL injection via string interpolation and concatenation (with a baseline so CI fails only on new findings), review GRANTs, roles and users for least privilege (ALL ON ., SUPER/FILE, accounts on '%', superuser app roles, GRANT TO PUBLIC, login roles that own tables), check row-level security policies, and design separate migration, app and read-only roles.
When to use it
Use when the user asks for a SQL injection review, a database permissions or security audit, least-privilege roles, row-level security for multi-tenant data, or shares SHOW GRANTS output, pg_dumpall --roles-only, or raw SQL built in code.
How it works
The skill bundles a tested, offline Python script that does the deterministic checks, and instructions that tell your agent how to collect inputs, run the script, interpret the findings and give you a prioritised fix list. See the demo below for real output.
Requirements
- Python 3.8+ (standard library only unless noted in the skill)
- Works with Claude Code, Codex CLI, Cursor and other SKILL.md-compatible agents
Open source: saizul/sql-database-skills on GitHub (MIT licence, by Saizul Amin).
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse All Claude Skills.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 2 days ago
- Software
Python 3.8+