Overview
This plugin performs comprehensive security review of code changes by analyzing diffs in the context of the entire codebase. It scales analysis depth based on codebase size, uses git blame to understand why code existed, calculates the impact radius of changes, and identifies test coverage gaps.Author: Omar Inuwa
Version: 1.0.0
Version: 1.0.0
Core Principles
Risk-First
Focus on auth, crypto, value transfer, and external calls before everything else
Evidence-Based
Every finding backed by git history, line numbers, and concrete attack scenarios
Adaptive
Scale analysis depth to codebase size (SMALL/MEDIUM/LARGE)
Output-Driven
Always generate comprehensive markdown report file
When to Use
Use this skill when you need to:- Review PRs, commits, or diffs for security vulnerabilities
- Detect security regressions (re-introduced vulnerabilities)
- Analyze the blast radius of code changes
- Check test coverage gaps for modified code
- Perform pre-merge security review for critical changes
Installation
Features
Risk-First Analysis
Changes are classified by risk level and prioritized accordingly:| Risk Level | Triggers |
|---|---|
| HIGH | Auth, crypto, external calls, value transfer, validation removal |
| MEDIUM | Business logic, state changes, new public APIs |
| LOW | Comments, tests, UI, logging |
Git History Analysis
Usesgit blame to understand:
- Why removed code existed (was it a security fix?)
- When it was added (recent or legacy?)
- Who authored it (security-aware developer?)
- Commit messages revealing intent (CVE fix, security patch?)
Blast Radius Calculation
Quantifies the impact of changes by counting:- Direct callers of modified functions
- Transitive callers (functions calling the callers)
- Shared state dependencies
- Cross-module coupling
- 1-5 callers = Low blast radius
- 5-20 callers = Medium blast radius
- 20-50 callers = High blast radius
- 50+ callers = Critical blast radius (requires deep analysis)
Adaptive Depth Scaling
| Codebase Size | Strategy | Approach |
|---|---|---|
| SMALL (under 20 files) | DEEP | Read all dependencies, full git blame |
| MEDIUM (20-200) | FOCUSED | 1-hop dependencies, priority files only |
| LARGE (200+) | SURGICAL | Critical paths only, targeted analysis |
Workflow
The complete workflow spans Pre-Analysis + Phases 0-6:Modular Documentation Architecture
This skill uses progressive disclosure for token efficiency:SKILL.md
Main entry point with quick reference, decision tree, and quality checklist
methodology.md
Detailed phase-by-phase workflow for Phases 0-4
adversarial.md
Attacker modeling and exploit scenarios for Phase 5
reporting.md
Report structure and formatting for Phase 6
patterns.md
Common vulnerability patterns reference
Example Usage
Quick Triage (Small PR)
- Classify risk level per file (2 HIGH, 3 LOW)
- Focus on 2 HIGH files only
- Git blame removed code
- Generate minimal report
Standard Review (Medium Codebase)
- Full workflow on HIGH RISK files
- Surface scan on MEDIUM
- Skip LOW risk files
- Complete report with all sections
Deep Audit (Large, Critical Change)
- Baseline context with audit-context-building
- Deep analysis on auth changes only
- Blast radius analysis
- Adversarial modeling
- Comprehensive report
Report Output
The generated markdown report includes:Executive Summary
Executive Summary
High-level overview with severity distribution: X High, Y Medium, Z Low, W Info
Critical Findings
Critical Findings
Attack scenarios, PoCs, and exploitation details for high-severity issues
Test Coverage Analysis
Test Coverage Analysis
Gaps in test coverage for modified code paths
Blast Radius Analysis
Blast Radius Analysis
Quantified impact with caller counts and dependency graphs
Historical Context
Historical Context
Git blame results showing removed code history and regression risks
Actionable Recommendations
Actionable Recommendations
Specific remediation steps with code examples
Red Flags (Stop and Investigate)
Immediate escalation triggers: These patterns require adversarial analysis even in quick triage.Rationalizations to Reject
"Small PR, quick review"
"Small PR, quick review"
Why it’s wrong: Heartbleed was 2 lines
Required action: Classify by RISK, not size
Required action: Classify by RISK, not size
"I know this codebase"
"I know this codebase"
Why it’s wrong: Familiarity breeds blind spots
Required action: Build explicit baseline context
Required action: Build explicit baseline context
"Git history takes too long"
"Git history takes too long"
Why it’s wrong: History reveals regressions
Required action: Never skip Phase 1
Required action: Never skip Phase 1
"Blast radius is obvious"
"Blast radius is obvious"
Why it’s wrong: You’ll miss transitive callers
Required action: Calculate quantitatively
Required action: Calculate quantitatively
"No tests = not my problem"
"No tests = not my problem"
Why it’s wrong: Missing tests = elevated risk rating
Required action: Flag in report, elevate severity
Required action: Flag in report, elevate severity
"Just a refactor, no security impact"
"Just a refactor, no security impact"
Why it’s wrong: Refactors break invariants
Required action: Analyze as HIGH until proven LOW
Required action: Analyze as HIGH until proven LOW
I'll explain verbally
I'll explain verbally
Why it’s wrong: No artifact = findings lost
Required action: Always write report
Required action: Always write report
Example Vulnerability: Security Regression
Git blame reveals removed security code:- Git blame: Removed code added 6 months ago in commit “Fix CVE-2023-12345”
- Risk: HIGH - validation removal on a known CVE fix
- Impact: Re-introduces buffer overflow vulnerability
- Blast radius: 47 callers of
processInput() - Verdict: Critical security regression
Example Vulnerability: Access Control Change
- Change: Visibility modifier
internal→external - Risk: HIGH - access control modification
- Impact: Anyone can now call
withdraw(), not just contract itself - Attack scenario: Attacker calls
withdraw()directly, drains contract - Severity: Critical
Quality Checklist
Before delivering a differential review:- All changed files analyzed
- Git blame on removed security code
- Blast radius calculated for HIGH risk changes
- Attack scenarios are concrete (not generic)
- Findings reference specific line numbers + commits
- Report file generated and saved
- User notified with summary
Integration with Other Skills
audit-context-building:- Pre-Analysis: Build baseline context before differential review
- Phase 4: Deep context on HIGH RISK changes
- Verify suspected vulnerabilities found during review
- Transform findings into formal audit reports
- Command:
issue-writer --input DIFFERENTIAL_REVIEW_REPORT.md --format audit-report
When NOT to Use
Do not use differential-review for:- Greenfield code (no baseline to compare)
- Documentation-only changes (no security impact)
- Formatting/linting (cosmetic changes)
- User explicitly requests quick summary only (they accept risk)
Related Skills
- Audit Context Building - Used for baseline analysis
- FP Check - Verify suspected vulnerabilities