samber/cc-skills-golang / skills/golang-security
golang-security
FlaggedSecurity best practices and vulnerability prevention for Golang — injection (SQL, command, XSS), cryptography, path traversal, SSRF and HTTP security headers, cookies, secrets management, memory safety, PII in logs, STRIDE/DREAD threat modeling, plus `gosec` SAST, race detection, and fuzz testing. Apply when writing, reviewing, or auditing Go code for security, or when touching crypto, file or network I/O, secrets, user input, or authentication. Not for non-exploitable defensive bugs such as nil panics or slice aliasing (→ See `samber/cc-skills-golang@golang-safety` skill), dependency vulnerability scanning with govulncheck (→ See `samber/cc-skills-golang@golang-dependency-management` skill), or wiring security scanners into CI pipelines (→ See `samber/cc-skills-golang@golang-continuous-integration` skill).
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 14.0 KB |
| evals/evals.json | config | 49.0 KB |
| references/architecture.md | markdown | 10.4 KB |
| references/checklist.md | markdown | 4.0 KB |
| references/cookies.md | markdown | 4.8 KB |
| references/cryptography.md | markdown | 11.0 KB |
| references/filesystem.md | markdown | 6.8 KB |
| references/injection.md | markdown | 7.3 KB |
| references/logging.md | markdown | 3.9 KB |
| references/memory-safety.md | markdown | 5.1 KB |
| references/network.md | markdown | 6.3 KB |
| references/secrets.md | markdown | 4.8 KB |
| references/third-party.md | markdown | 4.9 KB |
| references/threat-modeling.md | markdown | 8.4 KB |
references/checklist.md
View on GitHub# Security Review Checklist
Severity: Critical, High, Medium, Low
## Input Handling
- [ ] **High** All user input validated at system boundaries — internal code trusts the boundary
- [ ] **High** Input uses allowlists, not blocklists — blocklists always miss something
- [ ] **High** Sanitized on output (HTML, SQL, shell) — context-dependent escaping
- [ ] **Medium** Length limits enforced — prevents buffer abuse and DoS
## Database
- [ ] **Critical** SQL queries use parameterized placeholders — keeps data and code separate
- [ ] **Critical** ORM/library protects against SQL injection
- [ ] **Critical** No direct SQL construction with user input
## Code Execution
- [ ] **Critical** No `exec.Command()` with shell arguments — metacharacters enable injection
- [ ] **Critical** No eval, reflection on untrusted input — arbitrary code execution risk
- [ ] **Critical** No deserialization of untrusted data — can trigger arbitrary constructors
## Cryptography
- [ ] **High** Uses `crypto/rand` for security-critical randomness — `math/rand` is predictable
- [ ] **High** Uses vetted algorithms (AES-GCM, Argon2id, bcrypt) — custom crypto hasn't been analyzed
- [ ] **Critical** Proper key management — hardcoded secrets leak through VCS, logs, and backups
- [ ] **Medium** HMAC for message authentication — prevents tampering
## Web Security
- [ ] **High** TLS 1.2+ configured correctly — older versions have known attacks
- [ ] **Medium** Security headers set (HSTS, CSP, X-Frame-Options) — prevents framing, sniffing, downgrade
- [ ] **Medium** CSRF protection for state-changing requests — prevents cross-origin action forgery
- [ ] **Medium** Open redirects validated — attackers use your domain to redirect to phishing
- [ ] **High** XSS protected via `html/template` auto-escaping
## Authentication/Authorization
- [ ] **High** Passwords hashed with Argon2id (preferred) or bcrypt — intentionally slow to resist brute-force
- [ ] **High** Sessions use secure tokens from `crypto/rand`
- [ ] **High** Authorization checked on every privileged action — not just at login
- [ ] **High** JWT tokens validated (algorithm, claims, expiry) — unsigned JWTs bypass auth
- [ ] **High** Expired/invalid sessions invalidated server-side
## Error Handling
- [ ] **Medium** Generic error messages to users — detailed errors help attackers map your system
- [ ] **Medium** Detailed errors logged server-side only
- [ ] **Medium** Stack traces not leaked to clients
- [ ] **Medium** Database errors not exposed — reveals schema and query structure
## Dependency Security
- [ ] **High** `govulncheck` passes — catches known CVEs in your dependency tree
- [ ] **High** Dependencies updated regularly — unpatched deps are the #1 attack vector
- [ ] **Medium** Third-party libraries reviewed for security posture
## HTTP Security Headers
- [ ] **Medium** `Content-Security-Policy` set — restricts resource sources to prevent XSS
- [ ] **Medium** `X-Frame-Options: DENY` — prevents clickjacking via iframe embedding
- [ ] **Medium** `X-Content-Type-Options: nosniff` — prevents MIME-type sniffing attacks
- [ ] **Medium** `Strict-Transport-Security` with `includeSubDomains` — forces HTTPS, prevents downgrade
- [ ] **Low** `Referrer-Policy` set — controls referrer header leakage to external sites
- [ ] **Low** `Permissions-Policy` set — restricts browser features (camera, mic, geolocation)
## Rate Limiting & DoS Prevention
- [ ] **Medium** HTTP server has `ReadTimeout`, `WriteTimeout`, `IdleTimeout` — prevents Slowloris
- [ ] **Medium** Request body size limited with `http.MaxBytesReader` — prevents memory exhaustion
- [ ] **Medium** Rate limiting on authentication endpoints — prevents brute-force and credential stuffing
- [ ] **Medium** Rate limiting on expensive operations (search, export, file upload)
## Concurrency
- [ ] **High** `-race` detector passes — races cause data corruption and can bypass auth checks
- [ ] **High** Shared state properly synchronized
- [ ] **High** No data races on global variables
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |