Skip to content

chore(ci): govulncheck - use official golang/govulncheck-action for SARIF analysis#4599

Draft
kakkoyun wants to merge 2 commits intokakkoyun/govulncheck-sandboxed-stepfrom
kakkoyun/govulncheck-action-allowlist
Draft

chore(ci): govulncheck - use official golang/govulncheck-action for SARIF analysis#4599
kakkoyun wants to merge 2 commits intokakkoyun/govulncheck-sandboxed-stepfrom
kakkoyun/govulncheck-action-allowlist

Conversation

@kakkoyun
Copy link
Copy Markdown
Member

What does this PR do?

Replaces the manual go install govulncheck@latest + govulncheck -format sarif in the govulncheck-analysis job with the official golang/govulncheck-action@v1.0.4 maintained by the Go Security Team.

This PR will fail CI because golang/govulncheck-action is blocked by the DataDog enterprise action allowlist. It internally uses actions/checkout@v4.1.1 and actions/setup-go@v5.0.0 which are not in the allowlist. This PR exists to start the discussion for adding it.

Motivation

The official Go Security Team action provides:

  • Automatic govulncheck version management — always uses the latest govulncheck without manual go install maintenance
  • Built-in SARIF output with the correct schema, handling the --format sarif flag internally
  • Less workflow code — one step instead of three (setup-go + go install + govulncheck)
  • Official support from the Go team — bug fixes and improvements flow in automatically

