-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub-workflow.example.yaml
More file actions
103 lines (93 loc) · 3.3 KB
/
github-workflow.example.yaml
File metadata and controls
103 lines (93 loc) · 3.3 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
name: Dependency Scan
on:
push:
pull_request:
# OIDC authentication: GitHub Actions requests a short-lived token from the
# GitHub OIDC provider. The scanner sends this token via the Job-Token header,
# and Dependency Control validates it against the configured GitHub instance.
# No long-lived API keys needed.
permissions:
id-token: write # Required for OIDC token request
contents: read # Required for checkout
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
DEP_CONTROL_URL: ${{ secrets.DEP_CONTROL_URL }}
SCANNER_VERSION: "1.0.0"
# Required: Get hash from $DEP_CONTROL_URL/api/v1/scripts/scanner.sh/hash
SCANNER_SHA256: ${{ vars.SCANNER_SHA256 }}
# Optional: Override the OIDC audience (default: "dependency-control")
# DEP_CONTROL_OIDC_AUDIENCE: "dependency-control"
jobs:
sbom-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run SBOM Scan
run: |
curl -sSL "$DEP_CONTROL_URL/api/v1/scripts/scanner.sh?v=$SCANNER_VERSION" -o scanner.sh
echo "$SCANNER_SHA256 scanner.sh" | sha256sum -c -
chmod +x scanner.sh
./scanner.sh sbom
secret-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run Secret Scan
run: |
curl -sSL "$DEP_CONTROL_URL/api/v1/scripts/scanner.sh?v=$SCANNER_VERSION" -o scanner.sh
echo "$SCANNER_SHA256 scanner.sh" | sha256sum -c -
chmod +x scanner.sh
./scanner.sh secrets
sast-scan:
runs-on: ubuntu-latest
container: returntocorp/semgrep
steps:
- uses: actions/checkout@v4
- name: Run SAST Scan
run: |
apt-get update -qq && apt-get install -y -qq curl jq coreutils
curl -sSL "$DEP_CONTROL_URL/api/v1/scripts/scanner.sh?v=$SCANNER_VERSION" -o scanner.sh
echo "$SCANNER_SHA256 scanner.sh" | sha256sum -c -
chmod +x scanner.sh
./scanner.sh sast
iac-scan:
runs-on: ubuntu-latest
container:
image: checkmarx/kics:debian
options: --entrypoint ""
steps:
- uses: actions/checkout@v4
- name: Run IaC Scan
run: |
curl -sSL "$DEP_CONTROL_URL/api/v1/scripts/scanner.sh?v=$SCANNER_VERSION" -o scanner.sh
echo "$SCANNER_SHA256 scanner.sh" | sha256sum -c -
chmod +x scanner.sh
./scanner.sh iac
bearer-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Bearer Scan
run: |
curl -sSL "$DEP_CONTROL_URL/api/v1/scripts/scanner.sh?v=$SCANNER_VERSION" -o scanner.sh
echo "$SCANNER_SHA256 scanner.sh" | sha256sum -c -
chmod +x scanner.sh
./scanner.sh bearer
callgraph-upload:
runs-on: ubuntu-latest
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Generate and Upload Callgraph
run: |
curl -sSL "$DEP_CONTROL_URL/api/v1/scripts/scanner.sh?v=$SCANNER_VERSION" -o scanner.sh
echo "$SCANNER_SHA256 scanner.sh" | sha256sum -c -
chmod +x scanner.sh
./scanner.sh callgraph