# sast-gap-analyzer

sast-gap-analyzer — a subagent for Claude Code, Cursor and other IDEs that identifies where validation chains break down — missing, insufficient or bypassable checks. Detects bugs between code fragments that each look correct in isolation.

- subagent · `type=agent` · Claude Code, Cursor, Codex, GitHub Copilot, Gemini CLI, Windsurf (Devin Desktop) · ★ 1298 repo stars
- Author: H-mmer
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/H-mmer/pentest-agents/tree/HEAD/.claude/agents/sast-gap-analyzer.md
- Updated: 2026-06-12
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/agents/sast-gap-analyzer

## What it does

Takes traced data flows and spots seven categories of validation gaps: no check at all, bounds that do not cover the constraint, type mismatches between check and use, checks of the wrong property, race conditions between check and use, interactions between individually correct checks that create impossible-yet-satisfiable conditions, and skipped checks in error paths.

The agent excels at finding interaction gaps — the hardest vulnerabilities, such as the SACK pattern in TCP or sentinel-value collision in FFmpeg. Requires Claude Opus to reason through complex chains. Access it via `/sast`, passing files with traced flows and source code; the agent reads, verifies and suggests concrete fixes.

In PHP codebases, it spots classic traps: loose token comparison with `==` instead of `===`, `is_numeric` as a guard, non-strict `in_array`, path traversal through stream wrappers and second-order SQL injection through logs.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/agents/sast-gap-analyzer.md` — For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

### Codex

**Manually: put the files in place**
- File: `.codex/agents/sast-gap-analyzer.toml` — Codex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/

### Cursor

**Manually: put the files in place**
- File: `.cursor/agents/sast-gap-analyzer.md` — Cursor also reads .claude/agents/

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/H-mmer/pentest-agents/tree/HEAD/.claude/agents/sast-gap-analyzer.md

## When to use it
- spot missing or insufficient checks in data validation
- find bugs in the gaps between separately correct checks
- detect race conditions between permission checks and file use
- catch type mismatches where data is validated in one type but used in another
- diagnose PHP pitfalls: loose comparison, path traversal, second-order SQL injection

## Example prompts
- Analyze validation in `auth.php` — find gaps in token checks between `parse_jwt` and `validate_claims`
- Review data flows in the file handler: where could a race condition exist between extension checks and path use
- Examine buffer boundary interactions in `memcpy` — can two separately correct checks contradict each other

## Similar
- [sast-sca-security-analyzer](https://affpapa.org/en/nevibecode/agents/sast-sca-security-analyzer.md) — subagent · ★ 41430 repo stars
- [sast-scanning](https://affpapa.org/en/nevibecode/skills/sast-scanning.md) — skill · 415 installs
- [security-scanning-security-sast](https://affpapa.org/en/nevibecode/skills/security-scanning-security-sast.md) — skill · ★ 50109 repo stars
- [security-sast](https://affpapa.org/en/nevibecode/commands/security-sast.md) — command · ★ 42780 repo stars
- [triage](https://affpapa.org/en/nevibecode/skills/anthropics-triage.md) — skill · 1200 installs
- [sast-configuration](https://affpapa.org/en/nevibecode/skills/sast-configuration.md) — skill · 10800 installs

From the same set: [h-mmer/pentest-agents](https://affpapa.org/en/nevibecode/by/h-mmer/pentest-agents.md) — 43 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
