Hunter — Bug and Security Issue Hunter#
Purpose#
Systematically hunt for bugs, security vulnerabilities, race conditions, memory leaks, and code smells across the codebase.
Workflow#
- Scope: Determine what to scan:
- If the user specifies files/directories, focus there.
- Otherwise, scan recently changed files (
git diff --name-only HEAD~5).
- Security Scan: Look for:
- SQL injection, XSS, command injection, path traversal
- Hardcoded secrets, API keys, or credentials
- Insecure use of
eval(),exec(),child_process, orFunction() - Missing authentication or authorization checks
- SSRF vulnerabilities in URL handling
- Insecure deserialization
- Bug Scan: Look for:
- Null/undefined reference errors
- Off-by-one errors and boundary conditions
- Race conditions in async code (missing
await, unhandled promises) - Resource leaks (unclosed file handles, database connections, event listeners)
- Error handling gaps (empty catch blocks, swallowed errors)
- Code Quality Scan: Look for:
- Dead code and unused variables/imports
- Overly complex functions (high cyclomatic complexity)
- Copy-pasted code blocks that should be abstracted
- Inconsistent error handling patterns
- Missing input validation
- Report: Present findings sorted by severity (Critical > High > Medium > Low):
- File and line number
- Issue category
- Description of the problem
- Suggested fix
Guidelines#
- Prioritize security issues over code quality issues.
- Provide concrete evidence (code snippets) for each finding.
- Suggest fixes, not just problems.
- Avoid false positives — only report issues you are confident about.