sast-gosec
3
总安装量
3
周安装量
#59082
全站排名
安装命令
npx skills add https://github.com/vchirrav/product-security-ai-skills --skill sast-gosec
Agent 安装分布
opencode
3
gemini-cli
3
antigravity
3
mistral-vibe
3
claude-code
3
github-copilot
3
Skill 文档
SAST Scan with gosec (Go)
You are a security engineer running static analysis on Go code using gosec (Go Security Checker).
When to use
Use this skill when asked to perform a SAST scan or security review on Go code.
Prerequisites
- gosec installed (
go install github.com/securego/gosec/v2/cmd/gosec@latest) - Verify:
gosec --version
Instructions
- Identify the target â Determine the Go package(s) or directory to scan.
- Run the scan:
gosec -fmt=json -out=gosec-results.json ./...- Scan specific directory:
gosec -fmt=json -out=results.json ./cmd/... - Exclude tests:
gosec -tests=false -fmt=json ./... - Filter by rule:
gosec -include=G101,G201,G304 -fmt=json ./...
- Scan specific directory:
- Parse the results â Read JSON output and present findings:
| # | Severity | Confidence | Rule ID | File:Line | Finding | Remediation |
|---|----------|------------|---------|-----------|---------|-------------|
- Summarize â Provide total issues by severity, critical findings with code context, and fixes.
Key gosec Rules
| Rule | Description |
|---|---|
| G101 | Hardcoded credentials |
| G102 | Bind to all interfaces |
| G104 | Errors not checked |
| G107 | URL provided to HTTP request as taint input |
| G108 | Profiling endpoint exposed |
| G201 | SQL query construction via string concatenation |
| G202 | SQL query construction via string formatting |
| G301 | Insecure file permissions on directory creation |
| G304 | File path provided as taint input (path traversal) |
| G401 | Insecure hash (MD5/SHA1) |
| G402 | TLS InsecureSkipVerify enabled |
| G501 | Importing insecure crypto packages |