Skip to content

Commit fdcb0ee

Browse files
authored
fix(github): update vulnerability scans (#941)
## Overview Updates vulnerability scans to check on Rust binaries and dependencies ## Testing GH actions
1 parent 1dbbc30 commit fdcb0ee

File tree

1 file changed

+12
-71
lines changed

1 file changed

+12
-71
lines changed

.github/workflows/vulnerability-scan.yml

Lines changed: 12 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ on:
77
workflow_dispatch:
88

99
env:
10-
VERSION: dev # env var required when building extension
1110
# adds public.ecr.aws as fallback incase rate limit on ghcr.io is hit
1211
TRIVY_DB_REPOSITORY: ghcr.io/aquasecurity/trivy-db,public.ecr.aws/aquasecurity/trivy-db
1312
TRIVY_JAVA_DB_REPOSITORY: ghcr.io/aquasecurity/trivy-java-db,public.ecr.aws/aquasecurity/trivy-java-db
1413

1514
jobs:
1615
trivy-scans:
16+
name: Trivy Scans (latest)
1717
runs-on: ubuntu-22.04
1818
steps:
1919
- name: Scan latest released image with trivy
@@ -33,6 +33,7 @@ jobs:
3333
format: table
3434

3535
grype-scans:
36+
name: Grype Scans (latest)
3637
runs-on: ubuntu-22.04
3738
steps:
3839
- name: Scan latest release image with grype
@@ -53,81 +54,21 @@ jobs:
5354
severity-cutoff: low
5455
output-format: table
5556

56-
build-and-binary-scans:
57+
rust-dependency-scan:
58+
name: Rust Dependencies Scan
5759
runs-on: ubuntu-22.04
5860
steps:
59-
- name: Checkout datadog-agent repository
60-
uses: actions/checkout@c2d88d3ecc89a9ef08eebf45d9637801dcee7eb5 # v5.0.1
61-
with:
62-
repository: DataDog/datadog-agent
63-
path: go/src/github.com/DataDog/datadog-agent
64-
65-
- name: Checkout datadog-lambda-extension repository
66-
uses: actions/checkout@c2d88d3ecc89a9ef08eebf45d9637801dcee7eb5 # v5.0.1
67-
with:
68-
repository: DataDog/datadog-lambda-extension
69-
path: go/src/github.com/DataDog/datadog-lambda-extension
70-
71-
- name: Set up QEMU
72-
id: qemu
73-
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
74-
with:
75-
image: tonistiigi/binfmt:qemu-v9.2.2-52 #v3.6.0 latest
76-
platforms: amd64,arm64
77-
78-
- name: Set up Docker Buildx
79-
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
80-
81-
- name: Build extension
82-
run: |
83-
cd go/src/github.com/DataDog/datadog-lambda-extension
84-
./scripts/build_binary_and_layer_dockerized.sh
85-
86-
- name: Scan amd64 image with trivy
87-
uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 # v0.33.1
88-
with:
89-
image-ref: "datadog/build-lambda-extension-amd64:${{ env.VERSION }}"
90-
ignore-unfixed: true
91-
exit-code: 1
92-
format: table
61+
- name: Checkout repository
62+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
9363

94-
- name: Scan arm64 image with trivy
95-
uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 # v0.33.1
64+
- name: Scan Rust dependencies with cargo-audit
65+
uses: rustsec/audit-check@69366f33c96575abad1ee0dba8212993eecbe998 # v2.0.0
9666
with:
97-
image-ref: "datadog/build-lambda-extension-arm64:${{ env.VERSION }}"
98-
ignore-unfixed: true
99-
exit-code: 1
100-
format: table
101-
102-
- name: Scan amd64 image with grype
103-
uses: anchore/scan-action@40a61b52209e9d50e87917c5b901783d546b12d0 # v7.2.1
104-
with:
105-
image: "datadog/build-lambda-extension-amd64:${{ env.VERSION }}"
106-
only-fixed: true
107-
fail-build: true
108-
severity-cutoff: low
109-
output-format: table
110-
111-
- name: Scan arm64 image with grype
112-
uses: anchore/scan-action@40a61b52209e9d50e87917c5b901783d546b12d0 # v7.2.1
113-
with:
114-
image: "datadog/build-lambda-extension-arm64:${{ env.VERSION }}"
115-
only-fixed: true
116-
fail-build: true
117-
severity-cutoff: low
118-
output-format: table
119-
120-
- name: Scan binary files with grype
121-
uses: anchore/scan-action@40a61b52209e9d50e87917c5b901783d546b12d0 # v7.2.1
122-
with:
123-
path: go/src/github.com/DataDog/datadog-lambda-extension/.layers
124-
only-fixed: true
125-
fail-build: true
126-
severity-cutoff: low
127-
output-format: table
67+
token: ${{ secrets.GITHUB_TOKEN }}
68+
working-directory: bottlecap
12869

12970
retry:
130-
needs: [trivy-scans, grype-scans, build-and-binary-scans]
71+
needs: [trivy-scans, grype-scans, rust-dependency-scan]
13172
if: failure() && fromJSON(github.run_attempt) < 2
13273
runs-on: ubuntu-22.04
13374
permissions:
@@ -140,7 +81,7 @@ jobs:
14081
run: gh workflow run retry-workflow.yml -F run_id=${{ github.run_id }}
14182

14283
notify:
143-
needs: [trivy-scans, grype-scans, build-and-binary-scans]
84+
needs: [trivy-scans, grype-scans, rust-dependency-scan]
14485
if: failure() && fromJSON(github.run_attempt) >= 2
14586
runs-on: ubuntu-22.04
14687
steps:

0 commit comments

Comments
 (0)