code-variant-analysis
Systematic scanning for historical bug shapes and variants of current findings across the codebase
от VigilOSS★ 35 звёзд на GitHub
Установить code-variant-analysis в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Code Variant Analysis
Together with agent/shared-constraints-code.md §5, this skill owns code bug-shape abstraction:
derive a semantic pattern from historical evidence or a current finding, verify candidates,
assess each instance's own impact, and check composable chains. The role prompt owns the
mode-specific recording and receipt sequence. The web hunting rules are not required.
When to Activate
- Phase 2 discovery mode: use supplied historical CVE/patch bug-shape evidence as an additive,
non-covering discovery seed before the main hunt. This mode's packet has no
## Variant Receipt Authorityblock and produces no variant-check receipts. - Phase 3 receipt-bearing mode: use the exact frozen, non-empty current parent set registered on the dispatch to find siblings and account for every current admitted file with a receipt.
- Goal: maximize yield by finding semantic repeats without letting exploratory Phase 2 work claim Phase 3 completeness.
Tools
rg, Read, Glob, and ctags (grep '^<symbol>\t' "$ctags_path" from the generation-bound Code
Source Identity) beneath the sealed snapshot_path: find every call site of the vulnerable function
and trace the incoming paths that reach the pattern.
Required Dispatch Inputs
The operator supplies the current Code Source Identity, its matching structural-index manifest,
and the complete backend threat-model envelope only when current: true and its generation/digest
match that identity. Runtime Identity authorized_phase selects the mode:
- Phase 2 supplies historical CVE/patch bug-shape evidence (including vulnerable/fixed code when available) and a bounded search scope; its packet has no Variant Receipt Authority block.
- Phase 3's packet carries the
## Variant Receipt Authorityblockagent startrenders (the canonical sorted, non-emptyparent_finding_slugsand the--agent-idreceipt binding), plus the corresponding finding/pattern evidence and every current admitted file's identity.
Apply the malformed/partial-input stop in the role prompt before source reading. A clipped threat summary is supplemental and never substitutes for the bound envelope.
Methodology
Step 1: Extract Abstract Pattern
From the historical vulnerable/fixed evidence (Phase 2) or the frozen current finding (Phase 3), derive a pattern specific enough to yield a manageable candidate set (dozens, not thousands) and general enough to catch renamed variables, wrappers, and restructured code. Start from the concrete bug, identify its structural elements (an untrusted flow reaching a sink without its guard, or a valid operation/state/lifetime sequence breaking an invariant), replace names with categories (memcpy-like sink, untrusted size, missing bound; borrowed lifetime, persistent handle, missing reset), and keep the distinguishing constraint — the specific reason the guard is missing or insufficient.
| Original | Too specific | Too general | Just right |
|---|---|---|---|
memcpy(dst, src, untrusted_len) unchecked |
Same variable names | Any memcpy |
memcpy whose length derives from network input with no prior min(len, sizeof(dst)) |
Off-by-one for (i=0; i<=len; i++) |
Same loop variable | Any <= loop |
<= bound with an untrusted-derived limit on a buffer indexed by the loop variable |
malloc(count * sizeof(item)) overflow |
Same struct | Any multiplication in malloc |
malloc(A * B) with A untrusted and no overflow check before the multiply |
uint16_t total = a + b truncation |
Same names | Any addition | Untrusted sum stored narrower than its operands, then used as a size or bound |
| Empty password authenticates | Same auth function | Any auth check | Auth functions where empty or null input returns success early |
access()/stat() then open() |
Same path | Any file-operation pair | Check-then-use on one path with no lock across both and no descriptor-based check (open first with per-component O_NOFOLLOW or RESOLVE_NO_SYMLINKS, then fstat) |
Step 2: Generate Search Queries
Cast a wide net from the pattern: the sink itself; project wrappers that call it (including a
safe_* helper that is not safe) and macros that expand to it; size variables from the same
untrusted source (strlen(untrusted), header->length, ntohs(pkt->len)); the arithmetic shapes
(size + offset, len * count); and the absence of guards — sinks with no preceding bounds check,
checks on one path only, and checks against a different variable than the sink uses.
Step 3: Scan Systematically
In Phase 3, search-query matches control ordering, not the receipt inventory: process every current admitted file. For a file that cannot instantiate, route, configure, or reach any frozen pattern, perform a bounded pattern-inapplicability check and retain that rationale for its non-match receipt. For each candidate match that survives that quick check:
- **Read the candidate function
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл code-variant-analysis?
Systematic scanning for historical bug shapes and variants of current findings across the codebase
Как установить скилл code-variant-analysis?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл code-variant-analysis запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…