@kaademos/secure-sdlc 1.0.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.
Files changed (53) hide show
  1. package/.claude/agents/ai-security-engineer.md +209 -0
  2. package/.claude/agents/appsec-engineer.md +131 -0
  3. package/.claude/agents/cloud-platform-engineer.md +119 -0
  4. package/.claude/agents/dev-lead.md +138 -0
  5. package/.claude/agents/grc-analyst.md +143 -0
  6. package/.claude/agents/product-manager.md +100 -0
  7. package/.claude/agents/release-manager.md +126 -0
  8. package/.claude/agents/security-champion.md +148 -0
  9. package/.cursor/rules/secure-sdlc.mdc +98 -0
  10. package/.github/workflows/secure-sdlc-gate.yml +325 -0
  11. package/CHANGELOG.md +49 -0
  12. package/CLAUDE.md +195 -0
  13. package/LICENSE +21 -0
  14. package/README.md +394 -0
  15. package/cli/bin/secure-sdlc.js +95 -0
  16. package/cli/src/commands/gate.js +129 -0
  17. package/cli/src/commands/init.js +219 -0
  18. package/cli/src/commands/install-mcp.js +121 -0
  19. package/cli/src/commands/kickoff.js +261 -0
  20. package/cli/src/commands/paths.js +33 -0
  21. package/cli/src/commands/review.js +53 -0
  22. package/cli/src/commands/status.js +122 -0
  23. package/cli/src/utils/banner.js +43 -0
  24. package/cli/src/utils/package-root.js +23 -0
  25. package/cli/src/utils/phase-detect.js +107 -0
  26. package/cli/src/utils/stack-detect.js +138 -0
  27. package/docs/templates/compliance-attestation.md +159 -0
  28. package/docs/templates/infra-security-review.md +133 -0
  29. package/docs/templates/release-sign-off.md +119 -0
  30. package/docs/templates/risk-register.md +72 -0
  31. package/docs/templates/sast-findings.md +110 -0
  32. package/docs/templates/security-requirements.md +98 -0
  33. package/docs/templates/test-security-report.md +143 -0
  34. package/docs/templates/threat-model.md +129 -0
  35. package/hooks/install.sh +37 -0
  36. package/hooks/pre-commit +208 -0
  37. package/hooks/pre-push +127 -0
  38. package/mcp/README.md +116 -0
  39. package/mcp/package.json +23 -0
  40. package/mcp/src/server.js +638 -0
  41. package/package.json +67 -0
  42. package/stacks/django.md +216 -0
  43. package/stacks/express.md +229 -0
  44. package/stacks/fastapi.md +247 -0
  45. package/stacks/nextjs.md +198 -0
  46. package/stacks/nodejs.md +28 -0
  47. package/stacks/rails.md +247 -0
  48. package/warp-workflows/README.md +25 -0
  49. package/warp-workflows/feature-kickoff.yaml +49 -0
  50. package/warp-workflows/pr-security-review.yaml +47 -0
  51. package/warp-workflows/release-gate.yaml +44 -0
  52. package/warp-workflows/sdlc-status.yaml +48 -0
  53. package/warp-workflows/threat-model.yaml +56 -0
