vuln-guard
Use when reviewing changes or committing ANY Go code in this project — catches security vulnerabilities that scanners miss (auth/crypto logic, unsafe API use, injection). Pairs with the gosec + govuln
SKILL.md.claude/skills/vuln-guard/SKILL.md
GitHubVuln Guard
Goal: no exploitable vulnerability reaches the repo. Layers:
- Deterministic, pre-commit —
gosec(Go SAST, 30+ rules) andgovulncheck(reachable dependency/stdlib CVEs) run in the gitpre-commithook (mise run scan:code:staged) and block the commit on a finding. - Deterministic, CI —
syftbuilds a CycloneDX SBOM andgrypescans it for CVEs (mise run sbom+mise run scan:sbom), as a dependency safety net. - AI review (this skill) — before you (Claude)
git commit, the PreToolUse hook injects this checklist so you reason about logic-level security the scanners can't.
Review the staged diff for:
- Crypto:
math/randfor anything security-relevant (usecrypto/rand), weak hashes (MD5/SHA1) for security, hardcoded keys/IVs,tls.Config{InsecureSkipVerify:true}, outdated TLS versions, ECB/static-IV modes. - Injection & untrusted input: building SQL/commands/paths from user input,
os/execwith a shell or interpolated args,text/template(nothtml/template) for HTML, path traversal (..), unvalidated deserialization. - AuthN/AuthZ logic: missing permission checks,
==for secret comparison (usesubtle.ConstantTimeCompare), JWT alg/signature not verified, predictable tokens/IDs, auth bypass on error paths. - Memory/DoS: unbounded reads/allocations from input, missing size limits on
request bodies, integer overflow in size math,
ReadAllon untrusted streams. - Resource handling: missing
defer Close(), leaking file descriptors, TOCTOU on files, world-writable file perms (0666/0777). - Errors that leak: returning internal errors/stack traces to clients, logging secrets or PII.
How to act
- Run
git diff --cachedand check the categories above. - On a finding: fix it, or if it is a deliberate false positive, annotate narrowly
(
//nolint:gosec // reason) — never silence whole files. - For a flagged dependency CVE (govulncheck/grype): bump the module, or if no fix exists, confirm the vulnerable symbol is unreachable and document why.
Notes
- gosec/govulncheck are the hard gates; this skill is the logic-level safety net.
- SBOM/grype run in CI (heavier, network) — see
mise run ci.