Comprehensive security scanning workflow for Go projects. Includes vulnerability detection, secret scanning, license compliance checks, and SBOM generation using industry-standard tools.
- Gosec - Go security scanner with SARIF upload
- govulncheck - Official Go vulnerability database
- Nancy - Sonatype dependency vulnerability scanner
- Trivy - Filesystem security scanner
- TruffleHog - Secret detection
- go-licenses - License compliance checking
- SBOM - Software Bill of Materials generation (SPDX format)
- Dependency Review - GitHub-native PR dependency check
- SARIF uploads to GitHub Security tab
- Configurable severity levels and scanners
- Security summary with all scan results
name: Security
on:
push:
branches: [develop, release-candidate, main]
pull_request:
branches: [develop, release-candidate, main]
schedule:
- cron: '0 0 * * 1' # Weekly on Mondays
workflow_dispatch:
jobs:
security:
uses: LerianStudio/github-actions-shared-workflows/.github/workflows/go-security.yml@v1.0.0name: Security
on: [push, pull_request]
jobs:
security:
uses: LerianStudio/github-actions-shared-workflows/.github/workflows/go-security.yml@v1.0.0
with:
go_version: '1.23'
enable_gosec: true
enable_govulncheck: true
enable_trivy: true
enable_secret_scan: true
trivy_severity: 'CRITICAL,HIGH'
upload_sarif: true
fail_on_security_issues: truename: Security
on: [push, pull_request]
jobs:
security:
uses: LerianStudio/github-actions-shared-workflows/.github/workflows/go-security.yml@v1.0.0
with:
# Only run critical scanners
enable_gosec: true
enable_govulncheck: true
enable_trivy: true
# Skip less critical scanners
enable_nancy: false
enable_license_check: false
enable_sbom: false| Input | Description | Required | Default |
|---|---|---|---|
runner_type |
GitHub runner type to use | No | ubuntu-latest |
go_version |
Go version for security scanning | No | 1.23 |
enable_dependency_review |
Enable GitHub dependency review (PR only) | No | true |
enable_gosec |
Enable Gosec security scanner | No | true |
enable_govulncheck |
Enable Go vulnerability database check | No | true |
enable_nancy |
Enable Nancy dependency scanner | No | true |
enable_trivy |
Enable Trivy filesystem scanner | No | true |
enable_secret_scan |
Enable TruffleHog secret scanning | No | true |
enable_license_check |
Enable go-licenses compliance check | No | true |
enable_sbom |
Enable SBOM generation | No | true |
trivy_severity |
Trivy severity levels (comma-separated) | No | CRITICAL,HIGH |
license_disallowed_types |
Disallowed license types (comma-separated) | No | forbidden,restricted |
upload_sarif |
Upload SARIF to GitHub Security tab | No | true |
fail_on_security_issues |
Fail workflow on critical issues | No | true |
No secrets required. All scanners use public databases and GitHub's built-in token.
GitHub-native dependency review for pull requests.
Go security scanner that finds security issues in Go code.
Official Go vulnerability database scanner.
Sonatype Nancy dependency vulnerability scanner.
Aqua Security Trivy filesystem scanner.
TruffleHog secret detection scanner.
go-licenses compliance checker.
Software Bill of Materials generation.
Aggregate summary of all security scans.
jobs:
security:
uses: LerianStudio/github-actions-shared-workflows/.github/workflows/go-security.yml@v1.0.0jobs:
security:
uses: LerianStudio/github-actions-shared-workflows/.github/workflows/go-security.yml@v1.0.0
with:
enable_gosec: true
enable_govulncheck: true
enable_secret_scan: true
enable_nancy: false
enable_trivy: false
enable_license_check: false
enable_sbom: falsejobs:
security:
uses: LerianStudio/github-actions-shared-workflows/.github/workflows/go-security.yml@v1.0.0
with:
fail_on_security_issues: falseRecommended: Run security scans weekly even without code changes:
name: Security
on:
schedule:
- cron: '0 0 * * 1' # Every Monday at midnight
workflow_dispatch: # Allow manual trigger
jobs:
security:
uses: LerianStudio/github-actions-shared-workflows/.github/workflows/go-security.yml@v1.0.0- Pin to version: Use
@v1.0.0instead of@v1.0.0for production - Scheduled scans: Run weekly to catch new vulnerabilities
- SARIF upload: Keep enabled to track issues in GitHub Security tab
- Selective scanning: Disable scanners you don't need to reduce run time
- Custom severity: Adjust Trivy severity based on your risk tolerance
- Go CI - Continuous integration testing
- Go Release - Automated release creation
Last Updated: 2025-11-22 Version: 1.0.0