Analyze a project repository and build a project-specific threat model, then derive from it the secure coding rules that go into SECURITY.md — covering both classical security and the OWASP Top 10 for Agentic Applications 2026 (ASI01–ASI10). Use when the user asks to create a security policy, generate a threat model, or establish secure coding rules for a repository.
Generate a project-specific SECURITY.md by analyzing the codebase, dependencies, configuration, and architecture. The output covers: supported versions, vulnerability reporting, threat model, security architecture, secure coding rules, and AI agent constraints.
⛔ Scope Boundary — read before doing anything
This skill does exactly two things and nothing more:
Build an adequate threat model for this specific project — its assets, attack surface, trust boundaries, and the threats that apply given its real architecture and stack.
Derive secure coding rules from that threat model, for both human contributors and coding agents.
This skill does NOT audit the project for compliance with the policy it builds, and it does NOT record any such audit results in SECURITY.md. Specifically, the agent MUST NOT:
Check whether the existing codebase already satisfies the rules it just wrote, or grade the project against the OWASP/ASI categories ("control present / gap / not applicable").
Populate SECURITY.md with findings about what is missing, broken, misconfigured, or non-compliant in the current code (e.g., "input validation absent on endpoint X", "rate limiting missing", "ASI01: no mitigation found").
Turn SECURITY.md into a code-review or penetration-test report.
A threat describes what could go wrong given the architecture (forward-looking): "because this service exposes a public API, injection is a relevant threat → therefore the coding rules require parameterized queries and input validation at all boundaries." A compliance finding describes what the code currently lacks — that belongs in a review report, an audit, or the issue tracker, never in SECURITY.md.
The codebase is studied only to understand the architecture well enough to model threats accurately and to tailor the coding rules to the real stack — never to score the project against the policy.
This skill produces a policy that covers two complementary risk domains:
Classical application security — the OWASP Top 10 (Web/Cloud), injection, auth, crypto, supply chain, etc. Always applicable.
Agentic application security — the OWASP Top 10 for Agentic Applications (2026), identifiers ASI01–ASI10. Applies whenever the project builds AI agents that plan, act, call tools, remember across sessions, or communicate with other agents on behalf of users.
The agentic section is conditional: a pure chatbot or RAG setup with no tool use and no multi-agent coordination needs only classical controls (and, where relevant, the OWASP Top 10 for LLM Applications). The moment the system takes actions on behalf of a user, the agentic threat model becomes mandatory. The reconnaissance script (scripts/recon.sh) auto-detects agentic indicators (LLM/agent SDKs, MCP, vector stores, prompt files, tool-calling patterns) and flags whether the agentic section should be generated.
The reconnaissance script reports an "Agentic AI Indicators" section with a summary flag. If AGENTIC PROJECT DETECTED appears, the OWASP Top 10 for Agentic Applications (ASI01–ASI10) section MUST be generated; otherwise it may be omitted (classical controls suffice). Verify the flag manually against the "Agentic components" row above.
Key questions to clarify with user (use AskUserQuestion if available):
What type of application is this? (web service / CLI tool / library / mobile app / desktop app)
What deployment environment? (cloud provider, on-prem, hybrid)
Who are the users? (internal employees / external customers / developers / public)
Is there an existing security contact or process?
Does the application include AI agents that take actions on behalf of users (call tools, write to systems, make decisions autonomously)? If yes, the agentic threat model (ASI01–ASI10) is required.
Step 2: Identify Assets and Data Flows
Determine what the project stores, processes, and transmits.
CI/CD triggers (workflow_dispatch, PR events from forks)
Admin/debug endpoints (check if properly gated)
When agentic components are present, add these entry points:
Agent prompt inputs — user messages, RAG-retrieved documents, web pages, and tool outputs entering the model context (ASI01 indirect-injection vectors)
Agent tool / function-calling surface — every tool the agent may invoke, especially side-effecting operations (ASI02)
External tool & MCP registries — dynamically integrated tools, plugins, and schemas whose descriptions/permissions may be forged (ASI04)
Agent-generated code / shell execution — sandboxed or unsandboxed environments running model output (ASI05)
Agent memory stores — vector DBs, long-term memory, and conversation logs writable by the agent (ASI06)
Whether security-critical functions use well-known libraries vs custom code
Agentic supply chain (ASI04): third-party tools, MCP servers, and plugin packages — are they pinned, vetted, provenance-verified? Are tool descriptions reviewed for deceptive language? Is dynamic tool discovery allowed?
Step 5: Identify Security-Relevant Architecture
The goal here is not to audit whether the codebase's existing controls are correct or complete — that is out of scope (see Scope Boundary). The goal is to recognize which security domains this architecture actually involves, so the threat model (Step 3) and the coding rules (Step 7) cover the right ground and stay relevant to the real stack rather than listing every generic control.
Scan the codebase to answer one question per domain: "Is this domain relevant to how this system is built?" Use the categories below as a checklist of domains to consider:
Category
What "relevant" means here
AuthN
The system authenticates anyone (users, services) — middleware, tokens, sessions
AuthZ
The system distinguishes permissions — roles, guards, policy engines
Input validation
The system accepts external input — API params, CLI args, file uploads, webhooks
CSRF protection
The system has browser-facing state-changing endpoints
Rate limiting
The system exposes public or shared endpoints
Encryption
The system stores or transmits sensitive data
Secret management
The system handles secrets — API keys, DB credentials, signing keys
Logging & audit
The system produces security-relevant events worth recording
Security headers
The system serves HTML/web content to browsers
Container security
The system ships as a container image
Agent guardrails (agentic)
The system builds agents that consume untrusted content in-context (ASI01)
Tool-call governance (agentic)
The system's agents invoke side-effecting tools (ASI02)
Code-exec sandboxing (agentic)
The system runs agent-generated code or shell commands (ASI05)
Memory protection (agentic)
The system persists agent memory/vector stores across sessions (ASI06)
Inter-agent security (agentic)
The system coordinates multiple agents over a message channel (ASI07)
Resilience (agentic)
The system chains agents/tools whose failures could cascade (ASI08)
For each domain you mark relevant, note only enough to inform the threat model and rules:
Why it's relevant — the architectural reason (e.g., "public REST API with session cookies → CSRF domain applies")
What the rules must address — the concrete concerns the coding rules will need to cover for this domain
Do not record implementation locations, coverage gaps, or "what's missing" — those are review findings, not policy inputs.
Step 6: Identify Relevant Agentic Threats — OWASP Top 10 for Agentic Applications (ASI01–ASI10)
Conditional step. Skip entirely if Step 1 did not detect agentic components (the recon script prints No strong agentic indicators). For a pure chatbot / RAG system with no tool use and no multi-agent coordination, classical controls and the OWASP Top 10 for LLM Applications suffice. The moment the system takes actions on behalf of a user, this step is required.
Not an audit. As with Step 5, the goal is not to score the current codebase ("does it pass ASI02?"). It is to determine, per category, whether the threat applies to how this system is built, and if so, what the coding rules (Step 7) and the threat-model entries must require. Do not record "control present / gap / not applicable" verdicts against the existing code, and do not push anything into Known Risks based on what the code currently lacks.
The unifying principle is least agency — grant an agent only the minimum autonomy required for a safe, bounded task. Ask, for every agent: what is its reach (least privilege) AND what is its latitude within that reach (least agency)?
For each category, answer two questions only: (a) Is this threat relevant given the architecture? (b) If yes, what must the rules require? Skip any category the architecture provably doesn't involve, noting why.
ASI01 — Agent Goal Hijacking. Relevant when agents ingest untrusted content (user input, tool outputs, retrieved docs, web pages) into context. If so, the rules must require instruction/data separation, input/output filtering, privilege separation between instructions and data, and treating all retrieved/tool-produced text as data.
ASI02 — Tool Misuse and Exploitation. Relevant when agents can call tools, especially side-effecting ones. If so, the rules must require per-tool least privilege, validated parameter schemas, restriction of dangerous operations regardless of agent request, a tool-call allowlist, budget/loop caps, and approval gates for irreversible actions.
ASI03 — Agent Identity and Privilege Abuse. Relevant when agents act under delegated or inherited credentials. If so, the rules must require per-agent verified identities, scoped/rotated credentials, confused-deputy prevention, and action logging with the verified principal.
ASI04 — Agentic Supply Chain Compromise. Relevant when third-party tools, MCP servers, or plugins are integrated (especially dynamically). If so, the rules must require pinning/vetting, description review, provenance verification, and sandboxing of new tools.
ASI05 — Unexpected Code Execution. Relevant when agent-generated code or shell commands run. If so, the rules must require sandbox isolation (restricted FS/network), approval gates for high-risk execution, argument scanning, ephemeral cleanup, and resource limits.
ASI06 — Memory and Context Poisoning. Relevant when agent memory/vector stores persist across sessions. If so, the rules must require write/read validation, poisoning-pattern scanning, purge capability, session isolation, and retention/TTL.
ASI07 — Insecure Inter-Agent Communication. Relevant when agents exchange messages over a bus or delegation protocol. If so, the rules must require authenticated/integrity-protected messages, delegation-depth limits, impersonation resistance, defined cross-agent permissions, and transport security.
ASI08 — Cascading Agent Failures. Relevant when agents/tools are chained such that one failure propagates. If so, the rules must require circuit breakers, fail-closed behavior, bulkheads, per-dependency fallback, and cascade monitoring.
ASI09 — Human-Agent Trust Exploitation. Relevant when human approval/HITL gates exist. If so, the rules must require showing raw intent (not agent summaries), approval rate-limiting, AI-generated labeling, and policy-engine-generated justifications.
ASI10 — Rogue Agents. Relevant when agents operate with any autonomy (drift, collusion, runaway). If so, the rules must require behavioral-drift monitoring, an auditable receipt chain, a kill-switch/circuit-breaker, periodic alignment checks, and autonomy bounds (max steps, time-boxed sessions).
Step 7: Derive Secure Coding Rules
Based on the discovered tech stack, generate project-specific coding rules.
Use the template from template.md and fill in each section with discovered data.
Section-by-section guidance:
Section
Source
Supported Versions
Git tags, CHANGELOG, CI release config
Reporting a Vulnerability
User input (or infer from existing SECURITY.md / CONTRIBUTING.md)
Assets
Step 2 output
Threat Actors
Standard list, adjusted to project's exposure level
Attack Surface
Step 3 output
Trust Boundaries
Infer from architecture (edge → app → data layer); add agent trust boundaries if agentic
Known Risks
Inherent architectural risks the design knowingly accepts (e.g., "MVP uses a single shared DB user") — never a list of what the current code is missing vs. the policy; compliance findings do not go here
Security Architecture
Step 5 output — which security domains apply to this architecture and what the policy requires of each
Agentic Application Security
Step 6 output (ASI01–ASI10) — include only if agentic indicators detected
Secure Coding Guidelines
Step 7 output
Rules for AI Coding Agents
Derived from stack + project-specific patterns + agentic constraints (ASI09/ASI10)
Security-Related Config Files
Files found in Step 1
Writing rules:
Remove {{ }} placeholder markers from filled sections
Keep {{ }} only for sections that could not be filled (note why)
Be specific: reference actual file paths, library names, config values
Include concrete examples from the codebase where helpful
Mark assumptions explicitly: "Assumed based on [evidence]"
Step 9: Register SECURITY.md in AGENTS.md
Ensure that AI coding agents working on the repository are aware of the security policy. Add or update a reference to SECURITY.md in the project's AGENTS.md file.
If AGENTS.md exists — add a section (or append to an existing "Security" / "Guidelines" section):
## Security Policy
This project maintains a security policy in [SECURITY.md](./SECURITY.md).
All AI coding agents MUST read and follow SECURITY.md before making changes.
It contains:
- Threat model and trust boundaries
- Secure coding guidelines specific to this project's stack
- Hard constraints and forbidden patterns for AI agents
- Vulnerability reporting procedures
- Agentic security controls (OWASP Top 10 for Agentic Applications ASI01–ASI10), where applicable
Any code contribution that violates the rules in SECURITY.md will be rejected.
If AGENTS.md does not exist — create it with at minimum the security reference above, plus a brief header:
# Agent Guidelines
Instructions for AI coding agents (GitHub Copilot, Cursor, Qoder, etc.)
working on this repository.
## Security Policy
This project maintains a security policy in [SECURITY.md](./SECURITY.md).
All AI coding agents MUST read and follow SECURITY.md before making changes.
It contains:
- Threat model and trust boundaries
- Secure coding guidelines specific to this project's stack
- Hard constraints and forbidden patterns for AI agents
- Vulnerability reporting procedures
- Agentic security controls (OWASP Top 10 for Agentic Applications ASI01–ASI10), where applicable
Any code contribution that violates the rules in SECURITY.md will be rejected.
Important: Do not duplicate the full security rules in AGENTS.md — reference SECURITY.md as the single source of truth. AGENTS.md should only contain a pointer and a brief summary of what agents will find there.
Step 10: Validate Completeness
After generating, verify:
Every section either filled or marked with reason for incompleteness
No placeholder text left unmarked
Asset sensitivity ratings are justified
Attack surface entries match actual routes in codebase
Dependency counts match actual lockfile
Secure coding rules match the actual tech stack (no irrelevant rules)
AI agent rules reference patterns actually present in the project
No secrets or sensitive internal details exposed in the document
Revision history has today's date
AGENTS.md exists and references SECURITY.md
AGENTS.md does NOT duplicate security rules (only references them)
If agentic indicators were detected: ASI01–ASI10 section present, with each applicable category stating what the rules require (non-applicable categories justified and skipped)
If no agentic indicators: the Agentic Application Security section is explicitly omitted with a one-line note (no stale placeholders)
No audit findings in the document — SECURITY.md contains no statements grading the current code against the policy (e.g., "missing rate limiting on /api/x", "ASI02: no mitigation found", "input validation absent"). Known Risks lists only inherent architectural trade-offs the design knowingly accepts, never code-compliance gaps.
Output Location
Save the generated SECURITY.md to the project root directory. If one already exists, back it up first and present both versions for comparison.
Tone and Audience
The document will be read by:
Security researchers evaluating the project
New contributors learning project security standards
AI coding agents operating on the codebase
Auditors reviewing the security policy
Write in clear, imperative, technical language. Avoid marketing fluff. Prefer concrete over abstract.
1---2name: security-policy-generator3description: Analyze a project repository and build a project-specific threat model, then derive from it the secure coding rules that go into SECURITY.md — covering both classical security and the OWASP Top 10 for Agentic Applications 2026 (ASI01–ASI10). Use when the user asks to create a security policy, generate a threat model, or establish secure coding rules for a repository.4---56# Security Policy Generator78Generate a project-specific SECURITY.md by analyzing the codebase, dependencies, configuration, and architecture. The output covers: supported versions, vulnerability reporting, threat model, security architecture, secure coding rules, and AI agent constraints.910> ### ⛔ Scope Boundary — read before doing anything11>12> This skill does exactly **two things** and nothing more:13>14> 1. **Build an adequate threat model** for *this specific project* — its assets, attack surface, trust boundaries, and the threats that apply given its real architecture and stack.15> 2. **Derive secure coding rules** from that threat model, for both human contributors and coding agents.16>17> This skill does **NOT** audit the project for compliance with the policy it builds, and it does **NOT** record any such audit results in SECURITY.md. Specifically, the agent MUST NOT:18>19> - Check whether the existing codebase already satisfies the rules it just wrote, or grade the project against the OWASP/ASI categories ("control present / gap / not applicable").20> - Populate SECURITY.md with findings about what is missing, broken, misconfigured, or non-compliant in the current code (e.g., "input validation absent on endpoint X", "rate limiting missing", "ASI01: no mitigation found").21> - Turn SECURITY.md into a code-review or penetration-test report.22>23> A *threat* describes what **could** go wrong given the architecture (forward-looking): "because this service exposes a public API, injection is a relevant threat → therefore the coding rules require parameterized queries and input validation at all boundaries." A *compliance finding* describes what the code **currently** lacks — that belongs in a review report, an audit, or the issue tracker, **never** in SECURITY.md.24>25> The codebase is studied only to understand the architecture well enough to model threats accurately and to tailor the coding rules to the real stack — never to score the project against the policy.2627This skill produces a policy that covers **two complementary risk domains**:28291. **Classical application security** — the OWASP Top 10 (Web/Cloud), injection, auth, crypto, supply chain, etc. Always applicable.302. **Agentic application security** — the [OWASP Top 10 for Agentic Applications (2026)](https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/), identifiers ASI01–ASI10. Applies whenever the project builds AI agents that plan, act, call tools, remember across sessions, or communicate with other agents on behalf of users.3132The agentic section is **conditional**: a pure chatbot or RAG setup with no tool use and no multi-agent coordination needs only classical controls (and, where relevant, the OWASP Top 10 for LLM Applications). The moment the system takes actions on behalf of a user, the agentic threat model becomes mandatory. The reconnaissance script (`scripts/recon.sh`) auto-detects agentic indicators (LLM/agent SDKs, MCP, vector stores, prompt files, tool-calling patterns) and flags whether the agentic section should be generated.3334## Workflow3536Copy this checklist and track progress:3738```39Task Progress:40- [ ] Step 1: Project reconnaissance (incl. agentic indicators)41- [ ] Step 2: Identify assets and data flows (incl. agent assets)42- [ ] Step 3: Map attack surface (incl. agentic entry points)43- [ ] Step 4: Assess dependencies and supply chain44- [ ] Step 5: Identify security-relevant architecture (what domains apply)45- [ ] Step 6: Identify relevant agentic threats — OWASP ASI01–ASI1046- [ ] Step 7: Derive secure coding rules47- [ ] Step 8: Generate SECURITY.md48- [ ] Step 9: Register SECURITY.md in AGENTS.md49- [ ] Step 10: Validate completeness50```5152---5354## Step 1: Project Reconnaissance5556Gather foundational information about the project.5758**Automated discovery** — run the reconnaissance script first, then supplement with manual checks:5960```bash61# Run the bundled reconnaissance script from the skill directory62bash scripts/recon.sh63```6465This script automatically detects:6667- Language & framework (package files, source extensions)68- Build tools & deployment indicators69- Security configuration files70- Dependency counts71- Web frameworks, ORMs, auth libraries72- Template engines, serialization libraries, HTTP clients73- GraphQL libraries, cloud SDKs, CMS frameworks74- Test frameworks75- Dangerous code patterns (command execution, eval, deserialization, XXE)76- Version/release information7778**Supplement the script output by checking:**7980| What to find | Where to look |81| ------------------ | --------------------------------------------------------------------------- |82| API surface | OpenAPI specs, route definitions, gRPC proto files, GraphQL schemas |83| Auth mechanism | Auth middleware, OAuth config, JWT libraries, session stores |84| Data stores | DB drivers, ORM config, migration files, cache clients (Redis, Memcached) |85| Agent instructions | `AGENTS.md`, `.github/copilot-instructions.md`, `.cursorrules`, `CLAUDE.md` |86| Agentic components | LLM/inference SDKs, agent frameworks (LangChain/LangGraph, CrewAI, AutoGen), MCP servers/config, vector stores, tool/function-calling definitions, system-prompt files |8788The reconnaissance script reports an **"Agentic AI Indicators"** section with a summary flag. If `AGENTIC PROJECT DETECTED` appears, the OWASP Top 10 for Agentic Applications (ASI01–ASI10) section MUST be generated; otherwise it may be omitted (classical controls suffice). Verify the flag manually against the "Agentic components" row above.8990**Key questions to clarify with user** (use AskUserQuestion if available):91921. What type of application is this? (web service / CLI tool / library / mobile app / desktop app)932. What deployment environment? (cloud provider, on-prem, hybrid)943. Who are the users? (internal employees / external customers / developers / public)954. Is there an existing security contact or process?965. **Does the application include AI agents that take actions on behalf of users** (call tools, write to systems, make decisions autonomously)? If yes, the agentic threat model (ASI01–ASI10) is required.9798---99100## Step 2: Identify Assets and Data Flows101102Determine what the project stores, processes, and transmits.103104**Look for:**105106- Database models / schemas / migrations → identify PII, credentials, financial data107- Environment variables and config files → identify secrets and sensitive config108- File upload handlers → identify user-supplied content109- API response shapes → identify what data leaves the system110- Logging statements → identify what might be inadvertently logged111- Cache keys → identify what's stored in shared memory112113**When agentic components are present, also look for:**114115- System / role prompts → identify embedded guardrails and business logic (extraction reveals the agent's rules)116- Agent credentials & tool secrets → the API keys/OAuth tokens the agent holds; their combined scope equals the blast radius (ASI03)117- Agent memory stores & vector DBs → long-term memory and conversation history that persist across sessions (ASI06)118- Tool & MCP definitions → schemas, descriptions, and permission mappings the agent trusts (ASI04)119- Agent-generated artifacts → code, plans, and API calls produced at runtime (ASI05)120- Training / embedding data → fine-tune datasets and embeddings (poisoning vectors)121122**Classify assets by sensitivity:**123124| Sensitivity | Examples |125| ----------- | -------------------------------------------------------------------- |126| Critical | Signing keys, DB master credentials, encryption keys, payment tokens |127| High | User PII, session tokens, API keys, access logs with user context |128| Medium | Application config, internal IPs, non-sensitive business data |129| Low | Public content, marketing copy, open-source dependency list |130131---132133## Step 3: Map Attack Surface134135Identify every point where untrusted input enters the system.136137**Checklist:**138139- [ ] HTTP/gRPC/WebSocket endpoints (list all public routes)140- [ ] Authentication endpoints (login, register, password reset, OAuth callbacks)141- [ ] File upload endpoints142- [ ] Webhook receivers143- [ ] Message queue consumers144- [ ] CLI arguments and stdin145- [ ] Environment variables read at runtime146- [ ] DNS/network exposure (ports, protocols)147- [ ] CI/CD triggers (workflow_dispatch, PR events from forks)148- [ ] Admin/debug endpoints (check if properly gated)149150**When agentic components are present, add these entry points:**151152- [ ] Agent prompt inputs — user messages, RAG-retrieved documents, web pages, and tool outputs entering the model context (ASI01 indirect-injection vectors)153- [ ] Agent tool / function-calling surface — every tool the agent may invoke, especially side-effecting operations (ASI02)154- [ ] External tool & MCP registries — dynamically integrated tools, plugins, and schemas whose descriptions/permissions may be forged (ASI04)155- [ ] Agent-generated code / shell execution — sandboxed or unsandboxed environments running model output (ASI05)156- [ ] Agent memory stores — vector DBs, long-term memory, and conversation logs writable by the agent (ASI06)157- [ ] Inter-agent message channels — orchestration buses, delegation protocols between agents (ASI07)158- [ ] Human approval / HITL gates — review steps vulnerable to prompt-injection or approval-fatigue (ASI09)159160**For each entry point, note:**161162- Input validation present? (type, length, format)163- Authentication required?164- Authorization granularity?165- Rate limiting in place?166167---168169## Step 4: Assess Dependencies and Supply Chain170171**Automated checks:**172173```bash174# Node.js175npm audit --json 2>/dev/null || true176cat package-lock.json | python3 -c "177import json, sys178data = json.load(sys.stdin)179pkgs = data.get('packages', {})180print(f'Total packages: {len(pkgs)}')181direct = [k for k in pkgs if k.count('/node_modules/') == 1]182print(f'Direct dependencies: {len(direct)}')183"184185# Go186go list -m all 2>/dev/null | wc -l187govulncheck ./... 2>/dev/null || true188189# Python190pip-audit 2>/dev/null || safety check 2>/dev/null || true191192# Rust193cargo audit 2>/dev/null || true194```195196**Assess:**197198- Total dependency count (direct + transitive)199- Known vulnerabilities (critical/high/medium)200- Dependency freshness (last update dates of key deps)201- Pinning strategy (lockfile present? hash verification?)202- Whether security-critical functions use well-known libraries vs custom code203- **Agentic supply chain (ASI04):** third-party tools, MCP servers, and plugin packages — are they pinned, vetted, provenance-verified? Are tool descriptions reviewed for deceptive language? Is dynamic tool discovery allowed?204205---206207## Step 5: Identify Security-Relevant Architecture208209The goal here is **not** to audit whether the codebase's existing controls are correct or complete — that is out of scope (see Scope Boundary). The goal is to recognize which security *domains* this architecture actually involves, so the threat model (Step 3) and the coding rules (Step 7) cover the right ground and stay relevant to the real stack rather than listing every generic control.210211Scan the codebase to answer one question per domain: **"Is this domain relevant to how this system is built?"** Use the categories below as a checklist of domains to consider:212213| Category | What "relevant" means here |214| ------------------ | ----------------------------------------------------------------------- |215| AuthN | The system authenticates anyone (users, services) — middleware, tokens, sessions |216| AuthZ | The system distinguishes permissions — roles, guards, policy engines |217| Input validation | The system accepts external input — API params, CLI args, file uploads, webhooks |218| CSRF protection | The system has browser-facing state-changing endpoints |219| Rate limiting | The system exposes public or shared endpoints |220| Encryption | The system stores or transmits sensitive data |221| Secret management | The system handles secrets — API keys, DB credentials, signing keys |222| Logging & audit | The system produces security-relevant events worth recording |223| Security headers | The system serves HTML/web content to browsers |224| Container security | The system ships as a container image |225| Agent guardrails (agentic) | The system builds agents that consume untrusted content in-context (ASI01) |226| Tool-call governance (agentic) | The system's agents invoke side-effecting tools (ASI02) |227| Code-exec sandboxing (agentic) | The system runs agent-generated code or shell commands (ASI05) |228| Memory protection (agentic) | The system persists agent memory/vector stores across sessions (ASI06) |229| Inter-agent security (agentic) | The system coordinates multiple agents over a message channel (ASI07) |230| Resilience (agentic) | The system chains agents/tools whose failures could cascade (ASI08) |231232For each domain you mark relevant, note only enough to inform the threat model and rules:233234- **Why it's relevant** — the architectural reason (e.g., "public REST API with session cookies → CSRF domain applies")235- **What the rules must address** — the concrete concerns the coding rules will need to cover for this domain236237Do **not** record implementation locations, coverage gaps, or "what's missing" — those are review findings, not policy inputs.238239---240241## Step 6: Identify Relevant Agentic Threats — OWASP Top 10 for Agentic Applications (ASI01–ASI10)242243> **Conditional step.** Skip entirely if Step 1 did not detect agentic components (the recon script prints `No strong agentic indicators`). For a pure chatbot / RAG system with no tool use and no multi-agent coordination, classical controls and the OWASP Top 10 for LLM Applications suffice. The moment the system takes actions on behalf of a user, this step is **required**.244245> **Not an audit.** As with Step 5, the goal is **not** to score the current codebase ("does it pass ASI02?"). It is to determine, per category, whether the threat **applies** to how this system is built, and if so, what the coding rules (Step 7) and the threat-model entries must require. Do **not** record "control present / gap / not applicable" verdicts against the existing code, and do **not** push anything into Known Risks based on what the code currently lacks.246247The unifying principle is **least agency** — grant an agent only the minimum autonomy required for a safe, bounded task. Ask, for every agent: what is its reach (least privilege) AND what is its latitude within that reach (least agency)?248249For each category, answer two questions only: **(a) Is this threat relevant given the architecture? (b) If yes, what must the rules require?** Skip any category the architecture provably doesn't involve, noting why.250251- [ ] **ASI01 — Agent Goal Hijacking.** Relevant when agents ingest untrusted content (user input, tool outputs, retrieved docs, web pages) into context. If so, the rules must require instruction/data separation, input/output filtering, privilege separation between instructions and data, and treating all retrieved/tool-produced text as data.252- [ ] **ASI02 — Tool Misuse and Exploitation.** Relevant when agents can call tools, especially side-effecting ones. If so, the rules must require per-tool least privilege, validated parameter schemas, restriction of dangerous operations regardless of agent request, a tool-call allowlist, budget/loop caps, and approval gates for irreversible actions.253- [ ] **ASI03 — Agent Identity and Privilege Abuse.** Relevant when agents act under delegated or inherited credentials. If so, the rules must require per-agent verified identities, scoped/rotated credentials, confused-deputy prevention, and action logging with the verified principal.254- [ ] **ASI04 — Agentic Supply Chain Compromise.** Relevant when third-party tools, MCP servers, or plugins are integrated (especially dynamically). If so, the rules must require pinning/vetting, description review, provenance verification, and sandboxing of new tools.255- [ ] **ASI05 — Unexpected Code Execution.** Relevant when agent-generated code or shell commands run. If so, the rules must require sandbox isolation (restricted FS/network), approval gates for high-risk execution, argument scanning, ephemeral cleanup, and resource limits.256- [ ] **ASI06 — Memory and Context Poisoning.** Relevant when agent memory/vector stores persist across sessions. If so, the rules must require write/read validation, poisoning-pattern scanning, purge capability, session isolation, and retention/TTL.257- [ ] **ASI07 — Insecure Inter-Agent Communication.** Relevant when agents exchange messages over a bus or delegation protocol. If so, the rules must require authenticated/integrity-protected messages, delegation-depth limits, impersonation resistance, defined cross-agent permissions, and transport security.258- [ ] **ASI08 — Cascading Agent Failures.** Relevant when agents/tools are chained such that one failure propagates. If so, the rules must require circuit breakers, fail-closed behavior, bulkheads, per-dependency fallback, and cascade monitoring.259- [ ] **ASI09 — Human-Agent Trust Exploitation.** Relevant when human approval/HITL gates exist. If so, the rules must require showing raw intent (not agent summaries), approval rate-limiting, AI-generated labeling, and policy-engine-generated justifications.260- [ ] **ASI10 — Rogue Agents.** Relevant when agents operate with any autonomy (drift, collusion, runaway). If so, the rules must require behavioral-drift monitoring, an auditable receipt chain, a kill-switch/circuit-breaker, periodic alignment checks, and autonomy bounds (max steps, time-boxed sessions).261262---263264## Step 7: Derive Secure Coding Rules265266Based on the discovered tech stack, generate project-specific coding rules.267268**Language-specific rule selection:**269270| Stack | Key rules to emphasize |271| ------------------ | ------------------------------------------------------------------------------ |272| Node.js/TypeScript | Prototype pollution, ReDoS, event loop blocking, npm supply chain |273| Go | Integer overflow, goroutine leaks, unsafe package usage, TOCTOU in file ops |274| Python | Pickle deserialization, SSTI, subprocess injection, `yaml.safe_load` |275| Rust | `unsafe` block justification, FFI boundary validation |276| Java/Kotlin | Deserialization (Jackson/Gson config), JNDI injection, XML external entities |277| React/Frontend | XSS via dangerouslySetInnerHTML, open redirects, token storage in localStorage |278279**Framework-specific rules:**280281- ORM: N+1 queries as DoS vector, mass assignment protection282- GraphQL: query depth/complexity limits, introspection in prod283- gRPC: message size limits, deadline propagation284- WebSocket: origin validation, message rate limiting285286**Agentic-specific rules (when ASI01–ASI10 apply):**287288- Prompt construction: strict instruction/data separation with delimiters; treat retrieved/tool-produced text as adversarial (ASI01)289- Tool integration: per-tool least privilege, validated parameter schemas, allowlist, budget/loop caps, irreversible-action gates (ASI02)290- Code execution: sandbox with restricted FS/network, ephemeral cleanup, argument scanning (ASI05)291- Memory: validate before write/read, scan for poisoning, isolate per session, enforce TTL (ASI06)292- Inter-agent messaging: authenticate and sign messages, limit delegation depth, fail-closed (ASI07)293294---295296## Step 8: Generate SECURITY.md297298Use the template from [template.md](template.md) and fill in each section with discovered data.299300**Section-by-section guidance:**301302| Section | Source |303| ----------------------------- | ----------------------------------------------------------------- |304| Supported Versions | Git tags, CHANGELOG, CI release config |305| Reporting a Vulnerability | User input (or infer from existing SECURITY.md / CONTRIBUTING.md) |306| Assets | Step 2 output |307| Threat Actors | Standard list, adjusted to project's exposure level |308| Attack Surface | Step 3 output |309| Trust Boundaries | Infer from architecture (edge → app → data layer); add agent trust boundaries if agentic |310| Known Risks | Inherent architectural risks the design knowingly accepts (e.g., "MVP uses a single shared DB user") — **never** a list of what the current code is missing vs. the policy; compliance findings do not go here |311| Security Architecture | Step 5 output — which security domains apply to this architecture and what the policy requires of each |312| Agentic Application Security | Step 6 output (ASI01–ASI10) — include only if agentic indicators detected |313| Secure Coding Guidelines | Step 7 output |314| Rules for AI Coding Agents | Derived from stack + project-specific patterns + agentic constraints (ASI09/ASI10) |315| Security-Related Config Files | Files found in Step 1 |316317**Writing rules:**318319- Remove `{{ }}` placeholder markers from filled sections320- Keep `{{ }}` only for sections that could not be filled (note why)321- Be specific: reference actual file paths, library names, config values322- Include concrete examples from the codebase where helpful323- Mark assumptions explicitly: "Assumed based on [evidence]"324325---326327## Step 9: Register SECURITY.md in AGENTS.md328329Ensure that AI coding agents working on the repository are aware of the security policy. Add or update a reference to `SECURITY.md` in the project's `AGENTS.md` file.330331**If `AGENTS.md` exists** — add a section (or append to an existing "Security" / "Guidelines" section):332333```markdown334## Security Policy335336This project maintains a security policy in [SECURITY.md](./SECURITY.md).337All AI coding agents MUST read and follow SECURITY.md before making changes.338It contains:339340- Threat model and trust boundaries341- Secure coding guidelines specific to this project's stack342- Hard constraints and forbidden patterns for AI agents343- Vulnerability reporting procedures344- Agentic security controls (OWASP Top 10 for Agentic Applications ASI01–ASI10), where applicable345346Any code contribution that violates the rules in SECURITY.md will be rejected.347```348349**If `AGENTS.md` does not exist** — create it with at minimum the security reference above, plus a brief header:350351```markdown352# Agent Guidelines353354Instructions for AI coding agents (GitHub Copilot, Cursor, Qoder, etc.)355working on this repository.356357## Security Policy358359This project maintains a security policy in [SECURITY.md](./SECURITY.md).360All AI coding agents MUST read and follow SECURITY.md before making changes.361It contains:362363- Threat model and trust boundaries364- Secure coding guidelines specific to this project's stack365- Hard constraints and forbidden patterns for AI agents366- Vulnerability reporting procedures367- Agentic security controls (OWASP Top 10 for Agentic Applications ASI01–ASI10), where applicable368369Any code contribution that violates the rules in SECURITY.md will be rejected.370```371372**Important:** Do not duplicate the full security rules in AGENTS.md — reference SECURITY.md as the single source of truth. AGENTS.md should only contain a pointer and a brief summary of what agents will find there.373374---375376## Step 10: Validate Completeness377378After generating, verify:379380- [ ] Every section either filled or marked with reason for incompleteness381- [ ] No placeholder text left unmarked382- [ ] Asset sensitivity ratings are justified383- [ ] Attack surface entries match actual routes in codebase384- [ ] Dependency counts match actual lockfile385- [ ] Secure coding rules match the actual tech stack (no irrelevant rules)386- [ ] AI agent rules reference patterns actually present in the project387- [ ] No secrets or sensitive internal details exposed in the document388- [ ] Revision history has today's date389- [ ] AGENTS.md exists and references SECURITY.md390- [ ] AGENTS.md does NOT duplicate security rules (only references them)391- [ ] If agentic indicators were detected: ASI01–ASI10 section present, with each applicable category stating what the rules require (non-applicable categories justified and skipped)392- [ ] If no agentic indicators: the Agentic Application Security section is explicitly omitted with a one-line note (no stale placeholders)393- [ ] **No audit findings in the document** — SECURITY.md contains no statements grading the current code against the policy (e.g., "missing rate limiting on /api/x", "ASI02: no mitigation found", "input validation absent"). Known Risks lists only inherent architectural trade-offs the design knowingly accepts, never code-compliance gaps.394395---396397## Output Location398399Save the generated SECURITY.md to the project root directory. If one already exists, back it up first and present both versions for comparison.400401## Tone and Audience402403The document will be read by:404405- Security researchers evaluating the project406- New contributors learning project security standards407- AI coding agents operating on the codebase408- Auditors reviewing the security policy409410Write in clear, imperative, technical language. Avoid marketing fluff. Prefer concrete over abstract.
Run npx skillmds@latest add v0lka/security-policy-generator in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Analyze a project repository and build a project-specific threat model, then derive from it the secure coding rules that go into SECURITY.md — covering both classical security and the OWASP Top 10 for Agentic Applications 2026 (ASI01–ASI10). Use when the user asks to create a security policy, generate a threat model, or establish secure coding rules for a repository. It is listed under AI & ML on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
v0lka (@v0lka) published this skill. Their other Agent Skills are listed on their SkillMD profile.