golang-security
Skill5 starsChanged 47 days agoMITView on GitHub
use this when writing, reviewing, or auditing Go for exploitable issues — injection, crypto, path, SSRF, cookies, secrets, PII in logs, authn/z — not nil/slice bugs (golang-safety) or test-harness design (golang-testing).
- Installs packages
15 other projects use a version of this.
Adopted by
Most recently taken up by
- aiproxer/aiproxertheir own version, first seen Nov 8, 2026
- TeddyAlbina/skillstheir own version, first seen Nov 1, 2026
- samber/cc-skills-golangtheir own version, first seen Nov 1, 2026
- poizoncoded/skillstheir own version, first seen Nov 1, 2026
- klawisha012/agentsynctheir own version, first seen Oct 25, 2026
- jniltinho/llama-modeltheir own version, first seen Oct 15, 2026
Used with
Projects with it also use golang-how-to, golang-gopls and 9 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
alexastrumSkillgolang-how-to
Golang skills orchestrator — always active on any Golang coding, review, debug, or setup task. Reads the task context and loads the most relevant skills from samber/cc-skills-golang, often multiple at once: writing a gRPC service loads golang-grpc + golang-testing + golang-error-handling; debugging a panic loads golang-troubleshooting + golang-safety; auditing security loads golang-security + golang-lint + golang-safety. Also: disambiguates competing clusters when two skills seem to overlap (performance vs benchmark vs troubleshooting, samber/lo vs mo vs ro, DI cluster, safety vs security), and configures CLAUDE.md or AGENTS.md to force-trigger skills in a project (/golang-how-to configure).
Also in 7 projects that use this
jkeddariSkillgolang-gopls
Golang semantic code intelligence with the official gopls language server: definitions, references, symbols, call and implementation hierarchies, diagnostics, formatting, code actions, safe rename, extract, inline, and package API discovery. Use when navigating or refactoring a local Go workspace or when semantic analysis is safer than text search.
Also in 5 projects that use this
jkeddariSkillgolang-refactoring
Golang refactoring workflow for safe structural change: blast-radius discovery, coverage-adaptive safety nets, semantic rename and extract operations, package moves, import-cycle removal, staged commits, and behavior-preserving verification. Use when restructuring existing Go code without intentionally changing its public behavior.
Also in 5 projects that use this
alexastrumSkillgolang-swagger
Golang OpenAPI/Swagger documentation with swaggo/swag — annotation comments (@Summary, @Param, @Success, @Router, @Security), swag init code generation, framework integrations (gin, echo, fiber, chi, net/http), security definitions (Bearer/JWT, OAuth2, API key), and struct tags (swaggertype, enums, example, swaggerignore). Apply when adding or maintaining Swagger/OpenAPI docs in a Go project, or when the codebase imports github.com/swaggo/swag, github.com/swaggo/gin-swagger, github.com/swaggo/echo-swagger, github.com/swaggo/http-swagger, or github.com/swaggo/files.
Also in 7 projects that use this
rockcookiesSkillgolang-pkg-go-dev
Golang package and module documentation and exploration via `godig`, a pkg.go.dev API client (CLI + MCP server) — package docs, API references, symbols, code examples, available versions, importers (who imports a package), licenses, and known vulnerabilities. Read-only, no auth. Use for looking up any Go/Golang library's documentation, API signatures, usage examples, which versions exist, whether a dependency has CVEs, or who imports a package — prefer this over Context7 for any Go package or module. Triggers on: how to use a Go library, Go API docs, import usage, code examples, pkg.go.dev. Not for upgrading dependencies (→ See `golang-dependency-management` skill) or choosing a library (→ See `golang-popular-libraries` skill). Not for local symbols, or for navigating an already-used dependency's resolved source, call sites, or generic instantiations — → See `golang-gopls` skill for those.
Also in 4 projects that use this
- +6 more from alexastrum
Other versions15 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 15
- samber/cc-skills-golang★ 3.8ksame name
- unxed/f4★ 261same name
- aiproxer/aiproxer★ 22same name
- klawisha012/agentsync★ 18same name
- alexastrum/skl★ 11same name
- tstapler/dotfiles★ 8same name
- poizoncoded/skills★ 2same name
- TeddyAlbina/skills★ 2same name
- jkeddari/go-skills★ 1same name
- rockcookies/skills★ 1same name
5 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository49 other files it gives its agents.
- AGENTS.mdAGENTS.md
- maintainers/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- buying-researcherSkill
- cursor-cloud-agents-whenSkill
- debug-anthropicSkill
- debug-pocockSkill
- debugSkill
- discover-the-ideaSkill
- docs-google-styleSkill
- golang-safetySkill
- golang-testingSkill
- grok-acpSkill
- host-config-pyinfraSkill
- lang-cppSkill
- lang-csharpSkill
- lang-cSkill
- lang-dartSkill
- lang-dockerSkill
- lang-goSkill
- lang-javaSkill
- lang-js-tsSkill
- lang-kotlinSkill
- lang-luaSkill
- lang-makefileSkill
- lang-phpSkill
- lang-powershellSkill
- lang-protobufSkill
- lang-pythonSkill
- lang-rubySkill
- lang-rustSkill
- lang-shellSkill
- lang-sqlSkill
- lang-swiftSkill
- lang-terraformSkill
- language-routerSkill
- lang-web-markupSkill
- modern-pythonSkill
- pr-reviewSkill
- sdlc-artifactsSkill
- sdlc-onboardingSkill
- security-hardeningSkill
- shell-safetySkill
- tddSkill
- tracker-sdlcSkill
- ui-craftSkill
- ux-designSkill
- verify-before-doneSkill
- yagniSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 3 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 15 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 83
Do not flag a snippet in isolation.
- Distinctive: line 86
Check upstream validation / allowlists / type parse.
- Distinctive: line 151
Stop. Classify. Ask or never — do not ship.
“Common” is measured: kept by at least 6 in 10 of the 15 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Go security
Rewrite of samber/cc-skills-golang golang-security @ 22c58a55. Not a vendor paste. SKILL only — no evals/, no scripts/, no references/. Compatible with security-hardening: LLM output is untrusted; the system prompt is not a boundary.
language-router picks one Go skill per turn: this skill, golang-safety or golang-testing. Each Go concern may be its own item.
Iron law
Every trust-boundary crossing gets a control in code. Validate input, parameterize queries, encode for the sink, fail closed. Upstream validation adjusts severity; it does not dismiss the finding.
Three questions
- Trust boundary — where does untrusted data enter? (HTTP, uploads, env, other services' rows)
- Attacker control — which inputs reach SQL, shell, HTML, paths, crypto, or outbound HTTP?
- Blast radius — leak, RCE, auth bypass, or DoS if this layer fails?
Always
| Rule | Go move |
| Parameterize every query | database/sql / pgx placeholders ($1 / ?). Allowlist identifiers (ORDER BY, columns). Never concat user text into SQL. |
| Exec without a shell | exec.Command(bin, args...). Never sh -c / bash -c with user text. |
| Encode for the HTML sink | html/template (auto-escape). html.EscapeString if you must Fprintf. |
| Scope file paths | Go 1.24+: os.Root. Older: filepath.IsLocal + filepath.Rel. Never Clean + HasPrefix alone. |
| Authenticated crypto | AES-256-GCM or ChaCha20-Poly1305. Fresh nonce per seal. crypto/rand, not math/rand. |
| Slow password hashes | Argon2id preferred; bcrypt OK. Not MD5 / SHA-1 / bare SHA-256. |
| Constant-time secrets | crypto/subtle.ConstantTimeCompare or hmac.Equal. Not ==. |
| TLS 1.2+ and verify certs | MinVersion: tls.VersionTLS12. No InsecureSkipVerify. SSH: FixedHostKey, not InsecureIgnoreHostKey. |
| Timeouts on HTTP servers | ReadTimeout / WriteTimeout / IdleTimeout / MaxHeaderBytes. |
| Secure session cookies | HttpOnly, Secure, SameSite=Lax or Strict. |
| Secrets from env or a manager | Fail closed if required secret is empty. |
| Generic client errors | Log details server-side. No stack traces, DSNs, or SQL text to clients. |
| Server-side authn/z | Every handler. Do not trust X-Forwarded-For / X-Is-Admin. |
| Race-sensitive shared state | sync.Mutex / channels. Prove with go test -race (golang-testing). |
Ask first
| Topic | Why it is a stop |
| New auth / session shape | Trust-boundary widen — same as security-hardening |
| New egress or SSRF-shaped fetch | Outbound URL from user input needs an allowlist + no link-local / metadata |
| Uploads / zip extract | ZipSlip, zip bombs, special files |
| Public pprof / debug mux | /debug/pprof is a leak if reachable |
SameSite=None or cookie Domain | CSRF / cross-site widening |
Skipping -race or fuzz on a security-touching change | Proof belongs with golang-testing |
| Review/audit growing write or deploy tools | Review skills should not write — read, report |
Record the decision on the LLD or ticket. Do not self-except.
Never
| Never | Why |
| SQL / command / HTML string-built from user or model text | Injection (CWE-89 / 78 / 79) |
| Hardcoded secrets, DSNs, or JWT keys in source | History is forever |
math/rand for tokens, IDs, or nonces | Predictable |
| DES, RC4, MD5, SHA-1, AES-ECB, or reused GCM nonce | Broken or catastrophic |
Ignoring crypto / encrypt errors (_, _ = …) | Fail-open |
| Rolling your own crypto | Use stdlib / x/crypto |
gob of untrusted input | Unsafe deserialization |
Bind 0.0.0.0 or public mesh from a one-off | Network becomes the client |
World-writable files (0777 / 0666) | Data-class fail |
| PII, tokens, or passwords in logs | security-hardening Never |
| Personal finance, mail, password stores, or extra hosts without the operator | Host / account locks |
Copy evals/ or scripts/ into this skill dir | INTAKE quarantine |
| Install the samber pack / marketplace sync | Dual routers; pin stays |
Host and personal-account locks are Never, not Ask first.
Modes
- Review — start at the diff, then trace call sites and data flow. A vuln may live outside the hunk. Read, report, escalate. Do not grow write/merge tools to “finish the review.”
- Audit — cover five domains: (1) injection, (2) crypto and secrets, (3) web / headers / cookies, (4) authn/z, (5) races that break authz. Score DREAD; one fix = one PR. Do not dump a mixed-concern patch.
- Coding — write behind Always. Optionally grep new code for concat-SQL,
sh -c,InsecureSkipVerify, and hardcoded keys while implementing.
Research before reporting
Do not flag a snippet in isolation.
- Trace the value to its origin (user, constant, internal).
- Check upstream validation / allowlists / type parse.
- Note remaining defenses (middleware,
os.Root, parameterized store). - Report with adjusted severity, not a silent skip. If you downgrade, leave a short
// security:comment naming the control.
Defense in depth: every layer still protects itself. A concat reachable only through parseUserID() int is medium, not dismissed.
Severity (DREAD)
| Level | Score | Meaning |
| Critical | 8–10 | RCE, full breach, credential theft — fix now |
| High | 6–7.9 | Auth bypass, broken crypto, significant leak — this PR / sprint |
| Medium | 4–5.9 | Session / timing / defense weakening — next pass |
| Low | 1–3.9 | Best-practice drift — opportunistic |
Escalate Critical/High to the operator. Do not bury them in a follow-up with no ticket ID.
STRIDE at the boundary
For each crossing: spoofing (authn), tampering (integrity), repudiation (audit log), disclosure (encrypt / no PII logs), DoS (timeouts / rate limits), elevation (authz). Score with DREAD. Do not treat STRIDE as a substitute for the security LLD/PR gate.
Compact rules
Injection / SSRF. Placeholders for values; allowlist for identifiers. Dynamic IN = generated $n plus bound args (sqlx.In + Rebind). Block file:, link-local, and metadata hosts on outbound URLs. Prefer JSON with a typed struct over gob / interface{}.
Filesystem. os.Root for user paths and zip extract. Cap decompressed size; treat limit-hit as error, not io.EOF. Temps via os.CreateTemp + 0600. Dirs 0750, secret files 0600.
HTTP. Allowlist redirect hosts; reject javascript: / data:. No public net/http/pprof. Reject XML DTD / ENTITY. Headers as the app requires (HSTS, CSP, frame, nosniff) — same bar as security-hardening.
Cookies. Session cookies: HttpOnly + Secure + SameSite. Cookie-store keys from env, not literals.
Logging. Structured fields (log/slog). Never %+v a struct that holds a password or token.
Not this skill. Nil panics, typed-nil interfaces, append aliasing → golang-safety. Table-driven tests, t.Parallel, fuzz harness → golang-testing. govulncheck / lockfile audit → tester CI + dependency review, not an install step here.
Tooling (no skill scripts)
go test -race ./...
go test -fuzz=Fuzzgosec / govulncheck belong in tester hooks when security asks — do not go install them as this skill’s job and do not copy vendor installers.
Roles
| Role | Owns | Does not own |
| security | This gate at LLD/PR for Go boundaries; skill intake | Writing product tests |
| builder | Implementing behind Always; loading the one Go skill language-router picks | Self-excepting “just this query” |
| tester | -race / SAST hooks when they appear | Skipping security because CI is green |
| manager | After-act | Blessing a ship that skipped the gate |
Workers do not bypass security; see Roles. A green gofmt is not a security clear.
Red flags
- “The input is validated upstream, so concat is fine”
- “
filepath.Clean+ prefix is enough” - “
InsecureSkipVerifyis only for staging” - “
math/randis fine for a reset token” - “I’ll log the whole user struct”
- “Review will just apply the fix”
- “Install the samber pack to get Go security”
Stop. Classify. Ask or never — do not ship.
Upstream pin
Intent: samber/cc-skills-golang skills/golang-security @ 22c58a55a0a799b901aa251172923180bad9e010 (MIT). Body is a rewrite. See SOURCES.md.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

