@kaademos/secure-sdlc 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "secure-sdlc-agents",
3
+ "version": "1.0.0",
4
+ "description": "A team of AI security specialists embedded in your coding workflow. 8 agents covering every phase of the Secure SDLC: requirements, threat modelling, code review, IaC security, compliance, and release gating. Works with Claude Code, Cursor, Windsurf, and any MCP-compatible tool.",
5
+ "author": {
6
+ "name": "Kaademos",
7
+ "url": "https://github.com/Kaademos"
8
+ },
9
+ "repository": "https://github.com/Kaademos/secure-sdlc-agents",
10
+ "license": "MIT",
11
+ "keywords": [
12
+ "security",
13
+ "appsec",
14
+ "sdlc",
15
+ "owasp",
16
+ "asvs",
17
+ "compliance",
18
+ "threat-modeling",
19
+ "secure-coding"
20
+ ],
21
+ "agents": [
22
+ ".claude/agents/product-manager.md",
23
+ ".claude/agents/appsec-engineer.md",
24
+ ".claude/agents/grc-analyst.md",
25
+ ".claude/agents/cloud-platform-engineer.md",
26
+ ".claude/agents/dev-lead.md",
27
+ ".claude/agents/release-manager.md",
28
+ ".claude/agents/security-champion.md",
29
+ ".claude/agents/ai-security-engineer.md"
30
+ ]
31
+ }
package/CHANGELOG.md CHANGED
@@ -8,6 +8,26 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
8
8
 
9
9
  ## [1.0.2]
10
10
 
11
+ ---
12
+
13
+ ## [1.1.0] — 2026-04-06
14
+
15
+ ### Added
16
+ - **`.claude-plugin/plugin.json`** — Claude Code plugin marketplace manifest; agents now installable with a single `/plugin marketplace add Kaademos/secure-sdlc-agents` command (zero-dependency, no npm, no cloning)
17
+ - **`skills/` directory** — 4 SKILL.md files in the agent-skills–compatible format for cross-ecosystem discoverability:
18
+ - `skills/security-and-hardening/` — secure coding, PR review, OWASP Top 10 prevention, severity gating
19
+ - `skills/threat-modeling/` — STRIDE + LINDDUN structured threat model workflow
20
+ - `skills/ai-security/` — OWASP LLM Top 10 2025, prompt injection, excessive agency, output validation
21
+ - `skills/compliance-and-audit/` — risk register, framework mapping (SOC 2, ISO 27001, GDPR, PCI DSS), audit evidence
22
+ - **README — "Option 0"** plugin marketplace as the first and fastest install path (before git clone and npm)
23
+ - **README — "The 4-Minute Problem"** concrete breach table replacing the generic problem statement — 5 real vulnerabilities a vibe-coded file upload misses, each mapped to the catching agent
24
+ - **README — "Who Do You Call?"** ASCII decision tree covering every SDLC moment → correct agent → exact command
25
+
26
+ ### Changed
27
+ - **README.md** — title tagline tightened to be specific and direct ("8 AI security specialists. Invoked at the exact phase where each vulnerability would have been caught.")
28
+ - **`package.json` `files`** — added `skills/` and `.claude-plugin/` to the npm publish manifest
29
+
30
+
11
31
  ### Added
12
32
  - **npm package** `@kaademos/secure-sdlc` (root `package.json`) — global install via `npm install -g @kaademos/secure-sdlc`, `npx @kaademos/secure-sdlc`, semver releases;
13
33
  - **`secure-sdlc paths`** — prints `PACKAGE_ROOT` and MCP server path after install
package/README.md CHANGED
@@ -6,22 +6,28 @@
6
6
 
7
7
  # Secure SDLC Agents
8
8
 
9
- A team of AI security specialists embedded directly in your vibe coding workflow.
9
+ **8 AI security specialists. Invoked at the exact phase where each vulnerability would have been caught.**
10
10
 
11
- They cover every phase of the Software Development Lifecycle: requirements, architecture,
12
- code review, infrastructure, compliance, and release gating. They work wherever you work:
13
- Claude Code, Cursor, Windsurf, Warp, and any tool that supports MCP.
11
+ Requirements threat modelling code review IaC compliance → release gate.
12
+ Works in Claude Code, Cursor, Windsurf, Warp, and any MCP-compatible tool.
14
13
 
15
14
  ---
16
15
 
17
- ## The problem this solves
16
+ ## The 4-Minute Problem
18
17
 
19
- When developers use AI tools to build fast, security becomes the thing that gets bolted on
20
- at the end — or skipped entirely. Threat models don't happen. ASVS requirements are never
21
- written. Compliance evidence is scrambled together the night before an audit.
18
+ You asked Claude Code to build a file upload feature. It wrote working code in 4 minutes.
22
19
 
