You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Four issues raised by the GitHub Copilot bot review on PR #4440:
1. Per-workflow run-ID disambiguation. Discovery now binds
GOVULNCHECK_RUN_ID / GOVULNCHECK_RUN_URL / GOVULNCHECK_SOURCE_SHA /
GOVULNCHECK_SOURCE_BRANCH and BASEIMAGES_* separately, plus
PRIMARY_SOURCE_SHA / PRIMARY_RUN_URL for downstream sections that
need a single canonical reference (fix branch name, Fix-PR body).
The previous single RUN_ID made multi-workflow invocations
ambiguous and could feed the wrong log into the govulncheck
version-banner parser.
2. Govulncheck version detection now reads GOVULNCHECK_RUN_ID
explicitly, so it parses the right run's log even when both
workflows failed in the same invocation.
3. Drop the 'gh pr view --json headRefOid' fallback in Fix-mode setup
step 3. PRIMARY_SOURCE_SHA from Discovery (which comes from the
workflow run's head_sha field) is the failing run's exact head
SHA. The PR-view fallback returned the PR's CURRENT head, which
can differ from the failing run after a force-push - directly
violating the section's own 'exact head SHA' guarantee.
4. Govulncheck playbook: replace 'git add -A' with explicit
allowlist-only staging per touched module. The BPF setup step
(make bpf-lib + go generate ./...) can regenerate bpf2go output
files (*_bpfel.go, *_bpfeb.go) under the module package; under
git add -A those generated files would land in the commit
alongside go.mod/go.sum, silently breaching the govulncheck
allowlist. Also added 'git checkout -- . && git clean -fd' after
the commit so the baseimages playbook starts from a clean tree
(its first_diff check would otherwise observe leftover BPF
artifacts as drift). Baseimages playbook now asserts a clean tree
at start as a defensive precondition.
Track FIXED_MODULES across the per-module loop so commit-time staging
knows which paths to add.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# (and PRIMARY_* if applicable) to the target run; proceed.
186
+
# Repeat for baseimages.yaml.
153
187
```
154
188
155
189
This also handles fork PRs: when `--branch` returns nothing (fork heads
@@ -176,16 +210,16 @@ reads (base64-decoded). The conclusion bucket per failure is one of:
176
210
177
211
| Signal on `$target_branch`| Bucket |
178
212
|---|---|
179
-
| Target-scoped run newer than `$RUN_ID` and passed |`does-not-apply`|
213
+
| Target-scoped run newer than the matching `*_RUN_ID` and passed |`does-not-apply`|
180
214
| Target-scoped run newer and also failed |`fixable` (re-anchor to target run) |
181
-
| No newer target-scoped run; target's render-input files (`build/images.mk`, every `*/Dockerfile.tmpl`, every `*/manifests/*` referenced by the renderkit) are **byte-identical** to those on `$SOURCE_SHA` (compare SHAs via `gh api /git/trees/{sha}?recursive=1` or per-file blob SHAs) |`fixable` (inferred positive — same templates + same external images = same render diff) |
182
-
| Render-input files differ between target and `$SOURCE_SHA`|`needs-probe` (drift may or may not produce a diff on target — only an actual render can tell) |
215
+
| No newer target-scoped run; target's render-input files (`build/images.mk`, every `*/Dockerfile.tmpl`, every `*/manifests/*` referenced by the renderkit) are **byte-identical** to those on `$BASEIMAGES_SOURCE_SHA` (compare SHAs via `gh api /git/trees/{sha}?recursive=1` or per-file blob SHAs) |`fixable` (inferred positive — same templates + same external images = same render diff) |
216
+
| Render-input files differ between target and `$BASEIMAGES_SOURCE_SHA`|`needs-probe` (drift may or may not produce a diff on target — only an actual render can tell) |
Each finding identifies a vulnerable module path, vulnerable version
187
221
range, fixed version, package, and **proven call-graph reachability on
188
-
`$SOURCE_SHA`**. For each finding, read `$target_branch`'s
222
+
`$GOVULNCHECK_SOURCE_SHA`**. For each finding, read `$target_branch`'s
189
223
`<matrix-module>/go.mod` and `<matrix-module>/go.sum`:
190
224
191
225
| Signal on `$target_branch`| Bucket |
@@ -194,7 +228,7 @@ range, fixed version, package, and **proven call-graph reachability on
194
228
| Target-scoped run newer and reports the same finding |`fixable` (re-anchor) |
195
229
| Vulnerable module path is **not** required by target's `go.mod` and is **absent** from target's `go.sum`|`does-not-apply`|
196
230
| Target's `go.sum` resolves the vulnerable module to a version **outside** the vulnerable range |`does-not-apply`|
197
-
| Target's `go.sum` resolves the vulnerable module to a version **inside** the vulnerable range AND the diff between `$SOURCE_SHA` and target's HEAD does **not** touch the affected packages |`fixable` (reachability proven on source carries over to target) |
231
+
| Target's `go.sum` resolves the vulnerable module to a version **inside** the vulnerable range AND the diff between `$GOVULNCHECK_SOURCE_SHA` and target's HEAD does **not** touch the affected packages |`fixable` (reachability proven on source carries over to target) |
198
232
| Same as above, but the source↔target diff **does** touch the affected packages |`needs-probe` (reachability may have changed; fix mode's post-bump re-run will prove or disprove) |
199
233
200
234
The remaining classification rules still apply to whatever survives as
@@ -220,7 +254,7 @@ version in the first few log lines:
220
254
221
255
```bash
222
256
GOVULNCHECK_VERSION=$(
223
-
gh run view "$RUN_ID" --log-failed \
257
+
gh run view "$GOVULNCHECK_RUN_ID" --log-failed \
224
258
| grep -oE 'govulncheck@v[0-9][0-9.]*'| head -1 \
225
259
| sed 's/^govulncheck@//'
226
260
)
@@ -234,7 +268,7 @@ isn't present.
234
268
235
269
Read-only. For every in-scope workflow with a current failure, emit:
236
270
237
-
- Workflow name, run URL, head SHA (`$SOURCE_BRANCH` + `$SOURCE_SHA`).
271
+
- Workflow name, run URL, head SHA (`$*_SOURCE_BRANCH` + `$*_SOURCE_SHA`).
238
272
- Per failing job, the **applicability bucket** from Discovery:
239
273
-`fixable` — include the exact `go get <module>@<fixed>` command(s)
240
274
or the `make dockerfiles` action that fix mode would run, plus a
@@ -282,15 +316,20 @@ if [ -n "$source_pr_number" ]; then
282
316
fi
283
317
fi
284
318
285
-
# 3. Require the run's exact head SHA. Do NOT fall back to the branch tip:
286
-
# the branch may have been force-pushed since the failing run.
287
-
if [ -z"${RUN_HEAD_SHA:-}" ] && [ -n"$source_pr_number" ];then
0 commit comments