Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/atlassian/forge-skills/sql-injectiongit clone --depth 1 https://github.com/atlassian/forge-skillsWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00012 | $0.01102 |
| Opus 5 | $0.00006 | $0.00551 |
| Sonnet 5 | $0.00002 | $0.00220 |
| Haiku 4.5 | $0.00001 | $0.00110 |
Grade A, and why
sql-injection 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 yesterday.
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.
How it starts
The opening of the file, as written. The whole thing — 143 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Context
- Forge SQL API provides
sql.executeRaw()andsql.prepare()for database operations. SQL injection occurs when untrusted input is interpolated into query strings. - Related CWE: CWE-89 (SQL Injection).
- Severity: Critical - can lead to data exfiltration, manipulation, and privilege escalation.
- Reference: Internal VULN Guide to SQL Injection in Forge Apps.
Scope & Signals
- Dangerous APIs:
sql.executeRaw()- Direct query execution (highest risk)sql.prepare()withoutbindParams()- Prepared statement misusemigrationRunner.enqueue()with dynamic content
- Sources: Resolver payloads, web trigger bodies, event data, user input from Custom UI.
- Sinks: Any SQL query construction using string interpolation/concatenation.
Vulnerable Patterns
// CRITICAL - Direct interpolation in executeRaw
const userId = payload.userId;
sql.executeRaw(`SELECT * FROM users WHERE id = ${userId}`);
// CRITICAL - String concatenation
sql.executeRaw("SELECT * FROM users WHERE username = '" + username + "'");
// HIGH - Prepared statement without bindParams
sql.prepare(`SELECT * FROM users WHERE email = '${email}'`).execute();
// HIGH - Template literal in prepare (still vulnerable)
const query = `SELECT * FROM products WHERE category = '${category}'`;
sql.executeRaw(query);
// MEDIUM - Indirect flow through variable
const userQuery = `SELECT * FROM orders WHERE user_id = ${payload.userId}`;
// ... later ...
sql.executeRaw(userQuery);
Secure Patterns
// SECURE - Parameterized query with bindParams
const query = sql.prepare(`SELECT * FROM users WHERE id = $1`);
query.bindParams({ $1: userId });
await query.execute();
// SECURE - Multiple parameters
const query = sql.prepare(
`SELECT * FROM users WHERE username = $1 AND active = $2`
);
query.bindParams({ $1: username, $2: isActive });
await query.execute();
// SECURE - Named parameters (alternative style)
const query = sql.prepare(
`SELECT * FROM users WHERE email = :email AND role = :role`
);
query.bindParams({ email: userEmail, role: userRole });
await query.execute();
// SECURE - Input validation + parameterization
if (!/^\d+$/.test(userId)) {
throw new Error('Invalid user ID format');
}
const query = sql.prepare(`SELECT * FROM users WHERE id = $1`);
query.bindParams({ $1: parseInt(userId, 10) });
Detection Checklist
- Search for
sql.executeRawwith template literals or string concatenation. - Find
sql.preparecalls without correspondingbindParams(). - Trace variables used in SQL strings back to untrusted sources.
- Check
migrationRunner.enqueuefor dynamic schema/table names. - Look for custom "sanitization" functions (often insufficient).
Severity Classification
| Severity | Pattern |
|---|---|
| Critical | Direct user input in sql.executeRaw() |
| High | sql.prepare() without bindParams() |
| Medium | Indirect flow with some transformations |
| Low | Input validated against strict allowlist |
Common Pitfalls
// WRONG - Numeric values still need binding
sql.executeRaw(`SELECT * FROM products WHERE id = ${productId}`);
// WRONG - Custom escaping is insufficient
const safe = input.replace(/'/g, "''");
sql.executeRaw(`SELECT * FROM users WHERE name = '${safe}'`);
// WRONG - toString() doesn't sanitize
sql.executeRaw(`SELECT * FROM logs WHERE date = '${date.toString()}'`);
PoC / Test Leads
- Inject SQL metacharacters:
' OR '1'='1,'; DROP TABLE users; -- - Test UNION-based injection:
' UNION SELECT * FROM sensitive_table -- - Try time-based blind SQLi:
' AND SLEEP(5) -- - Test in numeric fields:
1 OR 1=1
Remediation Guidance (advisory)
- Always use
sql.prepare()withbindParams()for all queries. - Use positional (
$1,$2) or named (:param) parameters. - Validate input types before use (even with parameterization).
- For dynamic table/column names, use strict allowlists.
- Never use string concatenation or interpolation for SQL.
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.
- yesterday First seen · 143 lines · 12 tokens per session scan A fabdfd6edf6c
sql-injection is a cursor rule published in the GitHub repository atlassian/forge-skills (20 stars, last pushed 2d ago), licensed Apache-2.0. It adds 12 tokens to every session and 1,102 once invoked, about $0.0001 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-30.
Other cursor rules, from other repositories
project
4DA project rules and conventions.
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.
typescript
Changes to these high-fan-out internals can affect every message, delta, element, or rerun. Keep work in them minimal, and benchmark changes with representative stress-test apps.
coolify-ai-docs
Master reference to all Coolify AI documentation in .ai/ directory.
python_lib
Tips and guidelines specific to the development of the Streamlit Python library, not applicable to scripts and e2e tests.