gosec
$ gosec Foundation Low Riskgosec 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.
brew install gosec gosec -fmt=json uses the local Go toolchain type-checker directly on disk with zero network or MCP overhead.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
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
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
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
Fast, type-aware Go security scanner with fine-grained rule IDs (G101–G602) and #nosec suppression support.
- Granular rule selection with
-include/-exclude
De facto Go security linter maintained by the SecureGo organization.
- Long-running SecureGo project on GitHub
Well-documented rule catalog and CLI flags on securego.io.
- Official docs at securego.io/docs/usage/
Security, Auth & Guardrails
None required; operates purely offline on local Go packages.
100% free, offline, and open-source (Apache-2.0).
# 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
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).
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-failpipeline ergonomics with rule-level-severityand-excludefiltering. - + Type-aware Go AST/SSA analysis catches real taint and crypto flaws locally.
Caveats & Pitfalls
- ! Requires a working
gotoolchain and resolved module cache to type-check packages. - ! Without
-quiet, stderr progress logs can interleave with terminal output.