security

security is a cursor rule for Cursor from mordilion/ai-instructions-and-prompts. It costs 0 tokens per session (518 once invoked), scanned B, original, MIT.

A set of security rules for shell scripts such as Bash, Zsh, and related command languages. It covers safe input handling, command execution, file operations, and secrets.

In plain words
What is it for?
Use it when writing or reviewing shell scripts that accept inputs, construct commands, create temporary files, or handle secrets.
Why use it?
It reduces common script risks such as unsafe argument expansion, command injection, accidental file targeting, and leaking secret values.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when writing or reviewing shell scripts that accept inputs, construct commands, create temporary files, or handle secrets.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/mordilion/ai-instructions-and-prompts/security
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/mordilion/ai-instructions-and-prompts

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

README.md
[![agentmods](https://agentmods.dev/badge/rules/mordilion/ai-instructions-and-prompts/security.svg)](https://agentmods.dev/rules/mordilion/ai-instructions-and-prompts/security)
Your own site
<a href="https://agentmods.dev/rules/mordilion/ai-instructions-and-prompts/security"><img src="https://agentmods.dev/badge/rules/mordilion/ai-instructions-and-prompts/security.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 518 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 2 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.00000 $0.00518
Opus 5 $0.00000 $0.00259
Sonnet 5 $0.00000 $0.00104
Haiku 4.5 $0.00000 $0.00052

Measured 7d ago against content hash 36274379781d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade B, and why

security scanned grade B with 2 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 7d 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.

Downloads and executes remote codemediumSupply chain

curl | sh runs whatever the server returns today, which is not necessarily what it returned when this was reviewed.

- **NEVER**: `curl | bash`.

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

Makes network callslowCapability

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

- **NEVER**: `curl | bash`.
.cursor/rules/bash/security.mdc · 45 lines

What it actually says

Bash Security

Scope: Bash/shell-specific security.
Extends: General security rules
Applies to: *.sh, *.bash, *.zsh, *.ksh, *.bats

1. Input Handling

  • ALWAYS: Treat all inputs as untrusted (args, env vars, files, command output).
  • ALWAYS: Validate paths, flags, and required values early. Return exit code 2 on invalid usage.
  • ALWAYS: Quote expansions to prevent globbing and word-splitting injection.

2. Command Execution

  • NEVER: Use eval on untrusted input.
  • NEVER: source/. untrusted files.
  • ALWAYS: Prefer arrays for command + args when constructing invocations.
  • ALWAYS: Use full paths or verify commands via command -v when running in controlled environments (CI, provisioning).

3. Filesystem Safety

  • ALWAYS: Use mktemp for temp files/dirs; clean up with trap.
  • ALWAYS: Set safe permissions when writing secrets or artifacts (umask 077 when appropriate).
  • ALWAYS: Use -- to end option parsing for commands that support it (avoid “filename starts with dash” issues).

4. Secrets

  • NEVER: Print secrets to stdout/stderr or logs.
  • NEVER: Enable set -x in scripts handling secrets (or ensure it is disabled around secret operations).
  • ALWAYS: Prefer env vars, secret stores, or injected files with restricted permissions.

5. Downloads & Supply Chain

  • NEVER: curl | bash.
  • ALWAYS: Pin versions and verify integrity (checksums/signatures) for downloaded artifacts.
  • ALWAYS: Prefer HTTPS; fail on HTTP and handle redirects intentionally.

6. Privilege & Environment

  • ALWAYS: Minimize sudo usage; scope it to the smallest possible commands.
  • ALWAYS: Sanitize/avoid trusting PATH in privileged scripts; consider setting a safe PATH.

Follow the general security rules; the rules above are additive.

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. 7d ago First seen · 45 lines · 0 tokens per session scan B 36274379781d

Subscribe to this mod's changes

security is a cursor rule published in the GitHub repository mordilion/ai-instructions-and-prompts (1 stars, last pushed 2mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 518 tokens. A static security scan graded it B with 2 findings (downloads and executes remote code, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.