prototype-pollution

A set of review rules for finding prototype pollution vulnerabilities in Atlassian Forge apps. Prototype pollution is when untrusted input changes shared JavaScript object behavior.

In plain words
What is it for?
Use it to review JSON parsing, object merging, query and body parsing, deserialization, and object assignments for unsafe keys such as __proto__, prototype, and constructor.
Why use it?
It helps catch bugs that can leak data between customers or raise a user's permissions from asUser to asApp.

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/prototype-pollution
Clone the repo
git clone --depth 1 https://github.com/atlassian/forge-skills
Per session 13 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,044 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.00013 $0.01044
Opus 5 $0.00006 $0.00522
Sonnet 5 $0.00003 $0.00209
Haiku 4.5 $0.00001 $0.00104

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

Security

Grade A, and why

prototype-pollution 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-injection/prototype-pollution.mdc · 147 lines

How it starts

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

Context

  • Prototype pollution in Forge RuntimeV2 can enable cross tenant data leakage and privilege escalation from asUser to asApp by injecting fetch headers.
  • Related CWE: CWE-1321 (Improperly Controlled Modification of Object Prototype Attributes).
  • Forge-specific: Default libraries in RuntimeV2 allow attackers to exploit prototype pollution for privilege escalation.

Scope & Signals

  • Sources: JSON parsing, object merging, query/body parsing, deserialization.
  • Sinks: Object property assignment, deep merge utilities, spread operators with untrusted keys.
  • Red flags:
    • __proto__, prototype, constructor in property paths from user input.
    • Deep merge without prototype guards (lodash < 4.17.12, jQuery.extend, etc.).
    • Object.assign with untrusted objects.

Forge-Specific Escalation Path

// In RuntimeV2, prototype pollution can upgrade asUser() to asApp()
// by injecting headers into fetch calls

// If attacker can pollute Object.prototype:
Object.prototype.headers = {
  'x-forge-oauth': 'app'  // Hypothetical escalation header
};

// Subsequent asUser() calls may inherit polluted headers
const api = asUser();
await api.requestJira(route`/rest/api/3/issue/TEST-1`);
// Request now uses app-level permissions

Vulnerable Patterns

// VULNERABLE - Merge user input without guards
const config = {};
Object.assign(config, JSON.parse(payload.settings));

// VULNERABLE - Deep merge with untrusted data
import merge from 'lodash.merge';
const merged = merge(defaults, userInput);

// VULNERABLE - Bracket notation with user key
const key = payload.key;
obj[key] = payload.value;  // key could be "__proto__"

// VULNERABLE - Recursive object assignment
function deepSet(obj, path, value) {
  const keys = path.split('.');
  let current = obj;
  for (let i = 0; i < keys.length - 1; i++) {
    current = current[keys[i]] = current[keys[i]] || {};
  }
  current[keys[keys.length - 1]] = value;
}
deepSet({}, payload.path, payload.value);  // path = "__proto__.polluted"

Secure Patterns

// SECURE - Reject dangerous keys
function safeSet(obj, key, value) {
  if (['__proto__', 'prototype', 'constructor'].includes(key)) {
    throw new Error('Invalid key');
  }
  obj[key] = value;
}

// SECURE - Use Object.create(null) for prototype-less objects
const config = Object.create(null);
Object.assign(config, sanitizedInput);

// SECURE - Use Map instead of objects for dynamic keys
const userSettings = new Map();
userSettings.set(payload.key, payload.value);

// SECURE - Schema validation with allowlisted keys
import { z } from 'zod';
const SettingsSchema = z.object({
  theme: z.string(),
  language: z.string()
}).strict();  // Reject unknown keys

const settings = SettingsSchema.parse(payload.settings);

// SECURE - Updated lodash with prototype guards
import merge from 'lodash.merge';  // v4.17.21+
// Still recommend explicit key validation

Detection Checklist

  • Search for __proto__, prototype, constructor in code.
  • Find Object.assign, spread operators with untrusted sources.
  • Check for deep merge utilities and their versions.
  • Identify bracket notation property access with dynamic keys.
  • Look for recursive object traversal/assignment functions.
  • Check package.json for vulnerable lodash, hoek, jQuery versions.

PoC / Test Leads

// Test payload for prototype pollution
const maliciousPayload = {
  "__proto__": {
    "polluted": true
  }
};

// Or via constructor
const payload2 = {
  "constructor": {
    "prototype": {
      "polluted": true
    }
  }
};

// Verify pollution
console.log({}.polluted);  // Should be undefined, true if polluted

Remediation Guidance (advisory)

  • Reject __proto__, prototype, constructor keys at input validation.
  • Use schema validators (zod, joi) with strict mode to allowlist keys.
  • Create objects with Object.create(null) when prototype not needed.
  • Use Map/Set for dynamic key storage.
  • Update lodash to 4.17.21+ and other merge libraries.
  • Freeze prototypes in sensitive contexts: Object.freeze(Object.prototype).

Read the full file on GitHub · 147 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 · 147 lines · 13 tokens per session scan A ed7a385f9ddd

Subscribe to this mod's changes

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