package/README.md ADDED
@@ -0,0 +1,394 @@
1
+ ![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)
2
+ ![Claude Code](https://img.shields.io/badge/Claude_Code-Sub--Agents-blueviolet)
3
+ ![Cursor MCP](https://img.shields.io/badge/Cursor-MCP%20Ready-blue)
4
+ ![OWASP ASVS](https://img.shields.io/badge/OWASP-ASVS%20L2-orange)
5
+ ![Works With](https://img.shields.io/badge/Works%20With-Claude%20%7C%20Cursor%20%7C%20Windsurf%20%7C%20Warp-brightgreen)
6
+
7
+ # Secure SDLC Agents
8
+
9
+ A team of AI security specialists — embedded directly in your vibe coding workflow.
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.
14
+
15
+ ---
16
+
17
+ ## The problem this solves
18
+
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.
22
+
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.
25
+
26
+ ---
27
+
28
+ ## What you get
29
+
30
+ | What | Why it matters |
31
+ |---|---|
32
+ | **8 specialist agents** | AppSec, Product Manager, GRC Analyst, Cloud/Platform, Dev Lead, Release Manager, Security Champion, AI Security Engineer |
33
+ | **MCP server** | Works in Cursor, Windsurf, Zed, Continue, and any MCP-compatible tool |
34
+ | **CLI tool** (`secure-sdlc`) | Zero-friction setup, kickoff wizard, status dashboard, release gate |
35
+ | **Cursor rules** | Automatic security context in every Cursor session |
36
+ | **GitHub Actions workflow** | Artefact gate, secret scan, SAST (CodeQL), IaC scan (Checkov), dependency audit |
37
+ | **Git hooks** | Pre-commit secret detection, security anti-pattern checks |
38
+ | **Warp workflows** | Pre-built Warp automation for every SDLC phase |
39
+ | **Stack profiles** | Deep, framework-specific guidance for Next.js, FastAPI, Django, Express, Rails |
40
+ | **Document templates** | 8 fully structured templates for every phase artefact |
41
+ | **Worked examples** | 3 complete feature walkthroughs (auth, REST API, file upload) |
42
+
43
+ ---
44
+
45
+ ## Agents
46
+
47
+ | Agent | Role | When to invoke |
48
+ |---|---|---|
49
+ | [`product-manager`](.claude/agents/product-manager.md) | ASVS-mapped security requirements | Start of every feature |
50
+ | [`appsec-engineer`](.claude/agents/appsec-engineer.md) | Threat modelling, SAST/DAST, vuln triage | Design, Build, Test |
51
+ | [`grc-analyst`](.claude/agents/grc-analyst.md) | Compliance mapping, risk register, audit evidence | Plan through Release |
52
+ | [`cloud-platform-engineer`](.claude/agents/cloud-platform-engineer.md) | IaC security, CSPM, secrets, hardening | Design, Build, Release |
53
+ | [`dev-lead`](.claude/agents/dev-lead.md) | Secure coding, PR review, SCA | Every PR |
54
+ | [`release-manager`](.claude/agents/release-manager.md) | Security sign-off, go/no-go gate | Pre-release |
55
+ | [`security-champion`](.claude/agents/security-champion.md) | First-line security Q&A and lightweight review | Any time, any phase |
56
+ | [`ai-security-engineer`](.claude/agents/ai-security-engineer.md) | Prompt injection, agentic risks, LLM supply chain | Any feature using AI/LLMs |
57
+
58
+ ---
59
+
60
+ ## Quick start
61
+
62
+ ### Option A — Claude Code (zero dependencies)
63
+
64
+ ```bash
65
+ git clone https://github.com/Kaademos/secure-sdlc-agents.git
66
+ cp -r secure-sdlc-agents/.claude /your/project/
67
+ cp secure-sdlc-agents/CLAUDE.md /your/project/
68
+ cp -r secure-sdlc-agents/docs/templates /your/project/docs/
69
+ ```
70
+
71
+ Then use agents directly:
72
+
73
+ ```bash
74
+ cd /your/project
75
+ claude --agent product-manager "Define security requirements for [your feature]"
76
+ ```
77
+
78
+ ### Option B — CLI tool (recommended for teams)
79
+
80
+ Published on npm as **`@kaademos/secure-sdlc`**. Requires **Node.js 18+**.
81
+
82
+ **Global install** (command is still `secure-sdlc`):
83
+
84
+ ```bash
85
+ npm install -g @kaademos/secure-sdlc
86
+ secure-sdlc --version
87
+ secure-sdlc init
88
+ ```
89
+
90
+ **No global install** (uses npx; pin a version in CI with `@1.0.0`):
91
+
92
+ ```bash
93
+ npx @kaademos/secure-sdlc@latest init
94
+ ```
95
+
96
+ **After install — useful commands:**
97
+
98
+ ```bash
99
+ secure-sdlc paths # print PACKAGE_ROOT and MCP server path (for Cursor MCP JSON)
100
+ secure-sdlc init --cursor # scaffold project + .cursor/mcp.json pointing at bundled MCP
101
+ secure-sdlc install-mcp # merge MCP server into ~/.cursor/mcp.json (and other tools)
102
+ secure-sdlc kickoff # interactive feature wizard
103
+ secure-sdlc status
104
+ ```
105
+
106
+ **Develop / run from a git clone** (no npm publish needed):
107
+
108
+ ```bash
109
+ cd /path/to/secure-sdlc-agents
110
+ npm install
111
+ node cli/bin/secure-sdlc.js init
112
+ # or: npm run sdlc -- init
113
+ ```
114
+
115
+ ### Option C — Cursor / Windsurf / Other MCP tools
116
+
117
+ 1. Get the absolute path to `mcp/src/server.js`:
118
+
119
+ - **If you installed the CLI from npm:** run `secure-sdlc paths` and copy `MCP_SERVER`.
120
+ - **If you use a git clone:** run `npm install` at the repo root (installs MCP SDK for the bundled server), then use
121
+ `/absolute/path/to/secure-sdlc-agents/mcp/src/server.js`.
122
+
123
+ 2. Add to your MCP config:
124
+
125
+ **Cursor** (`~/.cursor/mcp.json` or `.cursor/mcp.json` in project):
126
+ ```json
127
+ {
128
+ "mcpServers": {
129
+ "secure-sdlc": {
130
+ "command": "node",
131
+ "args": ["/absolute/path/from-secure-sdlc-paths/mcp/src/server.js"]
132
+ }
133
+ }
134
+ }
135
+ ```
136
+
137
+ **Claude Code:**
138
+ ```bash
139
+ claude mcp add secure-sdlc -- node /absolute/path/to/secure-sdlc-agents/mcp/src/server.js
140
+ ```
141
+
142
+ **Or install for all tools at once:**
143
+ ```bash
144
+ node cli/bin/secure-sdlc.js install-mcp --tool all
145
+ ```
146
+
147
+ 3. Copy the Cursor rules for automatic security context:
148
+ ```bash
149
+ cp -r .cursor /your/project/
150
+ ```
151
+
152
+ 4. Use the `sdlc_*` tools in any chat:
153
+ ```
154
+ Use sdlc_plan_feature to define security requirements for a new payment checkout feature.
155
+ Stack is Next.js + Stripe + PostgreSQL. ASVS L2. Compliance: PCI-DSS, SOC2.
156
+ ```
157
+
158
+ ---
159
+
160
+ ## The lifecycle — phase by phase
161
+
162
+ ```
163
+ PLAN product-manager (ASVS requirements)
164
+ + grc-analyst (risk register, compliance mapping)
165
+
166
+ DESIGN appsec-engineer (STRIDE threat model)
167
+ + cloud-platform-engineer (IaC review)
168
+ + ai-security-engineer (if AI/LLM features)
169
+ + grc-analyst (compliance gate)
170
+
171
+ BUILD dev-lead (PR review, SCA) — on every PR
172
+ + appsec-engineer (SAST triage)
173
+ + cloud-platform-engineer (secrets, pipeline)
174
+ + security-champion (quick questions any time)
175
+
176
+ TEST appsec-engineer (DAST, pentest)
177
+ + dev-lead (regression)
178
+ + grc-analyst (audit evidence collection)
179
+
180
+ RELEASE release-manager (go/no-go)
181
+ + grc-analyst (compliance attestation)
182
+ + cloud-platform-engineer (production hardening)
183
+ ```
184
+
185
+ **Severity gates:**
186
+ - **CRITICAL** — blocks all gates, no exceptions
187
+ - **HIGH** — blocks Build→Test and Test→Release without documented accepted risk
188
+ - **MEDIUM** — requires remediation plan or accepted risk before release
189
+ - **LOW** — tracked in risk register, does not block
190
+
191
+ ---
192
+
193
+ ## MCP tools reference
194
+
195
+ When using the MCP server (Cursor, Windsurf, etc.), these tools are available:
196
+
197
+ | Tool | What it does |
198
+ |---|---|
199
+ | `sdlc_plan_feature` | ASVS requirements + risk register for a new feature |
200
+ | `sdlc_threat_model` | STRIDE (+ LINDDUN) threat model |
201
+ | `sdlc_review_pr` | Security review a PR — dev-lead + appsec-engineer |
202
+ | `sdlc_review_infra` | IaC security review (Terraform, Helm, K8s, etc.) |
203
+ | `sdlc_triage_sast` | Triage SAST findings from any tool |
204
+ | `sdlc_release_gate` | Pre-release go/no-go security gate |
205
+ | `sdlc_check_compliance` | Map controls to SOC 2, ISO 27001, GDPR, PCI DSS, etc. |
206
+ | `sdlc_init_project` | Scaffold Secure SDLC structure in a project |
207
+ | `sdlc_security_champion` | Quick security Q&A and lightweight code review |
208
+ | `sdlc_ai_security_review` | Security review for AI/LLM features |
209
+
210
+ ---
211
+
212
+ ## CLI commands reference
213
+
214
+ ```bash
215
+ secure-sdlc init # Scaffold docs, hooks, CI, config in current project
216
+ secure-sdlc init --cursor # Also install Cursor MCP config and rules
217
+ secure-sdlc kickoff # Interactive wizard to start a new feature
218
+ secure-sdlc status # Show current SDLC phase and artefact status
219
+ secure-sdlc review # Security review a file or diff
220
+ secure-sdlc gate v1.2.0 # Run pre-release security gate check
221
+ secure-sdlc install-mcp # Install MCP server for Cursor / Claude Code / Windsurf
222
+ secure-sdlc paths # Show package root + MCP path (after npm install -g)
223
+ ```
224
+
225
+ ---
226
+
227
+ ## Git hooks
228
+
229
+ Included in `hooks/`:
230
+
231
+ - **`pre-commit`** — secret detection, lock file checks, security anti-pattern scan
232
+ - **`pre-push`** — artefact gate for protected branches, open finding check
233
+
234
+ Install:
235
+ ```bash
236
+ bash /path/to/secure-sdlc-agents/hooks/install.sh
237
+ # OR via CLI:
238
+ secure-sdlc init # installs hooks automatically
239
+ ```
240
+
241
+ ---
242
+
243
+ ## GitHub Actions
244
+
245
+ `.github/workflows/secure-sdlc-gate.yml` adds:
246
+
247
+ - **Artefact gate** — blocks PRs to main/master if required security docs are missing
248
+ - **Secret scanning** (Gitleaks)
249
+ - **Dependency audit** (npm audit, pip-audit)
250
+ - **IaC scanning** (Checkov — Terraform, K8s, Docker)
251
+ - **SAST** (CodeQL — JavaScript/TypeScript, Python)
252
+ - **Release gate** — full pre-release checklist on `workflow_dispatch`
253
+
254
+ Copy to your project:
255
+ ```bash
256
+ mkdir -p .github/workflows
257
+ cp /path/to/secure-sdlc-agents/.github/workflows/secure-sdlc-gate.yml .github/workflows/
258
+ ```
259
+
260
+ ---
261
+
262
+ ## Stack profiles
263
+
264
+ Deep, framework-specific security guidance in `stacks/`:
265
+
266
+ | Stack | Profile |
267
+ |---|---|
268
+ | Next.js | [`stacks/nextjs.md`](stacks/nextjs.md) — Server Actions, API routes, CSP, CORS |
269
+ | FastAPI | [`stacks/fastapi.md`](stacks/fastapi.md) — Depends() auth, Pydantic, CORS, rate limiting |
270
+ | Django | [`stacks/django.md`](stacks/django.md) — CSRF, strong params, ORM injection, production settings |
271
+ | Express.js | [`stacks/express.md`](stacks/express.md) — helmet, rate limiting, CSRF, Zod validation |
272
+ | Ruby on Rails | [`stacks/rails.md`](stacks/rails.md) — Brakeman, Pundit, strong parameters, credentials |
273
+
274
+ ---
275
+
276
+ ## Warp terminal workflows
277
+
278
+ In `warp-workflows/` — import into Warp for one-click SDLC automation:
279
+
280
+ | Workflow | Trigger |
281
+ |---|---|
282
+ | Feature Kickoff | Start a new feature with requirements + risk register |
283
+ | PR Security Review | dev-lead + appsec review on a PR |
284
+ | Threat Model | STRIDE threat model on an architecture |
285
+ | Release Gate | Full pre-release security gate |
286
+ | SDLC Status | Check which phases are complete |
287
+
288
+ ---
289
+
290
+ ## Document templates
291
+
292
+ `docs/templates/` contains pre-formatted templates for every artefact:
293
+
294
+ | Template | Produced by | Phase |
295
+ |---|---|---|
296
+ | `security-requirements.md` | product-manager | Plan |
297
+ | `risk-register.md` | grc-analyst | Plan → ongoing |
298
+ | `threat-model.md` | appsec-engineer | Design |
299
+ | `infra-security-review.md` | cloud-platform-engineer | Design |
300
+ | `sast-findings.md` | appsec-engineer + dev-lead | Build |
301
+ | `test-security-report.md` | appsec-engineer | Test |
302
+ | `release-sign-off.md` | release-manager | Release |
303
+ | `compliance-attestation.md` | grc-analyst | Release |
304
+
305
+ ---
306
+
307
+ ## Worked examples
308
+
309
+ | Example | Feature type | Key security lessons |
310
+ |---|---|---|
311
+ | [`01-login-feature/`](examples/01-login-feature/) | Auth flow (bcrypt, MFA, sessions) | JWT alg:none, hardcoded secrets, cost factor |
312
+ | [`02-api-endpoint/`](examples/02-api-endpoint/) | Public REST API | IDOR via UUID path param, IAM over-privilege |
313
+ | [`03-file-upload/`](examples/03-file-upload/) | File upload to S3 | SVG XSS, magic byte validation, public bucket |
314
+
315
+ ---
316
+
317
+ ## Project configuration
318
+
319
+ Create `secure-sdlc.yaml` in your project root:
320
+
321
+ ```yaml
322
+ project:
323
+ name: "my-app"
324
+ stack: "Next.js + PostgreSQL"
325
+
326
+ security:
327
+ asvs_level: L2
328
+ frameworks: [SOC2, GDPR]
329
+ gates:
330
+ build_to_test:
331
+ block_on: [CRITICAL, HIGH]
332
+ test_to_release:
333
+ block_on: [CRITICAL, HIGH]
334
+ ```
335
+
336
+ Generate one automatically: `secure-sdlc init`
337
+
338
+ ---
339
+
340
+ ## A note on what these agents are — and aren't
341
+
342
+ These agents produce **guidance, not guarantees**.
343
+
344
+ They will help a team ask the right questions earlier, produce consistent artefacts,
345
+ and catch common mistakes that would otherwise slip through. They will not replace a
346
+ skilled AppSec engineer, a qualified GRC practitioner, or a thorough penetration test.
347
+
348
+ Every output should be reviewed by a human with relevant expertise before it is acted on
349
+ or used as audit evidence. The threat model is a starting point, not a final document.
350
+
351
+ Security practitioners are right to be sceptical of anything that claims to automate
352
+ security away. This project does not make that claim. It makes security practices easier
353
+ to start, easier to maintain, and harder to skip — which is most of the battle.
354
+
355
+ If you find guidance in an agent file that is wrong or dangerously out of date,
356
+ please [open an issue](.github/ISSUE_TEMPLATE/guidance-correction.md).
357
+
358
+ ---
359
+
360
+ ## Prerequisites
361
+
362
+ - [Claude Code](https://docs.anthropic.com/en/docs/claude-code) for sub-agent usage
363
+ - Node.js 18+ for the CLI and MCP server
364
+ - Optional: `npm install -g @kaademos/secure-sdlc` for the `secure-sdlc` command on your PATH
365
+ - Any MCP-compatible AI tool for the `sdlc_*` tools
366
+
367
+ ---
368
+
369
+ ## Contributing
370
+
371
+ See [CONTRIBUTING.md](CONTRIBUTING.md). High-value contributions:
372
+
373
+ - Additional compliance frameworks (HIPAA, FedRAMP, NIS2)
374
+ - Stack profiles for Go (Gin/Echo), .NET, Java Spring Boot
375
+ - More worked examples (OAuth flows, payment processing, AI features)
376
+ - Integration guides for specific SAST/DAST tools
377
+ - Translations of agent prompts
378
+
379
+ ---
380
+
381
+ ## Related
382
+
383
+ - [OWASP ASVS](https://owasp.org/www-project-application-security-verification-standard/)
384
+ - [OWASP Top 10](https://owasp.org/www-project-top-ten/)
385
+ - [OWASP Top 10 for LLMs 2025](https://owasp.org/www-project-top-10-for-large-language-model-applications/)
386
+ - [NIST SSDF](https://csrc.nist.gov/projects/ssdf)
387
+ - [Model Context Protocol](https://modelcontextprotocol.io)
388
+ - [Claude Code documentation](https://docs.anthropic.com/en/docs/claude-code)
389
+
390
+ ---
391
+
392
+ ## Licence
393
+
394
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env node
2
+ import { program } from "commander";
3
+ import { createRequire } from "module";
4
+ import { fileURLToPath } from "url";
5
+ import { dirname, join } from "path";
6
+
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+ const require = createRequire(import.meta.url);
9
+ // package.json lives at repository / npm package root (two levels above cli/bin)
10
+ const { version } = require(join(__dirname, "../../package.json"));
11
+
12
+ // Lazy-load commands to keep startup fast
13
+ async function loadCommand(name) {
14
+ const mod = await import(`../src/commands/${name}.js`);
15
+ return mod.default;
16
+ }
17
+
18
+ program
19
+ .name("secure-sdlc")
20
+ .description(
21
+ "Secure SDLC agent team — bring security specialists into any AI-assisted workflow"
22
+ )
23
+ .version(version);
24
+
25
+ program
26
+ .command("init")
27
+ .description("Scaffold the Secure SDLC structure in your project")
28
+ .option("-p, --path <path>", "Project root path (defaults to current directory)", process.cwd())
29
+ .option("-s, --stack <stack>", "Technology stack (e.g. 'nextjs', 'django', 'fastapi')")
30
+ .option("--skip-hooks", "Skip installing git hooks")
31
+ .option("--skip-ci", "Skip generating GitHub Actions workflow")
32
+ .option("--cursor", "Generate Cursor MCP config and rules")
33
+ .action(async (options) => {
34
+ const run = await loadCommand("init");
35
+ await run(options);
36
+ });
37
+
38
+ program
39
+ .command("kickoff")
40
+ .description("Interactive wizard to start a new feature with full Secure SDLC coverage")
41
+ .option("-p, --path <path>", "Project root path", process.cwd())
42
+ .action(async (options) => {
43
+ const run = await loadCommand("kickoff");
44
+ await run(options);
45
+ });
46
+
47
+ program
48
+ .command("review")
49
+ .description("Run a security review on a file, diff, or PR")
50
+ .argument("[target]", "File path, diff file, or PR number to review")
51
+ .option("--type <type>", "Review type: code|infra|deps|sast", "code")
52
+ .option("-p, --path <path>", "Project root path", process.cwd())
53
+ .option("-s, --stack <stack>", "Technology stack (e.g. Next.js + TypeScript)")
54
+ .action(async (target, options) => {
55
+ const run = await loadCommand("review");
56
+ await run(target, options);
57
+ });
58
+
59
+ program
60
+ .command("gate")
61
+ .description("Run the pre-release security gate (go/no-go)")
62
+ .argument("<version>", "Release version (e.g. v1.2.0)")
63
+ .option("-p, --path <path>", "Project root / docs path", process.cwd())
64
+ .action(async (version, options) => {
65
+ const run = await loadCommand("gate");
66
+ await run(version, options);
67
+ });
68
+
69
+ program
70
+ .command("status")
71
+ .description("Show current SDLC phase and which artefacts are present/missing")
72
+ .option("-p, --path <path>", "Project root path", process.cwd())
73
+ .action(async (options) => {
74
+ const run = await loadCommand("status");
75
+ await run(options);
76
+ });
77
+
78
+ program
79
+ .command("install-mcp")
80
+ .description("Install the Secure SDLC MCP server for your AI tool")
81
+ .option("--tool <tool>", "Target tool: cursor|claude-code|windsurf|all", "all")
82
+ .action(async (options) => {
83
+ const run = await loadCommand("install-mcp");
84
+ await run(options);
85
+ });
86
+
87
+ program
88
+ .command("paths")
89
+ .description("Print package root and MCP server path (for Cursor / MCP config after global install)")
90
+ .action(async () => {
91
+ const run = await loadCommand("paths");
92
+ await run();
93
+ });
94
+
95
+ program.parse();
@@ -0,0 +1,129 @@
1
+ import { existsSync, readFileSync } from "fs";
2
+ import { join, resolve } from "path";
3
+ import chalk from "chalk";
4
+ import { printBanner } from "../utils/banner.js";
5
+
6
+ const REQUIRED_ARTEFACTS = [
7
+ { path: "docs/security-requirements.md", agent: "product-manager", phase: "PLAN", required: true },
8
+ { path: "docs/risk-register.md", agent: "grc-analyst", phase: "PLAN", required: true },
9
+ { path: "docs/threat-model.md", agent: "appsec-engineer", phase: "DESIGN", required: true },
10
+ { path: "docs/infra-security-review.md", agent: "cloud-platform-engineer", phase: "DESIGN", required: false },
11
+ { path: "docs/sast-findings.md", agent: "appsec-engineer", phase: "BUILD", required: true },
12
+ { path: "docs/test-security-report.md", agent: "appsec-engineer", phase: "TEST", required: true },
13
+ ];
14
+
15
+ function isTemplate(content) {
16
+ return (
17
+ content.includes("[Feature Name]") ||
18
+ content.includes("[YYYY-MM-DD]") ||
19
+ (content.includes("[Brief description") && content.length < 2000)
20
+ );
21
+ }
22
+
23
+ export default async function gate(version, options) {
24
+ const projectRoot = resolve(options.path || process.cwd());
25
+
26
+ printBanner();
27
+ console.log(chalk.bold(`Pre-Release Security Gate — ${version}\n`));
28
+ console.log(chalk.dim(`Project: ${projectRoot}\n`));
29
+
30
+ let blockers = [];
31
+ let warnings = [];
32
+ let passed = [];
33
+
34
+ // 1. Check artefacts
35
+ console.log(chalk.bold("Artefact Check\n"));
36
+
37
+ for (const artefact of REQUIRED_ARTEFACTS) {
38
+ const abs = join(projectRoot, artefact.path);
39
+ const exists = existsSync(abs);
40
+
41
+ if (!exists) {
42
+ const msg = `MISSING: ${artefact.path} (${artefact.agent} — ${artefact.phase} phase)`;
43
+ if (artefact.required) {
44
+ blockers.push(msg);
45
+ console.log(chalk.red(` ✗ ${msg}`));
46
+ } else {
47
+ warnings.push(msg);
48
+ console.log(chalk.yellow(` ~ ${msg} [optional]`));
49
+ }
50
+ } else {
51
+ const content = readFileSync(abs, "utf-8");
52
+ if (isTemplate(content)) {
53
+ const msg = `TEMPLATE UNFILLED: ${artefact.path} — appears to be the blank template`;
54
+ blockers.push(msg);
55
+ console.log(chalk.red(` ✗ ${msg}`));
56
+ } else {
57
+ passed.push(artefact.path);
58
+ console.log(chalk.green(` ✓ ${artefact.path}`));
59
+ }
60
+ }
61
+ }
62
+
63
+ // 2. Check for CRITICAL/HIGH patterns in artefacts (heuristic)
64
+ console.log(chalk.bold("\nFinding Severity Scan (heuristic)\n"));
65
+
66
+ const findingsPath = join(projectRoot, "docs/sast-findings.md");
67
+ const testReportPath = join(projectRoot, "docs/test-security-report.md");
68
+
69
+ let findingIssues = [];
70
+
71
+ for (const docPath of [findingsPath, testReportPath]) {
72
+ if (existsSync(docPath)) {
73
+ const content = readFileSync(docPath, "utf-8");
74
+ const lines = content.split("\n");
75
+
76
+ // Look for open CRITICAL or HIGH findings
77
+ const openCritical = lines.filter(
78
+ (l) =>
79
+ l.match(/CRITICAL/i) &&
80
+ !l.match(/resolved|mitigated|closed|false positive/i)
81
+ );
82
+ const openHigh = lines.filter(
83
+ (l) =>
84
+ l.match(/\bHIGH\b/i) &&
85
+ !l.match(/resolved|mitigated|closed|false positive/i)
86
+ );
87
+
88
+ const docName = docPath.split("/").pop();
89
+ if (openCritical.length) {
90
+ const msg = `Possible open CRITICAL finding in ${docName} — confirm status`;
91
+ blockers.push(msg);
92
+ console.log(chalk.red(` ✗ ${msg}`));
93
+ }
94
+ if (openHigh.length > 0 && openCritical.length === 0) {
95
+ const msg = `Possible open HIGH finding in ${docName} — confirm status or document accepted risk`;
96
+ warnings.push(msg);
97
+ console.log(chalk.yellow(` ~ ${msg}`));
98
+ }
99
+ if (!openCritical.length && !openHigh.length) {
100
+ console.log(chalk.green(` ✓ No obvious open CRITICAL/HIGH in ${docName}`));
101
+ }
102
+ }
103
+ }
104
+
105
+ // 3. Decision
106
+ console.log(chalk.bold("\nGate Decision\n"));
107
+
108
+ if (blockers.length === 0) {
109
+ console.log(chalk.bold.green("✅ GO — all gate criteria met\n"));
110
+ if (warnings.length) {
111
+ console.log(chalk.yellow("Warnings (review before deploying):"));
112
+ warnings.forEach((w) => console.log(chalk.dim(` • ${w}`)));
113
+ }
114
+ console.log(chalk.dim("\nGenerate formal sign-off:"));
115
+ console.log(chalk.dim(` claude --agent release-manager "Run pre-release security checklist for ${version}"`));
116
+ console.log(chalk.dim(` # OR: sdlc_release_gate({ version: "${version}", docs_path: "${projectRoot}/docs" })`));
117
+ } else {
118
+ console.log(chalk.bold.red("🚫 NO-GO — the following must be resolved:\n"));
119
+ blockers.forEach((b, i) => {
120
+ console.log(chalk.red(` ${i + 1}. ${b}`));
121
+ });
122
+ if (warnings.length) {
123
+ console.log(chalk.yellow("\nAdditional warnings:"));
124
+ warnings.forEach((w) => console.log(chalk.dim(` • ${w}`)));
125
+ }
126
+ console.log(chalk.dim("\nFor each blocker: resolve the finding, then re-run: secure-sdlc gate " + version));
127
+ process.exit(1);
128
+ }
129
+ }