Skip to content

Commit d138ca0

Browse files
committed
govulncheck to report known vulnerabilities
Signed-off-by: CrazyMax <[email protected]>
1 parent d75ba52 commit d138ca0

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed

.github/workflows/buildkit.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,38 @@ jobs:
143143
skip-integration-tests: 1
144144
typ: integration
145145
146+
govulncheck:
147+
runs-on: ubuntu-24.04
148+
permissions:
149+
# required to write sarif report
150+
security-events: write
151+
steps:
152+
-
153+
name: Checkout
154+
uses: actions/checkout@v4
155+
with:
156+
fetch-depth: 0
157+
-
158+
name: Set up Docker Buildx
159+
uses: docker/setup-buildx-action@v3
160+
with:
161+
version: ${{ env.SETUP_BUILDX_VERSION }}
162+
driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }}
163+
buildkitd-flags: --debug
164+
-
165+
name: Run
166+
uses: docker/bake-action@v5
167+
with:
168+
targets: govulncheck
169+
env:
170+
GOVULNCHECK_FORMAT: sarif
171+
-
172+
name: Upload SARIF report
173+
if: ${{ github.ref == 'refs/heads/master' && github.repository == 'moby/buildkit' }}
174+
uses: github/codeql-action/upload-sarif@v3
175+
with:
176+
sarif_file: ${{ env.DESTDIR }}/govulncheck.out
177+
146178
image:
147179
runs-on: ubuntu-24.04
148180
needs:

docker-bake.hcl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,3 +281,18 @@ target "mod-outdated" {
281281
no-cache-filter = ["outdated"]
282282
output = ["type=cacheonly"]
283283
}
284+
285+
variable "GOVULNCHECK_FORMAT" {
286+
default = null
287+
}
288+
289+
target "govulncheck" {
290+
inherits = ["_common"]
291+
dockerfile = "./hack/dockerfiles/govulncheck.Dockerfile"
292+
target = "output"
293+
args = {
294+
FORMAT = GOVULNCHECK_FORMAT
295+
}
296+
no-cache-filter = ["run"]
297+
output = ["${DESTDIR}"]
298+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# syntax=docker/dockerfile:1
2+
3+
ARG GO_VERSION="1.22"
4+
ARG GOVULNCHECK_VERSION="v1.1.3"
5+
ARG FORMAT="text"
6+
7+
FROM golang:${GO_VERSION}-alpine AS base
8+
WORKDIR /go/src/github.com/moby/buildkit
9+
ARG GOVULNCHECK_VERSION
10+
RUN --mount=type=cache,target=/root/.cache \
11+
--mount=type=cache,target=/go/pkg/mod \
12+
go install golang.org/x/vuln/cmd/govulncheck@$GOVULNCHECK_VERSION
13+
14+
FROM base AS run
15+
ARG FORMAT
16+
RUN --mount=type=bind,target=. <<EOT
17+
set -ex
18+
mkdir /out
19+
govulncheck -format ${FORMAT} ./... | tee /out/govulncheck.out
20+
EOT
21+
22+
FROM scratch AS output
23+
COPY --from=run /out /

0 commit comments

Comments
 (0)