23
- This project makes the security team part of the build process from day one. Not a gate
24
- at the end, but a set of specialists you summon at the exact moment their expertise is needed.
20
+ It missed:
21
+
22
+ | Vulnerability | Severity | Which agent catches it |
23
+ |---|---|---|
24
+ | SVG file with embedded `<script>` stored and served without sanitisation | **CRITICAL** | `appsec-engineer` — MIME type validation, output encoding |
25
+ | No file size limit or type allowlist | **HIGH** | `appsec-engineer` — input validation, magic byte checks |
26
+ | S3 bucket provisioned with `public-read` ACL | **CRITICAL** | `cloud-platform-engineer` — IaC security review |
27
+ | No rate limiting on the upload endpoint | **HIGH** | `appsec-engineer` — anti-automation controls |
28
+ | Upload URL in API response leaks internal bucket path | **MEDIUM** | `dev-lead` — information disclosure review |
29
+
30
+ Every one of these has appeared in real breach post-mortems. AI agents optimise for *working code*, not *secure code*. This project embeds the specialists that close that gap — at the exact phase where each issue would have been caught.
25
31
 
26
32
  ---
27
33
 
@@ -57,9 +63,46 @@ at the end, but a set of specialists you summon at the exact moment their expert
57
63
 
58
64
  ---
59
65
 
66
+ ## Who Do You Call?
67
+
68
+ ```
69
+ What are you working on?
70
+
71
+ ├── Starting a new feature?
72
+ │ ├── product-manager → "Define security requirements for X using ASVS L2"
73
+ │ └── grc-analyst → "Initialise risk register, map to SOC2 / GDPR / PCI-DSS"
74
+
75
+ ├── Designing the architecture?
76
+ │ ├── appsec-engineer → "Threat model this design using STRIDE"
77
+ │ ├── cloud-platform-engineer → "Review IaC for this feature"
78
+ │ └── ai-security-engineer → "Security review — feature calls an LLM" ← always include this
79
+
80
+ ├── Writing or merging code?
81
+ │ ├── dev-lead → "Review PR #N for secure coding issues and dependency risks"
82
+ │ └── appsec-engineer → "Triage SAST findings for PR #N"
83
+
84
+ ├── Quick security question (any phase)?
85
+ │ └── security-champion → "Is this pattern / library safe? Context: ..."
86
+
87
+ └── Ready to ship?
88
+ └── release-manager → "Run pre-release security checklist for vX.Y.Z"
89
+ ```
90
+
91
+ ---
92
+
60
93
  ## Quick start
61
94
 
62
- ### Option A — Claude Code (zero dependencies)
95
+ ### Option 0 — Claude Code Plugin Marketplace (one command, nothing to install)
96
+
97
+ ```bash
98
+ /plugin marketplace add Kaademos/secure-sdlc-agents
99
+ ```
100
+
101
+ All 8 agents are immediately available in your session. No cloning, no npm, no file copying.
102
+
103
+ ---
104
+
105
+ ### Option A — Git clone (zero dependencies)
63
106
 