The manual approach (from #4595) works correctly but requires us to maintain the invocation ourselves.

Note: The govulncheck-tests job (blocking CI check) retains direct invocation via the sandboxed-step from #4598, since golang/govulncheck-action doesn't support the multi-module scanning pattern needed for the 65+ contrib modules.

CI failure context

When we first tried this action in #4595, CI failed with:

"The actions actions/checkout@v4.1.1 and actions/setup-go@v5.0.0 are not allowed in DataDog/dd-trace-go because all actions must be from a repository owned by your enterprise, created by GitHub, verified in the GitHub Marketplace, or match one of the patterns..."

The action itself is from the golang GitHub org (official Go project). The only blocker is that its internal transitive dependency on older SHA-pinned action versions triggers the allowlist check.

To merge this PR: request adding golang/govulncheck-action to the DataDog enterprise GitHub Actions allowlist.

References

Reviewer's Checklist

  • N/A — CI/workflow-only change, no Go code modified

@datadog-prod-us1-4
Copy link
Copy Markdown

datadog-prod-us1-4 bot commented Mar 25, 2026

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 60.06% (+0.01%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 9341efc | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.66%. Comparing base (f5cf6b9) to head (528e489).

Additional details and impacted files

see 9 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kakkoyun kakkoyun changed the title ci(govulncheck): use official golang/govulncheck-action for SARIF analysis chore(ci): govulncheck - use official golang/govulncheck-action for SARIF analysis Mar 25, 2026
@kakkoyun kakkoyun added the AI Assisted AI/LLM assistance used in this PR (partially or fully) label Mar 25, 2026
@pr-commenter
Copy link
Copy Markdown

pr-commenter bot commented Mar 25, 2026

Benchmarks

Benchmark execution time: 2026-03-27 11:54:41

Comparing candidate commit 9341efc in PR branch kakkoyun/govulncheck-action-allowlist with baseline commit aa79d34 in branch kakkoyun/govulncheck-sandboxed-step.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 215 metrics, 9 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

@kakkoyun kakkoyun force-pushed the kakkoyun/govulncheck-sandboxed-step branch from 42b3d61 to f5cf6b9 Compare March 26, 2026 10:10
@kakkoyun kakkoyun force-pushed the kakkoyun/govulncheck-action-allowlist branch from 4ba424d to b8999e7 Compare March 26, 2026 10:19
kakkoyun added a commit that referenced this pull request Mar 27, 2026
…#4605)

## Why

The `govulncheck-analysis` job (non-blocking SARIF upload) only scanned
core packages. Contrib module vulnerabilities were caught by
`govulncheck-tests` (blocking, sandboxed) but never appeared in the
GitHub Security tab / Code Scanning. This created a gap: a contrib CVE
would fail the PR check but leave no trace in the Security dashboard.

This PR closes that gap by adding a parallel non-blocking
`govulncheck-contribs-analysis` job that scans every contrib module and
uploads results to GitHub Code Scanning.

## What

- **New script**: `govulncheck-contribs-sarif.sh` — mirrors
`govulncheck-contribs-v2.sh` but uses `-format sarif`. It scans each
contrib module, writes a per-module SARIF file to a temp directory, then
merges all runs into a single output file via `jq`.
- **New job**: `govulncheck-contribs-analysis` — sets up Go, installs
govulncheck, runs the script, and uploads the merged SARIF under the
`govulncheck-contribs` category.
- **Updated comment** in `govulncheck-analysis`: replaces the `TODO`
with a reference to the new job.
- **Updated `paths` filter**: adds `govulncheck-contribs-sarif.sh` so
changes to the script trigger the workflow.

## Design decisions

**Why merge SARIF with `jq` instead of uploading per-module files?**
The `upload-sarif` action accepts a directory, but uploading N files
(one per contrib module) would create N separate tool runs in Code
Scanning, making the Security tab noisy. Merging runs into one SARIF
file keeps results grouped under a single `govulncheck-contribs`
category.

**Why not sandbox this job?**
The `govulncheck-contribs-analysis` job is non-blocking and
informational, consistent with `govulncheck-analysis`. The sandboxed
`govulncheck-tests` job provides the security boundary for blocking
checks.

## Stack

This PR is part of a stack:

```
main
 └── #4595 kakkoyun/govulncheck (base)
      └── #4597 kakkoyun/govulncheck-persist-credentials
           └── #4598 kakkoyun/govulncheck-sandboxed-step
                └── #4599 kakkoyun/govulncheck-action-allowlist
                     └── this PR kakkoyun/govulncheck-contrib-sarif
```

Merge order: #4595#4597#4598#4599 → this PR.

## Test plan

- [ ] CI passes on this branch (all three jobs green)
- [ ] `govulncheck-contribs-analysis` job appears in the Actions run
- [ ] SARIF upload succeeds (check `upload-sarif` step output)
- [ ] GitHub Security tab shows findings under `govulncheck-contribs`
category after merge to main
@kakkoyun kakkoyun force-pushed the kakkoyun/govulncheck-sandboxed-step branch from f5cf6b9 to aa79d34 Compare March 27, 2026 11:13
…lysis

Replaces manual go install + govulncheck -format sarif with the official
Go Security Team action (golang/govulncheck-action@v1.0.4). The action
handles Go setup internally and always uses the latest govulncheck.

This PR will fail CI: golang/govulncheck-action is blocked by the DataDog
enterprise action allowlist (it internally uses actions/checkout@v4.1.1
and actions/setup-go@v5.0.0). This PR exists to start the discussion for
adding it to the allowlist.

Ref: https://github.com/golang/govulncheck-action
@kakkoyun kakkoyun force-pushed the kakkoyun/govulncheck-action-allowlist branch from 528e489 to ddeee11 Compare March 27, 2026 11:16
Add govulncheck-contribs-analysis job that scans each contrib module
(each with its own go.mod) with govulncheck in SARIF format, merges
the per-module results into a single SARIF file via jq, and uploads it
to GitHub Code Scanning under a distinct 'govulncheck-contribs' category.

This resolves the gap where contrib vulnerabilities were caught by the
blocking govulncheck-tests job but never appeared in the Security tab.
Both core and contrib findings are now visible in GitHub Code Scanning.

The new govulncheck-contribs-sarif.sh mirrors the logic of the existing
govulncheck-contribs-v2.sh but uses -format sarif and merges outputs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Assisted AI/LLM assistance used in this PR (partially or fully)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant