security-global-pathtraversal-prevention

security-global-pathtraversal-prevention is a cursor rule for Cursor from adobe/aem-desktop. It costs 28 tokens per session (2,717 once invoked), scanned A, a copy of security-global-pathtraversal-prevention, Apache-2.0.

A set of rules for preventing path traversal, an attack that tricks software into reading, writing, or deleting files outside its intended folder.

In plain words
What is it for?
Use it when handling uploaded files, downloads, archives, file searches, or any filesystem operation influenced by user input.
Why use it?
It helps stop user-supplied file names and paths from exposing private files, overwriting important data, or compromising the system.

Cursor rule for Cursor ✓ vendor

Written for Cursor: installed under .cursor/.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is with open(f"/uploads/{filename}", 'r') as f: # User can access ../../../etc/passwd.

Good fit Use it when handling uploaded files, downloads, archives, file searches, or any filesystem operation influenced by user input.

Compare 6 cursor rules from other repositories ↓
About the project

AEM Desktop is an Electron desktop application for Adobe Experience Manager Edge Delivery Services, with development infrastructure for hot reload, updates, testing, and macOS release builds. It is used by developers building and releasing the desktop client, including signed and notarized macOS packages. Its catalogue entries provide coding-agent rules and instructions for working in this repository.

adobe/aem-desktop · 3 stars · on GitHub

Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/adobe/aem-desktop
agentmods
npx agentmods add rules/adobe/aem-desktop/security-global-pathtraversal-prevention

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 security-global-pathtraversal-prevention

README.md
[![agentmods](https://agentmods.dev/badge/rules/adobe/aem-desktop/security-global-pathtraversal-prevention/github.svg)](https://agentmods.dev/rules/adobe/aem-desktop/security-global-pathtraversal-prevention)
Your own site
<a href="https://agentmods.dev/rules/adobe/aem-desktop/security-global-pathtraversal-prevention"><img src="https://agentmods.dev/badge/rules/adobe/aem-desktop/security-global-pathtraversal-prevention/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 security-global-pathtraversal-prevention

Your own site · 80×15
<a href="https://agentmods.dev/rules/adobe/aem-desktop/security-global-pathtraversal-prevention"><img src="https://agentmods.dev/badge/rules/adobe/aem-desktop/security-global-pathtraversal-prevention.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 28 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,717 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod 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.00028 $0.02717
Opus 5.5 $0.00011 $0.01087
Sonnet 5.5 $0.00006 $0.00543
Haiku 4.5 $0.00003 $0.00272

Measured 3mo ago against content hash 801cdea14c4b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

security-global-pathtraversal-prevention scanned grade A with 1 finding 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 3mo 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

### urllib.parse (For URL-encoded paths)
Origin

This is a copy

100% identical to security-global-pathtraversal-prevention — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.cursor/rules/security-global/security-global-pathtraversal-prevention.mdc · 401 lines

How it starts

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

Path Traversal Prevention

Path traversal attacks occur when user-controlled input is used to construct file paths, allowing attackers to access files outside the intended directory. This can lead to unauthorized file access, data leakage, or system compromise.

1. Do Not Use User Input in File Paths

Rule: Never use raw user input to construct file paths for read or write operations.

❌ Dangerous Examples

# File Read - DANGEROUS
filename = request.args.get('file')
with open(f"/uploads/{filename}", 'r') as f:  # User can access ../../../etc/passwd
    content = f.read()

# File Write - DANGEROUS  
user_file = request.files['file']
filename = user_file.filename
user_file.save(f"/uploads/{filename}")  # User can write to ../../../sensitive/config.json
// File Read - DANGEROUS
const filename = req.query.file;
fs.readFile(`./uploads/${filename}`, (err, data) => {  // ../../../etc/passwd
    res.send(data);
});

// File Write - DANGEROUS
const filename = req.body.filename;
fs.writeFile(`./uploads/${filename}`, data);  // ../../../system/config
// File Read - DANGEROUS
$filename = $_GET['file'];
$content = file_get_contents("/uploads/" . $filename);  // ../../../etc/passwd

// File Write - DANGEROUS
$filename = $_POST['filename'];
file_put_contents("/uploads/" . $filename, $data);  // ../../../sensitive/data

✅ Secure Alternatives

# File Read - SECURE
import os
from pathlib import Path

filename = request.args.get('file')
# Validate filename format
if not filename or not filename.replace('.', '').replace('_', '').replace('-', '').isalnum():
    abort(400, "Invalid filename")

# Use pathlib for safe path joining
upload_dir = Path("/uploads")
file_path = upload_dir / filename

# Ensure the final path is within the intended directory
if not str(file_path.resolve()).startswith(str(upload_dir.resolve())):
    abort(403, "Access denied")

with open(file_path, 'r') as f:
    content = f.read()
// File Read - SECURE
const path = require('path');
const fs = require('fs');

const filename = req.query.file;
// Validate filename
if (!filename || !/^[a-zA-Z0-9._-]+$/.test(filename)) {
    return res.status(400).send('Invalid filename');
}

const uploadDir = path.resolve('./uploads');
const filePath = path.join(uploadDir, filename);

// Ensure path is within intended directory
if (!filePath.startsWith(uploadDir)) {
    return res.status(403).send('Access denied');
}

fs.readFile(filePath, (err, data) => {
    if (err) return res.status(404).send('File not found');
    res.send(data);
});

Read the full file on GitHub · 401 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. 3mo ago First seen · 401 lines · 28 tokens per session scan A 801cdea14c4b

Subscribe to this mod's changes

security-global-pathtraversal-prevention is a cursor rule published in the GitHub repository adobe/aem-desktop (3 stars, last pushed 15d ago), licensed Apache-2.0. It adds 28 tokens to every session and 2,717 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). It is 100% identical to security-global-pathtraversal-prevention, differing in 0 lines, and is treated as a copy.

Related

security-global-pathtraversal-prevention compared with cursor rules from other repositories

security-global-pathtraversal-prevention next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
security-global-pathtraversal-preventionadobe/aem-desktopCursor rule315d agoApache-2.0A28Cursor
ponytailDietrichGebert/ponytailCursor rule203k10d agoMITA604Cursor
angular-20angular/angularCursor rule102ktodayMITA0Cursor
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