64
107
  ```bash
65
108
  git clone https://github.com/Kaademos/secure-sdlc-agents.git
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaademos/secure-sdlc",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "description": "Secure SDLC agent team — CLI to scaffold docs, hooks, CI, and MCP-ready security workflows",
5
5
  "type": "module",
6
6
  "bin": {
@@ -15,6 +15,8 @@
15
15
  "docs/templates",
16
16
  "hooks",
17
17
  "stacks",
18
+ "skills",
19
+ ".claude-plugin",
18
20
  "warp-workflows",
19
21
  ".github/workflows/secure-sdlc-gate.yml",
20
22
  ".cursor/rules",
@@ -0,0 +1,163 @@
1
+ ---
2
+ name: ai-security
3
+ description: >
4
+ Use when building any feature that calls an LLM API, processes user input sent to
5
+ a model, uses RAG or embeddings, deploys an AI agent with tool access, or makes
6
+ AI-generated output visible to users or downstream systems.
7
+ ---
8
+
9
+ # AI Security
10
+
11
+ ## Overview
12
+
13
+ This skill applies structured security analysis to AI and LLM-powered features.
14
+ The threat categories here — prompt injection, excessive agency, output misuse,
15
+ supply chain — did not exist before 2023 and are still being misunderstood by
16
+ most developers shipping AI features today.
17
+
18
+ **Working assumption: every model is a trust boundary, not a trusted component.**
19
+ Model outputs must be treated as untrusted user input to every downstream system.
20
+
21
+ **Reference framework:** OWASP Top 10 for LLMs 2025 (LLM01–LLM10).
22
+
23
+ ## When to Use
24
+
25
+ - Any code that calls an LLM API (OpenAI, Anthropic, Google, Mistral, self-hosted)
26
+ - Any feature that sends user-supplied content to a model
27
+ - RAG systems, embeddings, vector databases, or retrieval pipelines
28
+ - AI agents with tool access (file system, HTTP requests, database writes, email)
29
+ - Features where model output is rendered in UI, executed as code, or used in queries
30
+ - Selecting or integrating a third-party model, fine-tune, or embedding
31
+
32
+ ## Process
33
+
34
+ ### Step 1 — Map the attack surface
35
+
36
+ Before finding vulnerabilities, enumerate:
37
+
38
+ | Question | Why it matters |
39
+ |---|---|
40
+ | Who sends input to the model? | Determines direct injection risk |
41
+ | What external sources feed the prompt context? | Determines indirect injection risk |
42
+ | What tools / functions can the model invoke? | Determines excessive agency blast radius |
43
+ | What happens to the model's output? | Determines output handling risk |
44
+ | Is user PII sent to a third-party API? | Determines data leakage and legal risk |
45
+ | Where does the model or its weights come from? | Determines supply chain risk |
46
+
47
+ ### Step 2 — Assess prompt injection risk (LLM01, LLM07)
48
+
49
+ **Input trust classification:**
50
+
51
+ | Input Source | Trust Level | Injection Risk |
52
+ |---|---|---|
53
+ | Authenticated user (UI) | LOW | Direct prompt injection |
54
+ | Public / unauthenticated user | UNTRUSTED | Direct + jailbreak attempts |
55
+ | Retrieved document (RAG) | UNTRUSTED | Indirect prompt injection |
56
+ | Tool / function call result | MEDIUM | Injection via external API response |
57
+ | Database query result | MEDIUM | Injection via poisoned records |
58
+ | Web scraping / search | UNTRUSTED | Indirect injection |
59
+
60
+ **Mitigations to verify:**
61
+ - [ ] User input is structurally separated from system instructions (not just concatenated)
62
+ - [ ] Retrieved content is sanitised before injection into prompt context
63
+ - [ ] Known injection patterns are filtered (defence in depth — not a complete defence alone)
64
+ - [ ] System prompt does not contain secrets — assume a motivated attacker can extract it
65
+ - [ ] The model cannot override its own instructions via the user turn
66
+
67
+ ### Step 3 — Assess excessive agency (LLM06)
68
+
69
+ Excessive agency is the most dangerous risk for agentic systems. A model tricked via
70
+ prompt injection into misusing its tool access can exfiltrate data, delete records,
71
+ or send external requests — all without the user's knowledge.
72
+
73
+ **Review checklist:**
74
+ - [ ] What write operations can the model trigger? Can it be tricked into deleting or exfiltrating?
75
+ - [ ] Can the model send external HTTP requests, emails, or webhooks? Via injected instructions?
76
+ - [ ] Does the model have access to credentials or secrets? Can they be extracted in output?
77
+ - [ ] Are tool call parameters validated before execution — or does raw model output go to the function?
78
+ - [ ] Is there a human-in-the-loop approval step for high-impact or irreversible operations?
79
+ - [ ] Does the model have access to only what it needs for this specific task (least privilege)?
80
+
81
+ **Key principle:** model outputs are untrusted input. Validate before acting. Require explicit
82
+ human confirmation for destructive or high-value operations.
83
+
84
+ ### Step 4 — Assess output handling (LLM05)
85
+
86
+ | Model output used as… | Risk | Required mitigation |
87
+ |---|---|---|
88
+ | Rendered in HTML / DOM | Stored XSS | DOMPurify, output encoding |
89
+ | Executed as code | Remote code execution | Never execute model output directly |
90
+ | Inserted into SQL queries | SQL injection | Parameterise all queries; validate schema |
91
+ | Used in HTTP requests | SSRF | Validate and allowlist URLs from model output |
92
+ | Passed to shell commands | Command injection | Never pass model output to shell |
93
+ | Used as a file path | Path traversal | Validate against allowlist of permitted paths |
94
+ | Used for access control decisions | Privilege escalation | Never use model output for authorisation alone |
95
+
96
+ ### Step 5 — Assess supply chain (LLM03) and data leakage
97
+
98
+ **Supply chain:**
99
+ - [ ] Model sourced from a known, reputable provider
100
+ - [ ] Fine-tuning inputs (if any) were sanitised and reviewed before use
101
+ - [ ] Embedding model is standard and well-audited — not a third-party unknown
102
+ - [ ] Update policy defined: how will you know if a model you depend on has a security issue?
103
+
104
+ **Data leakage:**
105
+ - [ ] PII minimised before sending to external model APIs
106
+ - [ ] Legal basis confirmed for sending user data to the model provider
107
+ - [ ] Data residency requirements checked against the model API's guarantees
108
+ - [ ] Model API calls (prompts + outputs) are logged for audit — but raw PII is not in logs
109
+
110
+ ### Step 6 — Produce the output document
111
+
112
+ ```markdown
113
+ ## AI Security Review: [Feature Name]
114
+
115
+ ### Attack Surface Summary
116
+ [Inputs, model access, tools available, output usage]
117
+
118
+ ### Threat Findings
119
+
120
+ | ID | OWASP LLM Category | Severity | Description | Mitigation |
121
+ |----|--------------------|----------|-------------|------------|
122
+ | AI-001 | LLM01: Prompt Injection | HIGH | [Description] | [Concrete fix] |
123
+
124
+ ### Mitigations Required Before Release
125
+ [Priority list with owners and references]
126
+
127
+ ### Accepted Risks
128
+ [Any risks accepted with justification and approver]
129
+ ```
130
+
131
+ ## Common Rationalizations
132
+
133
+ | Excuse | Counter |
134
+ |---|---|
135
+ | "The model won't do harmful things — it's aligned" | Alignment is not a security boundary. Prompt injection bypasses alignment systematically. |
136
+ | "Our users are trusted — no injection risk" | Indirect injection comes from retrieved documents, not users. Malicious content in your RAG source is an injection vector. |
137
+ | "We validate the model output in the UI" | XSS prevention in the UI is correct but insufficient. Validate at every trust boundary, not just display. |
138
+ | "It's a read-only agent — no write tools" | Is it truly read-only? Check every tool definition. HTTP GET requests can trigger side effects in external systems. |
139
+ | "We use a well-known model — supply chain is fine" | Supply chain risk includes fine-tunes, LoRA adapters, embedding models, and model API intermediaries — not just the base model. |
140
+ | "We'll add rate limiting later" | LLM cost exhaustion attacks (LLM10) are cheaper than traditional DoS. Rate limit before you ship. |
141
+
142
+ ## Red Flags
143
+
144
+ - User-supplied text concatenated directly into the system prompt with no structural separation
145
+ - Retrieved document content injected into the prompt without sanitisation
146
+ - A model that can trigger HTTP requests, file writes, or external service calls without a human approval step for high-impact actions
147
+ - Model output rendered in the DOM without sanitisation
148
+ - Model output used in a SQL query, shell command, or file path without validation
149
+ - API keys or secrets present in the system prompt
150
+ - No per-user rate limiting on endpoints that trigger model calls
151
+ - A third-party embedding model or fine-tune with no documented provenance
152
+
153
+ ## Verification
154
+
155
+ Do not close this review until:
156
+
157
+ - [ ] All LLM01–LLM10 categories have been explicitly assessed
158
+ - [ ] Every HIGH/CRITICAL finding has a concrete mitigation with an owner
159
+ - [ ] Model output handling is validated at every downstream trust boundary
160
+ - [ ] Tool access follows least-privilege — model has only what it needs for this task
161
+ - [ ] Rate limiting and cost controls are in place
162
+ - [ ] AI security findings are reflected in the main threat model (`docs/threat-model.md`)
163
+ - [ ] Any data leakage findings are reviewed by `grc-analyst` for GDPR/compliance implications
@@ -0,0 +1,173 @@
1
+ ---
2
+ name: compliance-and-audit
3
+ description: >
4
+ Use when a project requires a compliance framework mapping, when risks need formal
5
+ documentation, when audit evidence must be collected, or when producing a compliance
6
+ attestation before release. Applies to SOC 2, ISO 27001, GDPR, PCI DSS, NIST CSF,
7
+ and DORA.
8
+ ---
9
+
10
+ # Compliance and Audit
11
+
12
+ ## Overview
13
+
14
+ This skill maintains the governance, risk, and compliance (GRC) layer of the Secure SDLC.
15
+ It translates security work into auditable, framework-aligned documentation that survives
16
+ a real audit — not a self-assessment checklist filled in the night before.
17
+
18
+ The discipline: compliance is a continuous process. Every security control implemented
19
+ during Build and Test must be captured as evidence at the time it is implemented,
20
+ not reconstructed six months later.
21
+
22
+ ## When to Use
23
+
24
+ - A new project or feature processes regulated data (PII, payment data, health data)
25
+ - A compliance gap analysis is required
26
+ - Risks need to be formally accepted, transferred, or mitigated on record
27
+ - Audit evidence must be collected for a specific control
28
+ - Producing a compliance attestation before a release or audit
29
+ - Responding to a customer security questionnaire or due diligence request
30
+
31
+ ## Process
32
+
33
+ ### Step 1 — Determine applicable frameworks
34
+
35
+ Based on data classification and business context, identify which frameworks apply:
36
+
37
+ | Framework | Applies when… |
38
+ |---|---|
39
+ | **SOC 2 Type II** | You process customer data and need to demonstrate trust to enterprise buyers |
40
+ | **ISO/IEC 27001:2022** | Formal ISMS certification is required (often for EU/UK contracts) |
41
+ | **NIST CSF 2.0** | US federal contracts or voluntary alignment with US security standards |
42
+ | **PCI DSS v4.0** | Any feature handling payment card data |
43
+ | **GDPR / UK GDPR** | Any processing of personal data of EU or UK residents |
44
+ | **DORA** | Financial services entities operating in the EU |
45
+ | **HIPAA** | Protected health information (PHI) in the US |
46
+ | **OWASP ASVS** | Always — this is the technical requirements anchor for all other frameworks |
47
+
48
+ ### Step 2 — Produce the risk register
49
+
50
+ Create or update `docs/risk-register.md` with every identified risk:
51
+
52
+ ```markdown
53
+ | Risk ID | Description | Category | Likelihood | Impact | Inherent Risk | Control(s) | Residual Risk | Owner | Status | Due Date |
54
+ |---------|-------------|----------|------------|--------|--------------|------------|--------------|-------|--------|----------|
55
+ | R-001 | SQL injection in search endpoint | Application | High | Critical | Critical | Input validation, WAF, SAST | Medium | Dev Lead | Open | YYYY-MM-DD |
56
+ | R-002 | Insider access to production DB | Access Control | Medium | High | High | RBAC, PAM, audit logs | Low | Cloud/Platform | Mitigated | — |
57
+ ```
58
+
59
+ Every vulnerability found by any agent must appear here with an owner, severity, and status.
60
+ Risks do not disappear — they are mitigated, accepted, or transferred, with documentation.
61
+
62
+ ### Step 3 — Map controls to frameworks
63
+
64
+ Produce a control mapping table that connects ASVS requirements to applicable framework controls:
65
+
66
+ ```markdown
67
+ | ASVS Ref | Requirement | SOC 2 | ISO 27001 | NIST CSF | PCI DSS |
68
+ |----------|-------------|-------|-----------|----------|---------|
69
+ | V2.1.1 | Password complexity ≥ 12 chars | CC6.1 | A.8.5 | PR.AC-1 | Req 8.3 |
70
+ | V6.1.1 | Encryption at rest (AES-256) | CC6.7 | A.8.24 | PR.DS-1 | Req 3.5 |
71
+ | V9.1.1 | TLS 1.2+ for all external comms | CC6.7 | A.8.20 | PR.DS-2 | Req 4.2 |
72
+ ```
73
+
74
+ ### Step 4 — Collect audit evidence at time of implementation
75
+
76
+ For every control validated during Build or Test, create an evidence record immediately:
77
+
78
+ ```markdown
79
+ ## Evidence Record: [Control ID]
80
+
81
+ **Control:** [Framework] — [Reference] — [Control Name]
82
+ **Evidence Type:** Test result / Configuration screenshot / Policy document / Log extract
83
+ **Date Collected:** YYYY-MM-DD
84
+ **Collected By:** [Who or which agent]
85
+ **Description:** [What this demonstrates — be specific enough for an auditor who wasn't there]
86
+ **Artefact:** [File path or link]
87
+ **Review Status:** Pending / Approved
88
+ ```
89
+
90
+ Evidence must be collected at implementation time. Evidence reconstructed after the fact
91
+ fails audit scrutiny.
92
+
93
+ ### Step 5 — Risk acceptance process
94
+
95
+ When a risk cannot be fully mitigated before release:
96
+
97
+ 1. Document the risk in full (likelihood, impact, inherent score, existing controls)
98
+ 2. Describe the residual risk after controls
99
+ 3. Obtain a written business justification
100
+ 4. Record the name and role of the approver (must be appropriate seniority for the risk level)
101
+ 5. Set a mandatory review date — accepted risks expire
102
+
103
+ ```markdown
104
+ ## Risk Acceptance: [Risk ID]
105
+
106
+ **Risk:** [Description]
107
+ **Inherent Risk:** [Score]
108
+ **Mitigating Controls:** [What's already in place]
109
+ **Residual Risk:** [Score after controls]
110
+ **Business Justification:** [Why this risk is being accepted rather than fixed]
111
+ **Accepted By:** [Name, Role]
112
+ **Acceptance Date:** YYYY-MM-DD
113
+ **Review Date:** YYYY-MM-DD
114
+ ```
115
+
116
+ ### Step 6 — Produce the release compliance attestation
117
+
118
+ Before every release, write `docs/audit-evidence/compliance-attestation-vX.Y.Z.md`:
119
+
120
+ ```markdown
121
+ ## Compliance Attestation — Release vX.Y.Z
122
+
123
+ **Date:** YYYY-MM-DD
124
+ **Frameworks in scope:** [List]
125
+
126
+ ### Control Status Summary
127
+
128
+ | Framework | Total Controls | Compliant | Gap | Accepted Risk |
129
+ |-----------|---------------|-----------|-----|---------------|
130
+ | SOC 2 | 22 | 20 | 1 | 1 |
131
+
132
+ ### Open Gaps
133
+ [List with owner and remediation timeline]
134
+
135
+ ### Accepted Risks
136
+ [List with business justification and approver]
137
+
138
+ ### Attestation
139
+ All in-scope controls reviewed. Gaps and accepted risks formally acknowledged.
140
+ Release is approved from a GRC perspective pending Release Manager sign-off.
141
+ ```
142
+
143
+ ## Common Rationalizations
144
+
145
+ | Excuse | Counter |
146
+ |---|---|
147
+ | "We'll document compliance after we launch" | Auditors require evidence contemporaneous with the control implementation. Retrospective documentation is a finding. |
148
+ | "We're too early-stage for formal compliance" | SOC 2 readiness takes 6–12 months. If you start when a customer requires it, you've already lost the deal. |
149
+ | "We've accepted this risk before" | Risk acceptance is time-bound and context-specific. Prior acceptance does not carry forward to a new feature or a changed threat landscape. |
150
+ | "The risk register is the security team's job, not mine" | Risk ownership belongs to the team generating the risk. Dev teams own application risks; Cloud teams own infrastructure risks. |
151
+ | "Our pentest report counts as audit evidence" | Pentest evidence is one artefact. Auditors require evidence for each control, not a single document. |
152
+
153
+ ## Red Flags
154
+
155
+ - A risk register that hasn't been updated since the last audit
156
+ - Accepted risks with no expiry date — permanent acceptance is not a valid posture
157
+ - Compliance controls documented but no evidence they were actually implemented
158
+ - A feature handling PII with no GDPR Article 30 record of processing activity
159
+ - Audit evidence collected in a rush the week before an audit, not at time of implementation
160
+ - Framework mapping that lists "compliant" for controls that were never tested
161
+ - Risk acceptance signed off by an engineer rather than appropriate business authority
162
+
163
+ ## Verification
164
+
165
+ Do not close this phase until:
166
+
167
+ - [ ] All applicable compliance frameworks identified and documented
168
+ - [ ] Risk register is current — all findings from appsec-engineer and cloud-platform-engineer have entries
169
+ - [ ] Control mapping table exists in `docs/` and reflects current ASVS requirements
170
+ - [ ] Audit evidence collected for every control claimed as implemented
171
+ - [ ] All accepted risks have a named approver, business justification, and review date
172
+ - [ ] Compliance attestation document written and reviewed before release
173
+ - [ ] `grc-analyst` has provided compliance context to `release-manager` for the go/no-go decision
@@ -0,0 +1,117 @@
1
+ ---
2
+ name: security-and-hardening
3
+ description: >
4
+ Use when writing or reviewing code that handles user input, authentication, access
5
+ control, cryptography, error handling, file uploads, or dependency management.
6
+ Also activates when a pull request touches any security-sensitive component.
7
+ ---
8
+
9
+ # Security and Hardening
10
+
11
+ ## Overview
12
+
13
+ This skill enforces the secure coding standards and PR review discipline that prevent
14
+ the most common vulnerability classes from reaching production. It covers OWASP Top 10
15
+ categories, ASVS control requirements, and the review process that catches issues before
16
+ they merge — not after they breach.
17
+
18
+ ## When to Use
19
+
20
+ - Any code handling user-supplied input (forms, APIs, file uploads, query params)
21
+ - Authentication, session management, or access control changes
22
+ - Cryptographic operations — hashing, encryption, key management
23
+ - Dependency additions or upgrades
24
+ - Pull request review on any security-sensitive component
25
+ - SAST finding triage and remediation
26
+
27
+ ## Process
28
+
29
+ ### Step 1 — Classify the security surface
30
+
31
+ Before reviewing, identify which categories are in scope:
32
+
33
+ | Surface | Key risks |
34
+ |---|---|
35
+ | Input handling | Injection (SQL, LDAP, OS command, template, XSS) |
36
+ | Authentication | Weak passwords, missing MFA, session fixation |
37
+ | Access control | IDOR, broken object-level auth, privilege escalation |
38
+ | Cryptography | Weak algorithms, hardcoded keys, improper key storage |
39
+ | File handling | Path traversal, type confusion, SVG XSS, unrestricted upload |
40
+ | Dependencies | Known CVEs, unmaintained packages, licence risk |
41
+ | Error handling | Stack trace leakage, verbose error messages |
42
+
43
+ ### Step 2 — Apply the PR security checklist
44
+
45
+ - [ ] No hardcoded secrets, API keys, or credentials anywhere in the diff
46
+ - [ ] All user-controlled inputs validated server-side (type, length, format, range)
47
+ - [ ] SQL/NoSQL queries use parameterised statements — no string concatenation with input
48
+ - [ ] Object-level authorisation checks present (not just resource-type checks)
49
+ - [ ] New dependencies reviewed: CVE status, maintenance activity, licence, download count
50
+ - [ ] Error messages returned to the client are generic; detail is server-side only
51
+ - [ ] Log entries do not include PII, credentials, session tokens, or payment data
52
+ - [ ] Cryptographic operations use approved algorithms (AES-256-GCM, Argon2id, SHA-256+)
53
+ - [ ] File upload handlers validate MIME type, magic bytes, size, and destination path
54
+ - [ ] ASVS requirements from `docs/security-requirements.md` are satisfied
55
+
56
+ ### Step 3 — Severity-gate the findings
57
+
58
+ | Severity | Action |
59
+ |---|---|
60
+ | **CRITICAL** | Block merge immediately. No exceptions. Fix and re-review. |
61
+ | **HIGH** | Block merge unless risk is formally accepted with CISO sign-off. |
62
+ | **MEDIUM** | Must have fix or accepted-risk entry in risk register before release. |
63
+ | **LOW / INFO** | Track in risk register. Does not block. |
64
+
65
+ ### Step 4 — Structure the review output
66
+
67
+ ```markdown
68
+ ## Security Review: PR #[N] — [Title]
69
+
70
+ ### CRITICAL / HIGH — Block merge
71
+ - [Issue]: [Plain English description + CWE reference + concrete fix]
72
+
73
+ ### MEDIUM — Fix before release
74
+ - [Issue]: [Description + remediation suggestion]
75
+
76
+ ### Positive observations
77
+ - [Good security practice observed — reinforce it]
78
+ ```
79
+
80
+ ### Step 5 — Verify the fix
81
+
82
+ After remediation:
83
+ 1. Confirm the root cause is fixed, not just the symptom.
84
+ 2. Confirm a regression test exists that would catch the same issue in future.
85
+ 3. For CRITICAL/HIGH: re-review the changed lines before marking resolved.
86
+ 4. Update `docs/sast-findings.md` with the resolution status.
87
+
88
+ ## Common Rationalizations
89
+
90
+ | Excuse | Counter |
91
+ |---|---|
92
+ | "It's internal-only, not a real risk" | Internal endpoints are breached via SSRF, pivot attacks, and insider threat. Internal ≠ safe. |
93
+ | "I'll add input validation later" | Injection vulnerabilities are introduced at write time. "Later" is too late once it ships. |
94
+ | "The ORM handles SQL injection" | ORMs do not protect against raw queries, JSON operators, or second-order injection. Verify. |
95
+ | "We'll rotate the hardcoded key before production" | Keys committed to git are already compromised. Rotate now; remove from history. |
96
+ | "This dependency vulnerability isn't reachable" | Reachability analysis is hard. Upgrade unless you can prove the affected code path is never hit. |
97
+ | "The client validates it too" | Client-side validation is UX. Server-side validation is security. Both are required. |
98
+
99
+ ## Red Flags
100
+
101
+ - A function accepts user input and builds a query, command, or markup string by concatenation
102
+ - Password storage using MD5, SHA-1, SHA-256 alone (without bcrypt/Argon2id/scrypt)
103
+ - Any `eval()`, `exec()`, `subprocess.run(shell=True)` with user-controlled data
104
+ - File path constructed from user input without strict allowlisting
105
+ - `Authorization` header or session token logged anywhere
106
+ - A new npm/pip/gem package added without a comment explaining what it does and why
107
+ - `catch (e) {}` — swallowed errors that may be masking a security event
108
+
109
+ ## Verification
110
+
111
+ Do not close this review until:
112
+
113
+ - [ ] All CRITICAL and HIGH findings have a confirmed fix or documented accepted risk
114
+ - [ ] The fix has been re-reviewed at the code level (not just "looks good")
115
+ - [ ] Regression tests exist for any vulnerability classes found
116
+ - [ ] `docs/sast-findings.md` is updated with finding status
117
+ - [ ] `docs/risk-register.md` is updated if any risk was accepted
@@ -0,0 +1,151 @@
1
+ ---
2
+ name: threat-modeling
3
+ description: >
4
+ Use when a new feature, architecture, or significant design decision is being made.
5
+ Run before any code is written. Produces a structured STRIDE threat model and
6
+ architecture review that feeds directly into security requirements and PR review.
7
+ ---
8
+
9
+ # Threat Modeling
10
+
11
+ ## Overview
12
+
13
+ This skill runs a structured threat model against a proposed design or architecture.
14
+ It applies STRIDE (and LINDDUN for privacy) to enumerate what can go wrong before
15
+ any code exists to exploit. The output is a `docs/threat-model.md` that every other
16
+ agent can reference throughout the SDLC.
17
+
18
+ The discipline: spec the threats before you write the code. AI agents that skip this
19
+ step produce features that are locally correct but architecturally broken.
20
+
21
+ ## When to Use
22
+
23
+ - Starting a new feature or service
24
+ - Changing authentication, authorisation, or data access patterns
25
+ - Adding a third-party integration or external data source
26
+ - Designing a new API surface
27
+ - Before a penetration test (to scope it correctly)
28
+ - When a security incident reveals a design-level gap
29
+
30
+ ## Process
31
+
32
+ ### Step 1 — Define the scope
33
+
34
+ Document:
35
+ - **Feature summary**: what it does, for whom, and why
36
+ - **Data flows**: where data enters, where it goes, where it is stored, where it exits
37
+ - **Trust boundaries**: which components trust which other components, and why
38
+ - **External dependencies**: APIs, databases, third-party services, user inputs
39
+
40
+ Draw or describe a simple data flow diagram. Even ASCII is sufficient.
41
+
42
+ ### Step 2 — Enumerate STRIDE threats
43
+
44
+ For each component and data flow, systematically enumerate threats across all six categories:
45
+
46
+ | Category | Question to ask |
47
+ |---|---|
48
+ | **Spoofing** | Can an attacker pretend to be a legitimate user, service, or system? |
49
+ | **Tampering** | Can data be modified in transit, in storage, or during processing? |
50
+ | **Repudiation** | Can a user deny having performed an action — and would logs prove otherwise? |
51
+ | **Information Disclosure** | Can data be accessed by an unauthorised party or leaked in error messages? |
52
+ | **Denial of Service** | Can an attacker exhaust resources — compute, memory, storage, rate limits? |
53
+ | **Elevation of Privilege** | Can a lower-privilege user or process gain higher-privilege access? |
54
+
55
+ Produce a threat table:
56
+
57
+ ```markdown
58
+ | Component / Flow | Threat Category | Threat Description | Likelihood | Impact | Mitigation |
59
+ |---|---|---|---|---|---|
60
+ | Login endpoint | Spoofing | Credential stuffing via enumerable usernames | High | High | Account lockout, MFA |
61
+ | JWT token | Tampering | Signature bypass via alg=none | Medium | Critical | Enforce alg allowlist; use RS256 |
62
+ | User records API | Info Disclosure | IDOR — UUID in path param, no object-level auth | High | High | Verify resource ownership per request |
63
+ ```
64
+
65
+ ### Step 3 — Add LINDDUN for privacy (when PII is involved)
66
+
67
+ If the feature processes personal data, extend the model:
68
+
69
+ | Category | What to check |
70
+ |---|---|
71
+ | **Linking** | Can user records be correlated across sessions or services? |
72
+ | **Identifying** | Can data reveal a user's identity when combined? |
73
+ | **Non-repudiation** | Are users stuck with data they can't delete or correct? |
74
+ | **Detecting** | Can an attacker infer sensitive facts from system behaviour? |
75
+ | **Data disclosure** | Is PII exposed to parties who shouldn't see it? |
76
+ | **Unawareness** | Are users informed about what data is collected and why? |
77
+ | **Non-compliance** | Does the feature conflict with GDPR, CCPA, or applicable regulation? |
78
+
79
+ ### Step 4 — Prioritise and assign mitigations
80
+
81
+ For each identified threat:
82
+ 1. Rate Likelihood (High / Medium / Low) and Impact (Critical / High / Medium / Low)
83
+ 2. Determine Inherent Risk = Likelihood × Impact
84
+ 3. Specify a concrete mitigation (not "add validation" — "validate MIME type and magic bytes server-side before accepting file")
85
+ 4. Assign an owner and target phase (Design / Build / Test)
86
+
87
+ ### Step 5 — Produce the output document
88
+
89
+ Write `docs/threat-model.md` using this structure:
90
+
91
+ ```markdown
92
+ ## Threat Model: [Feature Name]
93
+
94
+ **Date:** YYYY-MM-DD
95
+ **Feature:** [Brief description]
96
+ **ASVS Level:** L[1/2/3]
97
+ **Conducted by:** appsec-engineer (AI) + [human reviewer]
98
+
99
+ ### Data Flow Summary
100
+ [Describe or diagram the data flows and trust boundaries]
101
+
102
+ ### STRIDE Threat Table
103
+ [Full table from Step 2]
104
+
105
+ ### LINDDUN Privacy Threats (if applicable)
106
+ [Full table from Step 3]
107
+
108
+ ### Architecture Review Checklist
109
+ - [ ] Authentication enforced on all endpoints
110
+ - [ ] Authorisation follows least-privilege; no IDOR vectors
111
+ - [ ] All inputs validated server-side; output encoding in place
112
+ - [ ] Sensitive data identified and encryption requirements confirmed
113
+ - [ ] Third-party integrations reviewed for supply chain risk
114
+ - [ ] Error handling does not leak internal state
115
+ - [ ] Logging captures security events without logging secrets
116
+ - [ ] Rate limiting and anti-automation controls present
117
+
118
+ ### Mitigations Required (prioritised)
119
+ [Ordered list by severity]
120
+ ```
121
+
122
+ ## Common Rationalizations
123
+
124
+ | Excuse | Counter |
125
+ |---|---|
126
+ | "We'll do threat modeling after we build the MVP" | Design-level flaws cost 10–100x more to fix after implementation. The MVP will have the flaw baked in. |
127
+ | "It's a simple feature, no need for a threat model" | The features that skip threat modeling are the features that produce the breach post-mortems. |
128
+ | "We've done this before, we know the risks" | Every feature has novel combinations of data, trust boundaries, and integrations. Past experience is input, not a substitute. |
129
+ | "The threat model would just say the same things every time" | Then produce a short one quickly. If you can't identify any threats, you haven't looked hard enough. |
130
+ | "Security will review it in staging" | Staging review catches implementation bugs. Architectural flaws require an architectural fix — which means redesign and rebuild. |
131
+
132
+ ## Red Flags
133
+
134
+ - A feature accesses user data across multiple accounts without explicit object-level authorisation logic
135
+ - An API accepts user-supplied IDs (UUIDs, integers) without verifying ownership
136
+ - A new external API or third-party service is introduced without a supply chain review
137
+ - Data flows across a trust boundary without an explicit authN/authZ check
138
+ - Error responses return stack traces, internal hostnames, or database schemas
139
+ - A "temporary" bypass of an authorisation check for development convenience
140
+ - No logging on authentication events, privilege changes, or data access
141
+
142
+ ## Verification
143
+
144
+ Do not close the threat model until:
145
+
146
+ - [ ] All STRIDE categories have been explicitly considered (even if some yield no findings)
147
+ - [ ] Every HIGH and CRITICAL threat has a named mitigation with an owner and a target phase
148
+ - [ ] `docs/threat-model.md` has been written and linked from the feature spec
149
+ - [ ] The threat model has been reviewed by a human with security knowledge — not just read
150
+ - [ ] Findings are reflected in `docs/security-requirements.md` (via `product-manager` agent)
151
+ - [ ] `docs/risk-register.md` is updated with any accepted risks