Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

gosec

$ gosec Foundation Low Risk
SecureGo · Security & Secrets · Apache-2.0 · macos / linux / windows

gosec inspects Go source code ASTs and SSA representations for common security vulnerabilities (SQLi, weak crypto, command injection, unsafe file permissions). It runs completely offline with native -fmt=json / -fmt=sarif, -severity and -exclude filtering, and -no-fail for clean agent pipelines.

FCRS-1.0 Score
93 /100
Excellent
Medium Confidence
Zero-Friction Install
brew install gosec
CLI vs MCP Decision CLI Only

gosec -fmt=json uses the local Go toolchain type-checker directly on disk with zero network or MCP overhead.

Agent-Readiness Checklist

✓ JSON Output
✓ Field Filtering
✓ Non-Interactive
— Dry-Run
✓ Read-Only Mode
— NO_COLOR Clean
— Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 23 / 25

First-class -fmt=json / -fmt=sarif, -severity, -confidence, -exclude, -quiet, and -no-fail make it effortless for agent pipelines.

  • Native -fmt=json, -fmt=sarif, -quiet, and -no-fail
Trust & Safety 24 / 25

Strictly read-only Go AST/SSA static analyzer with no network calls or code execution; writes only when -out is passed.

  • Purely local read-only AST inspection
Setup & Portability 14 / 15

Available via brew install gosec, go install, and GitHub Releases across macOS, Linux, and Windows (requires Go toolchain).

  • Multi-OS releases and standard go install
Utility & Efficiency 14 / 15

Fast, type-aware Go security scanner with fine-grained rule IDs (G101–G602) and #nosec suppression support.

  • Granular rule selection with -include/-exclude
Maintenance & Lineage 9 / 10

De facto Go security linter maintained by the SecureGo organization.

  • Long-running SecureGo project on GitHub
Docs & Verifiability 9 / 10

Well-documented rule catalog and CLI flags on securego.io.

  • Official docs at securego.io/docs/usage/

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

None required; operates purely offline on local Go packages.

Side Effects
Read-Only Local Write
Cost & Quotas

100% free, offline, and open-source (Apache-2.0).

Copyable Guardrail for CLAUDE.md / AGENTS.md
# gosec Agent Rules
- Always pass `-fmt=json -quiet` (and `-no-fail` when capturing JSON in pipelines) so progress logs do not pollute stdout.
- Ensure Go module dependencies are already fetched (`go mod download`) before running `gosec` offline.

Agent-Ready Command Recipes

Safe Read-Only Queries

Scan Go module and emit JSON findings
gosec -fmt=json -no-fail -quiet ./...

Inspects all Go packages under ./..., suppresses banner noise (-quiet), and prints JSON to stdout with exit code 0 (-no-fail).

Scan for high-severity issues and export SARIF
gosec -fmt=sarif -severity=high -out=gosec.sarif ./...

Filters strictly for high severity rules and writes a SARIF report to gosec.sarif.

Strengths for Agents

  • + Clean -fmt=json -quiet -no-fail pipeline ergonomics with rule-level -severity and -exclude filtering.
  • + Type-aware Go AST/SSA analysis catches real taint and crypto flaws locally.

Caveats & Pitfalls

  • ! Requires a working go toolchain and resolved module cache to type-check packages.
  • ! Without -quiet, stderr progress logs can interleave with terminal output.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI