2.1 KiB
2.1 KiB
name, description, version, metadata
| name | description | version | metadata | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| security-audit | Scan code for security vulnerabilities: hardcoded secrets, injection vectors, unsafe deserialization, missing auth checks, and path traversal. Use on PRs touching auth, API endpoints, or data handling code. | 1.0.0 |
|
Security Audit
When to use
Run this audit when:
- A PR touches authentication, authorization, or session code
- New API endpoints are added
- Database queries or file I/O paths change
- The issue mentions "security", "vulnerability", "CVE", or "auth"
- A dependency update changes major versions
What to check
1. Hardcoded secrets
Scan for:
- API keys, tokens, passwords in source files
.envfiles committed to the repo- Credentials in test fixtures
Use gitleaks detect --no-git for a fast scan.
2. Injection vectors
- SQL: any string concatenation in query building. Use parameterized queries.
- Command: any
os/execwith user-controlled input. Useexec.Commandwith separate args, neversh -c. - Path: any file path constructed from user input without validation. Use
filepath.Cleanand check the resolved path is within the expected directory.
3. Unsafe deserialization
json.Unmarshalon untrusted input intointerface{}ormap[string]anywithout validationyaml.UnmarshalwithoutKnownFieldsor strict modegob.Decodeon network input
4. Missing auth checks
- New endpoints without middleware
- Internal/admin endpoints exposed without auth
- Token validation that only checks signature, not expiry or revocation
5. Dependency CVEs
Run trivy fs --severity HIGH,CRITICAL . on the repository.
Report each finding with:
- Package name and version
- CVE ID
- CVSS score
- Fixed version (if available)
Reporting
For each finding, report:
- Severity: Critical / High / Medium / Low
- Location: file, line, function
- Description: what's wrong
- Fix: specific code change needed
- Prevention: how to catch this in future (lint rule, gate addition)
If nothing is found, report clean. Never fabricate findings.