llm-app-security
Skill22 starsChanged 5 months agoMITView on GitHub
Securing a feature that calls an LLM: prompt injection as an unsolved input problem, bounding what model output is allowed to reach, tool authorization against the human rather than the model, approval gates on consequential actions, RAG context provenance, system-prompt leakage, and cost limits. Use when sending prompts to an LLM API, building a RAG pipeline, giving a model tools, rendering or executing model output, or exposing an LLM-backed endpoint.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- kenjichristopherv-del/securitymaxxingtheir own version, first seen Aug 12, 2026
- GoldenWing-360/claude-security-skillstheir own version, first seen May 12, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- GoldenWing-360/claude-security-skills★ 19same name
- kenjichristopherv-del/securitymaxxing★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository36 other files it gives its agents.
- AGENTS.mdAGENTS.md
- dist/AGENTS.mdAGENTS.md
- dist/CLAUDE.mdCLAUDE.md
- dist/copilot-instructions.mdCopilot instructions
- docs/llms-full.txtllms.txt
- docs/llms.txtllms.txt
- api-securitySkill
- auth-securitySkill
- cicd-securitySkill
- container-securitySkill
- cors-securitySkill
- crypto-misuseSkill
- database-securitySkill
- deserialization-securitySkill
- dynamic-verificationSkill
- electron-securitySkill
- error-handling-securitySkill
- file-upload-securitySkill
- frontend-securitySkill
- graphql-securitySkill
- iac-securitySkill
- iam-best-practicesSkill
- logging-securitySkill
- ml-securitySkill
- mobile-securitySkill
- protocol-securitySkill
- saas-securitySkill
- secret-detectionSkill
- secure-code-reviewSkill
- security-regression-testsSkill
- serverless-securitySkill
- ssrf-preventionSkill
- supply-chain-securitySkill
- template-injectionSkill
- threat-modelingSkill
- websocket-securitySkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 34
Start from the premise that prompt injection is not solved at the prompt layer.
- Very specific: line 57
Keep the agent's identity narrow for the same reason iam-best-practices keeps a pipeline role narrow.
- Distinctive: line 59
Put a human approval gate in front of consequential and irreversible actions: moving money, deleting or overwriting data, sending messages …
- Distinctive: line 67
Keep secrets, credentials, and internal hostnames out of the system prompt.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
LLM Application Security
Rules (for AI agents)
ALWAYS
- Start from the premise that prompt injection is not solved at the prompt layer. A model has no privileged channel: system text, user text, a retrieved document and a tool result all arrive as one context, and nothing in that context can be marked as instructions the model must obey over the rest. Message roles are a formatting convention, delimiters raise the cost of an attack, and an instruction such as "treat the following as data" is itself just more text in the same window. Design as though injection will sometimes succeed, and put the real controls after the model rather than in front of it.
- Bound what the model's output is allowed to reach. Every downstream sink — a
query builder, a shell, a file writer, an HTTP client, a renderer — must validate
model output exactly as it would validate a request body from the internet, because
that is what it is once injection is assumed.
secure-code-review,database-securityandfrontend-securityown the individual sinks; what belongs here is that model output never arrives pre-trusted. - Constrain the output's shape with structured generation — a JSON Schema, function-call mode, constrained decoding — whenever the next step consumes it programmatically, and reject anything that fails validation rather than repairing it. A schema bounds the form, not the intent: a well-formed field can still carry a hostile value, so validate the value too.
- Authorize each tool call against the human user's permissions, checked at call
time, not against what the model was told it may do. The tool allowlist is a
capability list, not an authorization decision — and the agent's own privileges are
the attack surface, because injected content drives the agent that holds them.
Keep the agent's identity narrow for the same reason
iam-best-practiceskeeps a pipeline role narrow. - Put a human approval gate in front of consequential and irreversible actions: moving money, deleting or overwriting data, sending messages on a user's behalf, publishing, changing permissions. Injection that reaches a read-only tool is an information problem; injection that reaches a write tool is an incident. The gate is what keeps a single injected instruction from being final.
- Give retrieved content provenance and carry it through: which source, which tenant, which trust level. Retrieval is where the untrusted input usually enters, and the retriever is the last component that still knows where the text came from.
- Keep secrets, credentials, and internal hostnames out of the system prompt. Prompt-extraction is reliable enough to treat the system prompt as public, so it can hold instructions but not material whose value depends on staying hidden.
- Validate model parameters server-side — model name, system prompt, tool list, temperature. A client that can choose them can downgrade to a weaker model, replace your instructions, or widen the tool set.
- Bound the cost: per-tenant token budgets, request quotas, a cap on agent iterations
and tool calls per task, and a wall-clock timeout. An agent loop with no ceiling is
a billing incident that an attacker can trigger deliberately.
api-securityowns the endpoint's rate limiting. - Record what was sent and what came back — prompt, model and version, retrieved
context, tool calls — for audit, under
logging-security's redaction policy. Without the retrieved context, an injection incident cannot be reconstructed. - Consult
ml-securitybefore loading a model artifact — a checkpoint, an adapter, a fine-tune pulled from a hub. That skill owns the artifact: its format, its provenance, and the fact that loading a pickle-backed checkpoint executes code. This skill covers the application that calls a model, not the file the model arrives in.
NEVER
- Build a prompt by concatenating user input into a string that also carries your instructions. Use the API's message structure — not because roles are a security boundary, but because a single concatenated string loses even the provenance you would need to investigate.
- Hand model output straight to
eval,exec,os.system,subprocess(shell=True),vm.runInNewContext, or a raw SQL call. - Render unfiltered model output as HTML or Markdown that can load remote resources. A model-emitted image URL is a silent exfiltration channel: the model writes the data into the query string and the victim's browser sends it.
- Cache responses keyed on prompt text alone. Prompts share prefixes across users, and the cache key has to carry the tenant and the caller's authorization context.
- Let an agent expand its own capabilities mid-task — registering new tools, editing its own instructions, or raising its own limits — without the same approval the action itself would need.
KNOWN FALSE POSITIVES
- Red-team and evaluation harnesses exercise jailbreak prompts on purpose. They belong in an isolated environment with no production credentials and no live tools, and their prompts are not findings.
- A read-only tool reachable by an agent without an approval gate is the intended design. The gate exists for actions that change state or leave the system.
- Detection signatures for injection patterns are defensive content, not payloads — a scanner flagging the pattern file is matching on the thing that catches the attack.
Context (for humans)
The uncomfortable premise of this skill is that its central risk has no fix at the layer people reach for first. Prompt injection persists because a language model consumes one undifferentiated context: there is no mechanism by which some of that text carries authority the rest does not. Delimiters, role labels, and "ignore any instructions in the following" all raise the attacker's cost and none of them establish a boundary. Treating them as one is how a system gets built with the defenses in the wrong place.
So the useful question is not "how do I stop injection" but "what happens when it works". That answer is entirely in the surrounding architecture: what tools exist, whose permissions they run with, which actions can be taken without a human, and what the model's output is allowed to touch. An assistant that can only read is a disclosure risk. The same assistant with a write tool and the deploy role is an incident waiting for one hostile document to enter the index.
For the model artifacts themselves — checkpoint formats, poisoning, training-data
handling — see ml-security. This skill covers the application that calls a model.
References
references/verifying-findings.md— confirm or refute a finding, then lock itrules/prompt_injection_patterns.json- OWASP Top 10 for LLM Applications 2025.
- OWASP GenAI Security Project — including the Agentic Applications work.
- MITRE ATLAS.
- CWE-1426 — Improper Validation of Generative AI Output.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

