golang-security

Audit and write Go code against injection, cryptography, and web security vulnerabilities.

Updated Jun 30, 2026
One-click install
npx skills add https://github.com/santoshkal/chezmoi --skill golang-security-santoshkal
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: golang-security
Source: https://github.com/santoshkal/chezmoi/tree/main/private_dot_config/opencode/skills/Golang/skills/golang-security
Command: npx skills add https://github.com/santoshkal/chezmoi --skill golang-security-santoshkal

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires govulncheck, and includes references (resource) components.

What problem does it solve? Go codebases often ship with preventable vulnerabilities like SQL injection, weak cryptography, hardcoded secrets, and missing security headers. This Skill gives an AI coding agent a structured security methodology — threat modeling, severity scoring, and domain-specific references — to find, prioritize, and fix these issues during code review, full audits, or new development. ## Core Features & Use Cases - Three operating modes: Review mode for PR security analysis, Audit mode that fans out five parallel sub-agents across vulnerability domains (injection, crypto, web, auth, concurrency) with DREAD severity scoring, and Coding mode for writing secure new code. - Deep reference library: Detailed guides with Go code examples covering cryptography (AES-GCM, Argon2id, TLS), injection (SQL, command, XSS, SSRF), filesystem safety (path traversal, ZipSlip), cookies, secrets management, logging, and security architecture patterns. - Tooling integration: Uses govulncheck, gosec, race detector, and fuzz testing to verify findings, plus a comprehensive severity-tagged review checklist. - Use Case: Ask the agent to audit a Go REST API before launch — it scans for injection flaws, weak TLS config, missing rate limiting, and PII in logs, then reports findings ranked by DREAD severity with concrete fixes. ## Quick Start Ask the agent to perform a security audit of your Go project and report vulnerabilities ranked by severity.

Frequently Asked Questions about golang-security

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

FAQPage Schema
How do I audit Go code for security vulnerabilities?▼

Run a full-codebase audit that fans out parallel checks across five domains: injection, cryptography, web security, authentication, and concurrency. Findings are scored with DREAD and reported by severity, then verified with govulncheck and gosec.

How to prevent SQL injection in Go database queries?▼

Use parameterized queries with placeholders ($1 for pgx, ? for MySQL) via database/sql, sqlx, or pgx. Never concatenate user input into query strings; allowlist identifiers for dynamic column names and ORDER BY clauses.

What password hashing algorithm should Go applications use?▼

Use Argon2id as the preferred password hashing algorithm, with bcrypt as a simpler alternative. Avoid MD5, SHA1, and plain SHA-256, which are too fast and vulnerable to brute-force attacks.

Does Go 1.24 help prevent path traversal attacks?▼

Yes, Go 1.24 introduces os.Root, which confines file operations to a root directory at the OS level and rejects escaping symlinks. For older versions, use filepath.IsLocal plus filepath.Rel with separator-aware checks.

Why is math/rand unsafe for generating session tokens in Go?▼

math/rand is a deterministic PRNG whose output is predictable once the seed or enough output is observed, even if seeded from crypto/rand. Always use crypto/rand.Read directly for tokens, keys, and nonces.

What are the limitations of gosec and govulncheck for Go security?▼

govulncheck only detects known CVEs in dependencies, and gosec catches common SAST patterns — neither finds logic flaws like broken authorization or algorithm confusion in JWT validation. Manual data-flow review across trust boundaries is still required.