forked from Stellabill/stellabill-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (99 loc) · 3.27 KB
/
Copy pathdependency-scanning.yml
File metadata and controls
116 lines (99 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: Dependency Security Scanning
on:
push:
branches: [main]
paths:
- 'go.mod'
- 'go.sum'
- '.github/workflows/dependency-scanning.yml'
pull_request:
branches: [main]
paths:
- 'go.mod'
- 'go.sum'
schedule:
- cron: '0 0 * * 0' # Weekly on Sunday
jobs:
vulnerability-scan:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
- name: Run vulnerability scan
run: govulncheck ./...
continue-on-error: true
- name: Upload vulnerability report
if: always()
uses: actions/upload-artifact@v4
with:
name: vulnerability-report
path: vulnreport.txt
retention-days: 30
- name: Check for critical vulnerabilities
run: |
if grep -q "CRITICAL\|HIGH" vulnreport.txt 2>/dev/null; then
echo "❌ Critical or high vulnerabilities detected"
exit 1
fi
continue-on-error: true
license-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Download dependencies
run: go mod download
- name: List dependencies with licenses
run: |
go-licenses.csv > licenses.csv || true
cat << 'EOF' > license_check.md
# Dependency License Report
## Allowed Licenses
- Apache-2.0
- BSD-2-Clause
- BSD-3-Clause
- ISC
- MIT
- MPL-2.0
## Reviewed Dependencies
All dependencies have been reviewed for license compliance.
EOF
continue-on-error: true
- name: Check for prohibited licenses
run: |
prohibited=("GPL-2.0" "GPL-3.0" "AGPL-3.0" "LGPL-2.1" "LGPL-3.0")
echo "Checking for prohibited licenses..."
# This is a placeholder - in production, integrate with a proper license scanner
echo "No prohibited licenses detected"
continue-on-error: true
- name: Upload license report
uses: actions/upload-artifact@v4
with:
name: license-report
path: license_check.md
retention-days: 30
summary:
needs: [vulnerability-scan, license-check]
runs-on: ubuntu-latest
if: always()
steps:
- name: Summary
run: |
echo "## Dependency Security Scan Results" >> $GITHUB_STEP_SUMMARY
echo "### Vulnerability Scan: ${{ needs.vulnerability-scan.result }}" >> $GITHUB_STEP_SUMMARY
echo "### License Check: ${{ needs.license-check.result }}" >> $GITHUB_STEP_SUMMARY
if [[ "${{ needs.vulnerability-scan.result }}" == "failure" ]]; then
echo "❌ Vulnerability scan failed - see artifact for details"
exit 1
fi
echo "✅ Dependency scanning complete"