variant-analysis

Find similar vulnerabilities across codebases using iterative CodeQL, Semgrep, and ripgrep pattern analysis.

Updated Mar 22, 2026
One-click install
npx skills add https://github.com/TECH-HY/SKILLS --skill variant-analysis-tech-hy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: variant-analysis
Source: https://github.com/TECH-HY/SKILLS/tree/main/skills/variant-analysis
Command: npx skills add https://github.com/TECH-HY/SKILLS --skill variant-analysis-tech-hy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? After discovering one vulnerability, security analysts need to find every other place the same root cause appears, but ad-hoc searching misses variants in other modules, related functions, and edge cases. This Skill provides a systematic five-step methodology for turning a known bug into progressively generalized search patterns while controlling false positive rates. ## Core Features & Use Cases - Five-Step Variant Hunting Process: Understand the root cause, build an exact match, identify abstraction points, generalize one element at a time, and triage results with confidence and exploitability ratings. - Ready-to-Use Query Templates: Prebuilt Semgrep taint-tracking rules for Python, JavaScript, Java, Go, and C/C++, plus CodeQL templates and a structured variant report template. - Tool Selection Guidance: Decision table mapping scenarios to the right tool, from ripgrep for quick recon to CodeQL for cross-function data flow analysis. - Use Case: After finding a SQL injection in one Flask route, use the Skill to generalize the pattern into a Semgrep taint rule, scan the entire repository, and document three additional confirmed variants in a structured report. ## Quick Start Use the variant-analysis skill to search this entire repository for other instances of the SQL injection pattern just found in api/handlers.py.

Frequently Asked Questions about variant-analysis

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find similar vulnerabilities after discovering one bug?

Start with an exact-match ripgrep pattern for the known vulnerable code, then generalize one element at a time using Semgrep metavariables and wildcards. Verify matches after each step and stop when the false positive rate exceeds roughly 50 percent.

Should I use Semgrep or CodeQL for variant analysis?

Use Semgrep for fast iteration, simple patterns, and code that does not build; use CodeQL when you need cross-function interprocedural data flow analysis. Ripgrep works best for initial reconnaissance to find hotspots before deeper analysis.

How do I write a Semgrep taint rule to track user input to dangerous sinks?

Define pattern-sources such as request.args.get or req.query, pattern-sinks such as os.system or cursor.execute, and pattern-sanitizers like shlex.quote, then set mode to taint. The Skill provides ready-made templates for Python, JavaScript, Java, Go, and C/C++.

Why does my vulnerability search miss variants in other files?

Searches scoped only to the module where the original bug was found miss variants elsewhere in the codebase. Always run patterns against the entire repository root and enumerate semantically related functions, such as isAdmin or isVerified alongside isAuthenticated.

What false positive rate is acceptable for security pattern matching?

Acceptable rates depend on context: under 5 percent for CI blocking, under 20 percent for developer warnings, under 50 percent for audit triage, and up to 80 percent for exploratory research. Filter common false positives by excluding test directories and adding sanitizer patterns.

When should I not use variant analysis?

Do not use it for initial vulnerability discovery, general code review without a known pattern, or writing fix recommendations. It requires an already-identified bug with an understood root cause as its starting point.