sql-injection

sql-injection is a cursor rule for Cursor from atlassian/forge-skills. It costs 12 tokens per session (1,082 once invoked), scanned A, original, Apache-2.0.

A security rule for finding SQL injection in Forge apps that use the Forge SQL API, a database interface for storing and querying data. SQL injection happens when untrusted input changes the meaning of a database query.

In plain words
What is it for?
Use it to inspect executeRaw(), prepare(), and migration queries receiving resolver payloads, web-trigger bodies, event data, or Custom UI input.
Why use it?
It identifies queries built by inserting user-controlled values directly into SQL, which can expose or alter stored data.

Cursor rule for Cursor ✓ vendor

Written for Cursor: a Cursor rule (.mdc). Also seen: positional $N argument.

Good fit Use it to inspect executeRaw(), prepare(), and migration queries receiving resolver payloads, web-trigger bodies, event data, or Custom UI input.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/atlassian/forge-skills/sql-injection
About the project

Atlassian Forge Skills supports Atlassian Forge, a platform for building and deploying apps that extend products such as Jira and Confluence. Its skills and MCP-backed tools help coding agents create Forge apps, review them before deployment, optimize usage, troubleshoot failures, and work with Forge APIs and the Atlassian Design System.

atlassian/forge-skills · 35 stars · on GitHub · developer.atlassian.com

Install

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.

Clone the repo
git clone --depth 1 https://github.com/atlassian/forge-skills

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for sql-injection

README.md
[![agentmods](https://agentmods.dev/badge/rules/atlassian/forge-skills/sql-injection/github.svg)](https://agentmods.dev/rules/atlassian/forge-skills/sql-injection)
Your own site
<a href="https://agentmods.dev/rules/atlassian/forge-skills/sql-injection"><img src="https://agentmods.dev/badge/rules/atlassian/forge-skills/sql-injection/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for sql-injection

Your own site · 80×15
<a href="https://agentmods.dev/rules/atlassian/forge-skills/sql-injection"><img src="https://agentmods.dev/badge/rules/atlassian/forge-skills/sql-injection.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,082 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What 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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00012 $0.01082
Opus 5.5 $0.00005 $0.00433
Sonnet 5.5 $0.00002 $0.00216
Haiku 4.5 $0.00001 $0.00108

Measured 20d ago against content hash 8281df6ab3d9, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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 20d ago.

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.

skills/forge-security-review/assets/security-rules/forge-injection/sql-injection.mdc · 132 lines

How it starts

The opening of the file, as written. The whole thing — 132 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Context

  • Forge SQL API provides sql.executeRaw() and sql.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.

Scope & Signals

  • Dangerous APIs:
    • sql.executeRaw() - Direct query execution (highest risk)
    • sql.prepare() without bindParams() - Prepared statement misuse
    • migrationRunner.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.executeRaw with template literals or string concatenation.
  • Find sql.prepare calls without corresponding bindParams().
  • Trace variables used in SQL strings back to untrusted sources.
  • Check migrationRunner.enqueue for 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() with bindParams() 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.

Deterministic Signals (OpenGrep rules)

  • forge-dynamic-raw-sql-query (ERROR): request data flows into the SQL text of executeRaw, queryRaw, prepareRaw, prepare or executeDDL. Number(), parseInt, .length, schema .parse() and the SQL client's own escaping helpers count as sanitisers; a custom quote-escaping function does not.

Read the full file on GitHub · 132 lines

Changes

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.

  1. 20d ago Changed · -11 lines 8281df6ab3d9
  2. 3mo ago First seen · 143 lines · 12 tokens per session scan A fabdfd6edf6c

Subscribe to this mod's changes

sql-injection is a cursor rule published in the GitHub repository atlassian/forge-skills (35 stars, last pushed 4d ago), licensed Apache-2.0. It adds 12 tokens to every session and 1,082 once invoked, about $0.0000 per session on Opus 5.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.

Related

sql-injection compared with cursor rules from other repositories

sql-injection next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
sql-injectionatlassian/forge-skillsCursor rule354d agoApache-2.0A12Cursor
ponytailDietrichGebert/ponytailCursor rule201k8d agoMITA604Cursor
angular-20angular/angularCursor rule102k4d agoMITA0Cursor
dev-standardapache/supersetCursor rule76ktodayApache-2.0A1,147Cursor
prefer-assertions-over-defensive-checksprisma/ormCursor rule48ktodayApache-2.0A0Cursor
prefer-direct-imports-over-module-mocksprisma/ormCursor rule48ktodayApache-2.0A0Cursor
shared-plane-packagesprisma/ormCursor rule48ktodayApache-2.0A0Cursor