What is Gosec?
Gosec is a static analysis tool for Go source code that inspects the AST for security problems. It checks for issues like hardcoded credentials, SQL injection, directory traversal, and insecure use of cryptographic functions. Gosec is the standard SAST tool for Go projects and produces JSON output compatible with AppGuard ingestion.
Supported result formats
JSONSARIF
Integrate Gosec with AppGuard
1
Install Gosec
Install Gosec via Go.
go install github.com/securego/gosec/v2/cmd/gosec@latest
2
Run a scan
Run Gosec against your Go project.
gosec -fmt=json -out=results.json ./...
3
Push to AppGuard
Send the results to AppGuard.
curl -X POST "$APPGUARD_PUBLIC_URL/api/ingest" \ -H "X-Api-Token: $API_TOKEN" \ -F "[email protected]"
What AppGuard adds to Gosec
Cross-language correlation
See Go findings alongside Python, JavaScript, and other languages.
Severity trending
Track Gosec findings across releases to measure improvement.
Remediation tracking
Assign Go-specific findings to developers with due dates.
Track Gosec results with AppGuard
Self-host AppGuard and connect Gosec in minutes. AGPLv3 licensed, full data ownership.
Frequently Asked Questions
What is the difference between Gosec and Semgrep for Go?
Gosec is Go-specific with deep AST analysis for Go security patterns. Semgrep supports Go alongside 30+ other languages. Use both for comprehensive coverage.
Does Gosec support suppression comments?
Yes. You can suppress specific findings with nolint comments in your Go code, similar to other Go linting tools.