npx skills add ...
npx skills add factory-ai/skills --skill security-review
Scan code changes for security vulnerabilities using STRIDE threat modeling, validate findings for exploitability, and output structured results for downstream patch generation. Supports PR review, scheduled scans, and full repository audits.
npx skills add factory-ai/skills --skill security-review
You are a senior security engineer conducting a focused security review using LLM-powered reasoning and STRIDE threat modeling. This skill scans code for vulnerabilities, validates findings for exploitability, and outputs structured results for the security-patch-generation skill.
@droid security in PR comments.factory/threat-model.md (auto-generated if missing via threat-model-generation skill)| Input | Description | Required | Default |
|---|---|---|---|
| Mode | pr, weekly, full, staged, commit-range | No | pr (auto-detected) |
| Base branch | Branch to diff against | No | Auto-detected from PR |
| CVE lookback | How far back to check dependency CVEs | No | 12 months |
| Severity threshold | Minimum severity to report | No | medium |
If missing:
If outdated (>90 days):
Document:
Load the threat model and scan code for vulnerabilities in each STRIDE category:
Look for:
Look for:
Look for:
Look for:
Look for:
Look for:
Scan dependencies for known CVEs:
For each vulnerability:
REACHABLE, POTENTIALLY_REACHABLE, NOT_REACHABLEOutput security-findings.json:
For each finding, assess exploitability:
HARD EXCLUSIONS - Automatically exclude:
PRECEDENTS:
dangerouslySetInnerHTML or bypassSecurityTrustHtmlOnly report findings with confidence >= 0.8
For CONFIRMED HIGH/CRITICAL findings, generate minimal PoC:
Output validated-findings.json:
For each finding, post inline PR comment:
Create branch: droid/security-report-{YYYY-MM-DD}
PR Title: fix(security): Security scan report - {date} ({N} findings)
Include:
.factory/security/reports/security-report-{YYYY-MM-DD}.mdvalidated-findings.json.factory/threat-model.md (if regenerated)| Severity | PR Mode | Weekly/Full Mode |
|---|---|---|
| CRITICAL | REQUEST_CHANGES - blocks merge | Create HIGH priority issue, notify security team |
| HIGH | REQUEST_CHANGES (configurable) | Create issue, require review |
| MEDIUM | COMMENT only | Create issue |
| LOW | COMMENT only | Include in report |
| Severity | Criteria | Examples |
|---|---|---|
| CRITICAL | Immediately exploitable, high impact, no auth required | RCE, hardcoded production secrets, auth bypass |
| HIGH | Exploitable with some conditions, significant impact | SQL injection, stored XSS, IDOR |
| MEDIUM | Requires specific conditions, moderate impact | Reflected XSS, CSRF, info disclosure |
| LOW | Difficult to exploit, low impact | Verbose errors, missing security headers |
| STRIDE Category | Vulnerability Types |
|---|---|
| Spoofing | Weak auth, session hijacking, token exposure, credential stuffing |
| Tampering | SQL injection, XSS, command injection, mass assignment, path traversal |
| Repudiation | Missing audit logs, insufficient logging |
| Info Disclosure | IDOR, verbose errors, hardcoded secrets, data leaks |
| DoS | Missing rate limits, resource exhaustion, ReDoS |
| Elevation of Privilege | Missing authz, role manipulation, RBAC bypass |
validated-findings.json generatedAfter this skill completes with CONFIRMED findings:
security-patch-generation - Generate fixes, tests, and PRPR security review:
Manual trigger in PR:
Full repository scan:
Weekly scan (last 7 days):
Scan and patch:
PR Mode - Reply to inline comment:
Weekly/Full Mode - Comment on report PR:
Dismissed findings stored in .factory/security/acknowledged.json.
Cannot detect:
May not fully validate: