static-analysis-forge

A set of static code-analysis tools and patterns for security reviews of Atlassian Forge apps. Static analysis examines source code for suspicious patterns without running the application.

In plain words
What is it for?
Use Semgrep, FSRT, Snyk, or ESLint security plugins to scan Forge code, including checks for unsafe SQL construction and related injection risks.
Why use it?
It adds Forge-specific checks to general JavaScript and TypeScript scanning, helping reveal security problems that generic tools may miss.

Cursor rule

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.

agentmods
npx agentmods add rules/atlassian/forge-skills/static-analysis-forge
Clone the repo
git clone --depth 1 https://github.com/atlassian/forge-skills
Per session 10 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,419 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00010 $0.01419
Opus 5 $0.00005 $0.00709
Sonnet 5 $0.00002 $0.00284
Haiku 4.5 $0.00001 $0.00142

Measured 2d ago against content hash 471a47af96c4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

static-analysis-forge 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 2d 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-auditing/static-analysis-forge.mdc · 213 lines

How it starts

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

Context

  • Static analysis for Forge apps requires Forge-specific rules in addition to standard JavaScript/TypeScript scanning.
  • Key tools: FSRT (Forge Static Review Tool), Semgrep, Snyk, ESLint security plugins.

Forge-Specific SAST Tools

Semgrep for Forge

# Install semgrep
brew install semgrep  # macOS
# or
pip install semgrep

# Run with JavaScript security rules
semgrep --config p/javascript > semgrep-js.json
semgrep --config p/typescript > semgrep-ts.json
semgrep --config p/nodejsscan > semgrep-node.json

# Run with custom Forge rules
semgrep --config ./forge-rules/ > semgrep-forge.json

Custom Semgrep Rules for Forge

# forge-sql-injection.yaml
rules:
  - id: forge-sql-injection-executeraw
    patterns:
      - pattern-either:
          - pattern: sql.executeRaw(`... ${$VAR} ...`)
          - pattern: sql.executeRaw("..." + $VAR + "...")
    message: "SQL injection risk in sql.executeRaw - use bindParams"
    severity: ERROR
    languages: [javascript, typescript]

  - id: forge-sql-injection-prepare
    patterns:
      - pattern: sql.prepare(`... ${$VAR} ...`).execute()
    message: "SQL injection risk - prepare without bindParams"
    severity: ERROR
    languages: [javascript, typescript]

  - id: forge-asapp-no-authz
    patterns:
      - pattern: |
          resolver.define($NAME, async ({ payload, context }) => {
            ...
            const $API = asApp();
            ...
          })
      - pattern-not: |
          resolver.define($NAME, async ({ payload, context }) => {
            ...
            if (...) { throw ... }
            ...
            const $API = asApp();
            ...
          })
    message: "asApp() without apparent authorization check"
    severity: WARNING
    languages: [javascript, typescript]

  - id: forge-dangerouslysetinnerhtml
    pattern: dangerouslySetInnerHTML={{ __html: $VAR }}
    message: "dangerouslySetInnerHTML - verify XSS sanitization"
    severity: WARNING
    languages: [javascript, typescript]

  - id: forge-dynamic-code-execution
    patterns:
      - pattern-either:
          - pattern: new Function(...)
          - pattern: new AsyncFunction(...)
          - pattern: eval(...)
    message: "Dynamic code execution - high RCE risk"
    severity: ERROR
    languages: [javascript, typescript]

Snyk for SCA

# Scan dependencies for vulnerabilities
snyk test --severity-threshold=low --json > snyk-results.json

# Key checks:
# - Known CVEs in dependencies
# - Outdated packages
# - License compliance

Analysis Workflow

# 1. Manifest Analysis
cat manifest.yml | yq '.permissions'
# Check scopes, external permissions, CSP

# 2. FSRT Scan
fsrt scan --path . --output fsrt-results.json

# 3. Semgrep Scan
semgrep --config p/javascript --config p/typescript \
  --config ./forge-rules/ --json > semgrep-results.json

# 4. Dependency Scan
snyk test --json > snyk-results.json
npm audit --json > npm-audit.json

# 5. Secret Scanning
gitleaks detect --source . --report-format json > secrets.json

# 6. Triage and Correlate
# Combine results, remove duplicates, prioritize

Detection Patterns Summary

Category Pattern Tool
SQL Injection sql.executeRaw(\...${}`)` Semgrep
XSS dangerouslySetInnerHTML + unsafe-inline Semgrep + Manifest
RCE new Function(), eval() Semgrep
AuthZ asApp() without checks FSRT, Semgrep
Secrets Basic auth, API keys Gitleaks, FSRT
Dependencies CVEs in node_modules Snyk, npm audit

False Positive Reduction

# Exclude test files
semgrep --exclude='**/test/**' --exclude='**/*.test.*'

# Exclude node_modules
semgrep --exclude='**/node_modules/**'

# Exclude webpack output
semgrep --exclude='**/webpack/**' --exclude='**/dist/**'

# Exclude bundled/minified files
semgrep --exclude='**/*.min.js' --exclude='**/bundled/**'

Triage Guidance

1. Critical Priority:
   - SQL injection with user input
   - RCE via dynamic code execution
   - Hardcoded production secrets
   - asApp without authorization

2. High Priority:
   - XSS with unsafe-inline CSP
   - Prototype pollution
   - Web trigger without auth
   - Global state tenant isolation

3. Medium Priority:
   - Excessive scopes
   - Wildcard external permissions
   - Missing input validation
   - Secrets in logs

4. Low Priority:
   - Informational findings
   - Best practice deviations
   - Unused code patterns

Read the full file on GitHub · 213 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. 2d ago First seen · 213 lines · 10 tokens per session scan A 471a47af96c4

Subscribe to this mod's changes

static-analysis-forge is a cursor rule published in the GitHub repository atlassian/forge-skills (20 stars, last pushed 3d ago), licensed Apache-2.0. It adds 10 tokens to every session and 1,419 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.