injection-prevention

injection-prevention is a skill for Claude Code from HermeticOrmus/LibreSecOps-Claude-Code. It costs 64 tokens per session (2,530 once invoked), scanned A, original, MIT.

A security guide for preventing injection attacks, where untrusted input is mistaken for code or commands by another system.

In plain words
What is it for?
Use it to apply parameterized queries, context-specific encoding, and allowlists against SQL injection, XSS, command injection, path traversal, LDAP, and template injection.
Why use it?
It helps prevent attackers from changing database queries, web pages, shell commands, file paths, or templates through crafted input.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: positional $N argument.

Part of the secure-coding-practices plugin — 2 skills, 2 commands, 2 agents shipped together

Good fit Use it to apply parameterized queries, context-specific encoding, and allowlists against SQL injection, XSS, command injection, path traversal, LDAP, and template injection.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hermeticormus/libresecops-claude-code/injection-prevention
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.

Any agent
npx skills add HermeticOrmus/LibreSecOps-Claude-Code --skill injection-prevention
Clone the repo
git clone --depth 1 https://github.com/HermeticOrmus/LibreSecOps-Claude-Code

Made for: Claude Code.

Or install secure-coding-practices, the plugin that ships this one along with the rest of its 2 skills, 2 commands, 2 agents.

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 injection-prevention

README.md
[![agentmods](https://agentmods.dev/badge/skills/hermeticormus/libresecops-claude-code/injection-prevention/github.svg)](https://agentmods.dev/skills/hermeticormus/libresecops-claude-code/injection-prevention)
Your own site
<a href="https://agentmods.dev/skills/hermeticormus/libresecops-claude-code/injection-prevention"><img src="https://agentmods.dev/badge/skills/hermeticormus/libresecops-claude-code/injection-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 injection-prevention

Your own site · 80×15
<a href="https://agentmods.dev/skills/hermeticormus/libresecops-claude-code/injection-prevention"><img src="https://agentmods.dev/badge/skills/hermeticormus/libresecops-claude-code/injection-prevention.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 64 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,530 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 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.00064 $0.02530
Opus 5.5 $0.00026 $0.01012
Sonnet 5.5 $0.00013 $0.00506
Haiku 4.5 $0.00006 $0.00253

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

Security

Grade A, and why

injection-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 1mo 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.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

os.system(f"convert {filename} output.png")
plugins/secure-coding-practices/skills/injection-prevention/SKILL.md · 253 lines

How it starts

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

Injection Prevention

Comprehensive injection prevention patterns for SQL, XSS, command injection, path traversal, LDAP, and template injection across all major languages and frameworks.

Knowledge Base

The Fundamental Principle

Injection occurs when untrusted data is interpreted as code or structure by a downstream processor. The universal prevention is to ensure the processor can distinguish data from code. This is achieved through:

  1. Parameterization -- Sending data through a separate channel from code (prepared statements, argument arrays)
  2. Context-aware encoding -- Transforming data so it is inert in the target context (HTML encoding, URL encoding)
  3. Allowlist validation -- Accepting only data that matches a known-safe pattern (enum values, regex matching)

Denylist filtering (blocking known-bad characters) is almost always insufficient because there are too many encoding variations and bypass techniques.

SQL Injection

Root cause: User input concatenated into SQL query strings.

Prevention by language:

# VULNERABLE
cursor.execute(f"SELECT * FROM users WHERE name = '{name}'")

# SECURE - Parameterized query
cursor.execute("SELECT * FROM users WHERE name = %s", (name,))

# SECURE - Django ORM (parameterized by default)
User.objects.filter(name=name)

# VULNERABLE - Django raw with string formatting
User.objects.raw(f"SELECT * FROM users WHERE name = '{name}'")

# SECURE - Django raw with params
User.objects.raw("SELECT * FROM users WHERE name = %s", [name])
// VULNERABLE
db.query(`SELECT * FROM users WHERE name = '${name}'`);

// SECURE - Parameterized (pg library)
db.query('SELECT * FROM users WHERE name = $1', [name]);

// SECURE - Prisma ORM (parameterized by default)
prisma.user.findMany({ where: { name } });

// VULNERABLE - Sequelize literal
sequelize.query(`SELECT * FROM users WHERE name = '${name}'`);

// SECURE - Sequelize parameterized
sequelize.query('SELECT * FROM users WHERE name = :name', {
  replacements: { name }
});

Read the full file on GitHub · 253 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. 1mo ago Changed · +5 lines · +64 tokens per session 48d0fd100e45
  2. 2mo ago First seen · 248 lines · 0 tokens per session scan A 74cb1b55adb7

Subscribe to this mod's changes

injection-prevention is a skill published in the GitHub repository HermeticOrmus/LibreSecOps-Claude-Code (4 stars, last pushed 1mo ago), licensed MIT. It adds 64 tokens to every session and 2,530 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

injection-prevention compared with skills from other repositories

injection-prevention next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
injection-preventionHermeticOrmus/LibreSecOps-Claude-CodeSkill41mo agoMITA64Claude Code
engineer-production-systemskingggg5/shipproofSkill193d agoMITA86Claude Code, Codex
jwt_tooltr4m0ryp/shorSkill141mo agononeA52Claude Code, Codex
sstimaptr4m0ryp/shorSkill141mo agononeA51Claude Code, Codex
ffuftr4m0ryp/shorSkill141mo agononeA53Claude Code, Codex
hunt-api-misconfigelementalsouls/Claude-BugHunterSkill28kyesterdayMITA207Claude Code
implementing-devsecops-security-scanningxalgorix/xalgorixSkill1.5kyesterdayApache-2.0A109Claude Code, Codex