cloud-platform-skills / skills
Cursor rule1 starsChanged 4 months agoMITView on GitHub
Security for LLM and agent systems: direct and indirect prompt injection, the OWASP Top 10 for LLM Applications, MITRE ATLAS technique mapping, excessive agency and tool-scope containment, egress allowlisting to stop data exfiltration, human confirmation for irreversible actions, and treating third-party skills and MCP servers as untrusted code. Use when an agent is given tools or credentials, when retrieved documents or repository files could carry injected instructions, or when reviewing an AI feature before it reaches production.
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 1,523 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository167 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .agents/rules/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/00-index.mdcCursor rule
- .cursor/rules/skills/api-gateway-service-mesh.mdcCursor rule
- .cursor/rules/skills/aws-cloud-migration-strategies.mdcCursor rule
- .cursor/rules/skills/aws-eks-enterprise-patterns.mdcCursor rule
- .cursor/rules/skills/aws-iam-zero-trust-policies.mdcCursor rule
- .cursor/rules/skills/azure-aks-enterprise-landing-zones.mdcCursor rule
- .cursor/rules/skills/azure-cloud-engineering-patterns.mdcCursor rule
- .cursor/rules/skills/backup-and-disaster-recovery.mdcCursor rule
- .cursor/rules/skills/chaos-engineering-resilience-testing.mdcCursor rule
- .cursor/rules/skills/cicd-pipeline-design.mdcCursor rule
- .cursor/rules/skills/cloud-native-microservices-patterns.mdcCursor rule
- .cursor/rules/skills/cloud-security-posture-cspm-cis.mdcCursor rule
- .cursor/rules/skills/configuration-management-ansible.mdcCursor rule
- .cursor/rules/skills/container-runtime-security-falco.mdcCursor rule
- .cursor/rules/skills/database-devops-lifecycle.mdcCursor rule
- .cursor/rules/skills/detection-engineering-threat-hunting.mdcCursor rule
- .cursor/rules/skills/devops-metrics-dora-kpis.mdcCursor rule
- .cursor/rules/skills/docker-containerization-basics.mdcCursor rule
- .cursor/rules/skills/enterprise-iac-governance-terragrunt.mdcCursor rule
- .cursor/rules/skills/finops-framework-inform-optimize-operate.mdcCursor rule
- .cursor/rules/skills/gcp-cloud-engineering-patterns.mdcCursor rule
- .cursor/rules/skills/gcp-gke-autopilot-multi-tenant.mdcCursor rule
- .cursor/rules/skills/git-branching-merge-strategies.mdcCursor rule
- .cursor/rules/skills/gitops-multi-cluster-argo-flux.mdcCursor rule
- .cursor/rules/skills/helm-kubernetes-deployment.mdcCursor rule
- .cursor/rules/skills/incident-management-and-postmortem.mdcCursor rule
- .cursor/rules/skills/infrastructure-host-monitoring.mdcCursor rule
- .cursor/rules/skills/internal-developer-portal-backstage.mdcCursor rule
- .cursor/rules/skills/linux-sysadmin-troubleshooting.mdcCursor rule
- .cursor/rules/skills/performance-load-testing.mdcCursor rule
- .cursor/rules/skills/policy-as-code-opa-kyverno.mdcCursor rule
- .cursor/rules/skills/prometheus-grafana-otel-tracing.mdcCursor rule
- .cursor/rules/skills/scalability-high-availability-patterns.mdcCursor rule
- .cursor/rules/skills/scripting-and-automation.mdcCursor rule
- .cursor/rules/skills/secops-incident-triage-forensics.mdcCursor rule
- .cursor/rules/skills/secrets-management-vault-kms.mdcCursor rule
- .cursor/rules/skills/serverless-event-driven-architecture.mdcCursor rule
- .cursor/rules/skills/shift-left-security-sast-sca.mdcCursor rule
- .cursor/rules/skills/sli-slo-error-budget-design.mdcCursor rule
- .cursor/rules/skills/supply-chain-security-slsa-sigstore.mdcCursor rule
- .cursor/rules/skills/terraform-iac-modules.mdcCursor rule
- .cursor/rules/skills/write-a-skill.mdcCursor rule
- .cursor/rules/skills/zero-downtime-release-strategies.mdcCursor rule
- ai-agent-security-llm-threatsSkill
- api-gateway-service-meshSkill
- aws-cloud-migration-strategiesSkill
- aws-eks-enterprise-patternsSkill
- aws-iam-zero-trust-policiesSkill
- azure-aks-enterprise-landing-zonesSkill
- azure-cloud-engineering-patternsSkill
- backup-and-disaster-recoverySkill
- chaos-engineering-resilience-testingSkill
- cicd-pipeline-designSkill
- cloud-native-microservices-patternsSkill
- cloud-security-posture-cspm-cisSkill
- configuration-management-ansibleSkill
- The first 60 shown.
The file
We split this ai-agent-security-llm-threats.mdc into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 157
Fail closed: If a guardrail or classifier is unavailable, refuse rather than proceed unchecked.
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule 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
---
description: "Security for LLM and agent systems: direct and indirect prompt injection, the OWASP Top 10 for LLM Applications, MITRE ATLAS technique mapping, excessive agency and tool-scope containment, egress allowlisting to stop data exfiltration, human confirmation for irreversible actions, and treating third-party skills and MCP servers as untrusted code. Use when an agent is given tools or credentials, when retrieved documents or repository files could carry injected instructions, or when reviewing an AI feature before it reaches production."
globs:
alwaysApply: false
---
# AI and Agent Security: Prompt Injection, Excessive Agency, and Tool Containment
## When to Use This Skill
**Triggers — load this skill when:**
- An agent is being given tools, credentials, or write access to real systems
- Content the model reads — retrieved documents, issues, web pages, skill files — is untrusted
- An AI feature needs a security review before production
- A third-party skill, plugin, or MCP server is being adopted
- Model or agent output flows into a shell, SQL query, browser, or another system
**Route elsewhere when:**
- Scanning application code and dependencies -> `shift-left-security-sast-sca`
- Verifying the provenance of a model or container artifact -> `supply-chain-security-slsa-sigstore`
- Enforcing cluster-level guardrails on the workload -> `policy-as-code-opa-kyverno`
- Handling a confirmed compromise or leaked credential -> `secops-incident-triage-forensics`
- Scoping the IAM role the agent assumes -> `aws-iam-zero-trust-policies`
## 1. The threat model is inverted: instructions are the attack surface
A conventional service processes data. An agent processes **instructions that arrive as data** and
then acts with the operator’s credentials. Prompt injection is not a bug to be patched — it is a
consequence of that design, so the controls are containment controls, not filters.
Two forms, with very different exposure:
| Form | Delivery | Why it is worse or better |
| --- | --- | --- |
| Direct | The user types it | Bounded: the user already has their own privileges |
| **Indirect** | A retrieved page, ticket comment, code comment, PDF, skill file, or MCP tool description | The attacker is not the user, needs no account, and the payload arrives inside content the operator trusts |
Indirect injection is where real incidents come from. Assume any content the model reads may contain
instructions, and design so that acting on them is survivable.
## 2. OWASP Top 10 for LLM Applications (2025 edition) — the control for each
| ID | Risk | Control that actually helps |
| --- | --- | --- |
| LLM01 | Prompt injection | Least-privilege tools, human confirmation on irreversible actions, egress allowlist |
| LLM02 | Sensitive information disclosure | Keep secret material out of context; supply it at call time, never in the prompt |
| LLM03 | Supply chain | Pin and verify models, skills, and MCP servers; review before adoption |
| LLM04 | Data and model poisoning | Provenance on training and RAG corpora; signed, versioned index builds |
| LLM05 | Improper output handling | Treat output as untrusted input: parameterise, escape, never evaluate it |
| LLM06 | Excessive agency | Scope each tool to one capability; no broad execute-anything tool |
| LLM07 | System prompt leakage | Put nothing confidential in the system prompt; assume it is public |
| LLM08 | Vector and embedding weaknesses | Per-tenant index isolation; authorise retrieval, not just the query |
| LLM09 | Misinformation | Ground answers in citations; require abstention paths |
| LLM10 | Unbounded consumption | Per-identity rate and token budgets, tool-call ceilings, hard timeouts |
Map findings to **MITRE ATLAS** for reporting alongside conventional detections, so AI risk lands in
the same register as everything else rather than in a separate document nobody reads.
## 3. Contain agency: the only control that survives a successful injection
Filtering prompts is defence in depth at best. Assume the injection succeeds, then ask what it can
reach.
```yaml
# Tool scope: one capability per tool, narrowest possible parameters
tools:
- name: read_ticket
scope: "jira:issue:read"
allow: ["PROJ-*"] # not every project
- name: post_comment
scope: "jira:comment:write"
rate_limit: "10/hour"
# NOT a tool: run_shell, execute_sql, fetch_arbitrary_url — each is a universal
# capability that converts any injection into arbitrary action.
confirmation_required: # irreversible or outward-facing: a human approves, every time
- delete_*
- send_email
- post_to_slack
- merge_pull_request
- deploy_*
egress:
# Exfiltration needs a channel. Remove the channel.
default: deny
allow: ["api.internal.example.com", "api.anthropic.com"]
budgets:
max_tool_calls_per_task: 40
max_tokens_per_identity_per_day: 2_000_000
wall_clock_timeout: 300s
```
Three properties do the real work:
1. **No universal tool.** A run-anything or fetch-any-URL tool collapses every injection into full
compromise. Ten narrow tools are safer than one flexible one.
2. **Egress allowlist.** Injected instructions telling the agent to send environment variables to an
attacker-controlled host fail at the network, regardless of what the model decided.
3. **Short-lived, scoped credentials.** OIDC federation with a role scoped to the agent’s task, so a
successful injection inherits minutes of narrow access rather than a static key.
## 4. Output is untrusted input
```python
# WRONG — the model’s string is interpolated into a command line that a shell will parse,
# so any injected shell metacharacter becomes execution.
run_via_shell(f"kubectl scale deploy/{model_output} --replicas=3")
# CORRECT — validate against an allowlist, then exec argv directly; no shell parses anything.
if model_output not in ALLOWED_DEPLOYMENTS:
raise ValueError(f"deployment not permitted: {model_output!r}")
subprocess.run(["kubectl", "scale", f"deploy/{model_output}", "--replicas=3"], check=True)
```
The same rule applies to SQL (parameterise), HTML (escape — model output rendered raw is stored XSS),
and file paths (resolve and confirm containment under the intended root). “The model produced it” is
not a trust boundary.
## 5. Third-party skills, plugins, and MCP servers are untrusted code
An agent skill is a set of instructions your agent will execute with your credentials. Review one the
way you would review a dependency that ships with shell access, because that is what it is.
<!-- agent-safety-justified: this skill teaches detection of agent-directed harm, so it must name the attack shapes a reviewer looks for (redirection, concealment, confirmation bypass, exfiltration). Every mention sits in a review checklist or a Do-not list: the reader is told to REJECT these patterns, never to perform them. -->
**Review checklist before adopting:**
- [ ] No instruction that redirects the agent away from the operator’s intent, overrides earlier
instructions, or tells it to conceal what it is doing
- [ ] No exfiltration shape — reading credential files or environment variables and sending them
anywhere, including encode-then-upload
- [ ] No unguarded destructive command presented as routine
- [ ] No confirmation bypass — forced flags, auto-yes, or “skip the approval step”
- [ ] Tool and permission requests are proportionate to the stated purpose
- [ ] Pinned to a commit, not a moving branch, and re-reviewed on upgrade
- [ ] MCP tool _descriptions_ reviewed too: the description is model-visible text and is an injection
vector in itself
Automate the mechanical half. The compliance gate at the root of this repository (`compliance-check`)
scans every skill for agent-directed harm and exfiltration patterns and treats any hit as a blocker —
worth copying into any pipeline that ingests third-party agent content.
## 6. Best practices and anti-patterns
**Do:**
- **Threat-model the tools, not the prompt.** The blast radius is the union of what the tools reach.
- **Log every tool call with its arguments and the human decision** on confirmations. Without a tool
audit trail, an AI incident cannot be reconstructed.
- **Isolate per tenant end to end** — including the vector index. Shared embeddings leak across
customers even when the application layer is correct.
- **Red-team with injected content**, not just adversarial prompts: plant a payload in a ticket, a
README, a retrieved page, and confirm containment held.
- **Fail closed.** If a guardrail or classifier is unavailable, refuse rather than proceed unchecked.
- **Give the model an abstention path**, so “I don’t know” is available and fabrication is not the
only way to satisfy the request.
**Do not:**
- **Rely on the system prompt as a security control.** An instruction not to reveal something is a
request, not a boundary; the model has no privileged execution mode.
- **Put secret material in context.** Anything in the prompt is one injection away from being echoed.
Supply credentials at call time, outside the model’s view.
- **Ship a universal shell or arbitrary-URL tool.** It converts every injection into arbitrary
execution and cannot be made safe by prompting.
- **Trust a blocklist of injection phrases.** Known phrasings are trivially paraphrased; containment
is what holds.
- **Let an agent approve its own irreversible actions**, including its own confirmation prompts.
- **Treat an AI incident as a separate discipline.** Route it through the same on-call, severity, and
post-mortem process as any other production security event.
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.

