477a6c2927
- Updated SonarCloud exclusions to include CLI tools and examples for better security hotspot analysis. - Added new issue exclusions for hardcoded IP addresses and credentials in test files and CLI tools. - Upgraded various GitHub Actions to their latest versions for improved performance and security. - Streamlined CI workflows by ensuring consistent usage of action versions across all jobs.
70 lines
2.0 KiB
YAML
70 lines
2.0 KiB
YAML
name: Security Scan
|
|
|
|
on:
|
|
push:
|
|
branches: [ master, main ]
|
|
pull_request:
|
|
branches: [ master, main ]
|
|
schedule:
|
|
- cron: '0 0 * * 0' # Weekly on Sunday
|
|
|
|
permissions:
|
|
contents: read
|
|
security-events: write
|
|
|
|
jobs:
|
|
gosec:
|
|
name: Security Scan (gosec)
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
|
|
with:
|
|
go-version: '1.24'
|
|
|
|
- name: Run Gosec Security Scanner
|
|
uses: securego/gosec@6fbd381238e97e1d1f3571f527c134d5b5ce6986 # v2.21.4
|
|
with:
|
|
args: '-no-fail -fmt json -out gosec-report.json ./...'
|
|
|
|
- name: Upload gosec report
|
|
if: always()
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
with:
|
|
name: gosec-report
|
|
path: gosec-report.json
|
|
retention-days: 30
|
|
|
|
- name: Display gosec results
|
|
if: always()
|
|
run: |
|
|
if [ -f gosec-report.json ]; then
|
|
echo "📊 Gosec Security Scan Results:"
|
|
cat gosec-report.json | jq -r '.Stats // empty' || echo "No stats available"
|
|
echo ""
|
|
echo "Issues found:"
|
|
cat gosec-report.json | jq -r '.Issues[]? | "\(.severity | ascii_upcase): \(.rule_id) - \(.details)"' || echo "No issues found"
|
|
fi
|
|
|
|
govulncheck:
|
|
name: Vulnerability Check (govulncheck)
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
|
|
with:
|
|
go-version: '1.24'
|
|
|
|
- name: Run govulncheck
|
|
run: |
|
|
go install golang.org/x/vuln/cmd/govulncheck@latest
|
|
govulncheck ./...
|