Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 23 additions & 15 deletions .github/workflows/govulncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ permissions:
jobs:
# Non-blocking: generates SARIF and uploads to GitHub Code Scanning.
# Replaces Dependabot Security Alerts with reachability-aware findings.
# Uses govulncheck@latest installed directly (golang/govulncheck-action is
# not in the DataDog enterprise action allowlist).
# govulncheck execution is sandboxed via geomys/sandboxed-step (gVisor)
# to strip ambient authority from the runner — see PR description for
# allowlist request context.
# NOTE: Only core packages are scanned here. Contrib modules (each with
# their own go.mod) are scanned in govulncheck-tests, which blocks merges,
# but contrib vulnerabilities do not appear in GitHub Code Scanning alerts.
Expand All @@ -57,15 +58,18 @@ jobs:
with:
go-version: stable
cache-dependency-path: '**/go.sum'
- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
- name: Run govulncheck (SARIF)
- name: Run govulncheck (SARIF, sandboxed)
# geomys/sandboxed-step uses gVisor to confine execution, preventing
# supply chain attacks from exfiltrating tokens or making network calls.
# -format sarif exits 0 even when vulnerabilities are found, so the
# upload step always runs. The blocking check is in govulncheck-tests.
run: |-
govulncheck -format sarif \
./ddtrace/... ./appsec/... ./profiler/... ./internal/... ./instrumentation/... \
> govulncheck.sarif || true
uses: geomys/sandboxed-step@v1.2.1
with:
run: |-
Comment on lines +66 to +68
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Persist the SARIF output out of the sandbox

This step writes govulncheck.sarif inside geomys/sandboxed-step, but the following upload-sarif step runs back on the host and reads govulncheck.sarif from the workspace. The action documents that workspace changes do not persist by default and its default for persist-workspace-changes is false (https://raw.githubusercontent.com/geomys/sandboxed-step/v1.2.1/README.md), so once the command succeeds the report is discarded with the sandbox overlay and Code Scanning has no SARIF file to upload; set persist-workspace-changes: 'true' for this SARIF-producing step or copy the report out another way.

Useful? React with 👍 / 👎.

go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck -format sarif \
Comment on lines +69 to +70
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Put govulncheck on PATH before invoking it

In this sandbox go install does not make the next govulncheck command resolvable: Go installs commands to GOBIN/GOPATH/bin by default (https://pkg.go.dev/cmd/go#hdr-Compile_and_install_packages_and_dependencies), while geomys/sandboxed-step constructs PATH from standard directories plus RUNNER_TOOL_CACHE entries only (https://github.com/geomys/sandboxed-step/blob/v1.2.1/generate-config.go#L1232-L1269). After setup-go, the GOPATH bin added on the host is therefore dropped inside the sandbox, so this line and the same pattern in govulncheck-tests/the contrib script fail with govulncheck: command not found; invoke $(go env GOPATH)/bin/govulncheck, extend PATH inside the sandbox, or use go run.

Useful? React with 👍 / 👎.

./ddtrace/... ./appsec/... ./profiler/... ./internal/... ./instrumentation/... \
> govulncheck.sarif || true
- name: Upload SARIF to GitHub Code Scanning
if: always()
uses: github/codeql-action/upload-sarif@38697555549f1db7851b81482ff19f1fa5c4fedc # v4.34.1
Expand All @@ -75,6 +79,7 @@ jobs:

# Blocking: fails the build if any reachable vulnerability is found.
# Scans both core packages and all contrib modules (each with its own go.mod).
# govulncheck execution is sandboxed via geomys/sandboxed-step (gVisor).
govulncheck-tests:
runs-on: ubuntu-latest
steps:
Expand All @@ -87,9 +92,12 @@ jobs:
with:
go-version: stable
cache-dependency-path: '**/go.sum'
- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
- name: Run govulncheck (core)
run: govulncheck ./ddtrace/... ./appsec/... ./profiler/... ./internal/... ./instrumentation/...
- name: Run govulncheck (contrib)
run: ./.github/workflows/apps/govulncheck-contribs-v2.sh
- name: Run govulncheck (sandboxed)
# geomys/sandboxed-step uses gVisor to confine execution, preventing
# supply chain attacks from exfiltrating tokens or making network calls.
uses: geomys/sandboxed-step@v1.2.1
with:
run: |
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./ddtrace/... ./appsec/... ./profiler/... ./internal/... ./instrumentation/...
./.github/workflows/apps/govulncheck-contribs-v2.sh
Loading