Skip to content

release: v3.2.4 - broken refs + new validator to catch this class of bug - #10

Merged
Shinrai merged 11 commits into
masterfrom
fix/checkout-code-ref-and-trivy
May 21, 2026
Merged

Shinrai merged 11 commits into
masterfrom
fix/checkout-code-ref-and-trivy

Conversation

@cldmv-bot

@cldmv-bot cldmv-bot Bot commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

🚀 What's Changed

💥 Breaking Changes

No breaking changes

✨ Features

No new features

🐛 Bug Fixes

  • fix(sync): gate fan-out on @V3 rolling forward to avoid stale-action race (608f621)
  • fix(labels): diff client-side instead of PUT-replacing all labels (ebdca3b)
  • fix(security): SHA-pin trivy-action to v0.35.0 per March 2026 advisory (4fb15f8)
  • fix(actions): broken refs + new validator to catch this class of bug (68f9ea6)

🔧 Other Changes

  • chore: document validate-action-refs.mjs local invocation (e860b6a)
  • chore: clarify trivy SHA-pin maintenance note (8660ddd)
👥 Contributors

Shinrai and others added 2 commits May 20, 2026 15:38
Three broken action references that actionlint and YAML parse both missed:

1. checkout-code wrapper only declared `fetch-depth` input, but THREE
   call sites pass `ref:` to it (update-release-pr/action.yml:57,
   reusable-bundle-size.yml:68, reusable-bundle-size.yml:99). GitHub
   rejects the workflow at parse time with "Invalid action input 'ref'".
   Fix: add `ref` input to checkout-code/action.yml as a thin pass-through
   to actions/checkout@v6.

2. aquasecurity/[email protected] — no such tag exists on the upstream
   repo (their latest is v0.36.0). Workflow startup failure with
   "Unable to resolve action ... repository or version not found".
   Fix: bump to @v0.36.0.

3. actions/dependency-review-action@v4 — no `v4` rolling tag exists.
   Upstream pins patches as v4.x.x (latest v4.9.0) but never created a
   `v4` rolling alias. Fix: pin to @v4.9.0.

To stop us from shipping this class of bug again, add a custom CI
validator under `scripts/validate-action-refs.mjs` that catches:

- **Invalid local action inputs**: parses every action.yml in
  .github/actions/, then walks every `uses:` reference + its `with:`
  block in workflows + action.ymls, and errors when a passed input
  isn't declared by the called action. This is what would have caught
  bug 1.

- **Nonexistent remote action versions**: for every `owner/repo@<ver>`
  reference, does a `curl HEAD` against the GitHub releases page +
  falls back to `git ls-remote --tags`. Errors when neither resolves.
  This is what would have caught bugs 2 and 3.

Wired as a `Validate action refs` step in local-ci.yml between the
existing actionlint check and the @v2-grep check. Same failure-surfacing
pattern: `continue-on-error: true` + `$GITHUB_STEP_SUMMARY` section per
finding + `::error file=...,line=...::` annotation. Summary table at the
end of local-ci's job summary now has a new row.

Self-contained (Node built-ins only); no `npm install` required.

Verified locally:
- Clean state: validator exits 0.
- Simulated regression of bug 1 (drop `ref:` from checkout-code): caught.
- Simulated regression of bug 2 (revert trivy to 0.28.0): caught.
- Real bug 3 was found on the very first run.
@cldmv-bot cldmv-bot Bot added release Marks a pull request as a pending release — merge to publish a new version semver: patch This release contains only backwards-compatible bug fixes type: bug Something is broken or not behaving as expected area: core labels May 20, 2026
The aquasecurity/trivy-action March 2026 supply-chain incident force-
pushed 76 of 77 version tags to credential-stealing payloads. Only
v0.35.0 was protected by GitHub's immutable releases feature (enabled
March 4, before publish).

- Pin reusable-container-scan to v0.35.0's commit SHA (the advisory's
  explicit recommendation — mutable tags can be re-compromised; SHAs
  are content-addressed).
- Update validate-action-refs.mjs to recognize 40-char hex SHA pins
  and verify them via 'git ls-remote' so CI doesn't trip on the pin.
- Sync stale 'v0.36.0 is current' examples in local-ci.yml comment
  and the validator's docblock.

Audit results for this repo:
- No setup-trivy references anywhere.
- No callers of reusable-container-scan.yml from any workflow in this
  repo, so no compromised trivy code ever executed locally.
- No tpcp-docs repo or similar exfiltration artifacts to look for.

Advisory: https://github.com/aquasecurity/trivy-action/security/advisories
Shinrai added a commit that referenced this pull request May 21, 2026
* fix(release): refresh PR body when version already bumped on branch

When the same branch receives a second release-worthy commit (e.g. a
second fix:) after the bot already pushed its 'chore: bump version to
X.Y.Z' commit, check-release-commit's early-exit was discarding the
new commit from the changelog and PR body.

Concrete failure: PR #10 on the v3 line — first push landed
fix(actions); workflow updated the PR body with that commit and
pushed 'chore: bump version to 3.1.2'. A later push added
fix(security) — the workflow re-ran but exited at the 'already bumped
to 3.1.2' check, skipping changelog regen + PR body refresh. The PR
description never gained the fix(security) bullet, and the release
notes (had we merged then) would have lost it too.

Fix:
- check-release-commit: new opt-in input 'allow-already-bumped'.
  When true, instead of exiting should-create-pr=false on duplicate
  target version, emit should-create-pr=true + bump-already-applied=true
  with all the usual outputs so downstream steps can refresh state.
- update-release-pr: pass allow-already-bumped=true and split the
  step gates. Version-mutating steps (install, build, update-pkg,
  restore-src, commit) gate on bump-already-applied != 'true'.
  Body-refresh steps (range, changelog, PR description, labels)
  gate only on should-create-pr == 'true'.

Callers create-release-pr and create-release are unchanged — they
omit the new input (default 'false'), preserving the short-circuit
behavior they actually want (nothing to create / nothing to publish
when target is already bumped).

The misleading 'Release Summary' that previously reported 'updated
successfully' when nothing happened becomes accurate by construction:
the body really does get updated now.

* chore: bump version to 3.1.2

---------

Co-authored-by: Nate Corcoran <[email protected]>
Co-authored-by: cldmv-bot[bot] <230771808+cldmv-bot[bot]@users.noreply.github.com>
Shinrai added a commit that referenced this pull request May 21, 2026
When the same branch receives a second release-worthy commit (e.g. a
second fix:) after the bot already pushed its 'chore: bump version to
X.Y.Z' commit, check-release-commit's early-exit was discarding the
new commit from the changelog and PR body.

Concrete failure: PR #10 on the v3 line — first push landed
fix(actions); workflow updated the PR body with that commit and
pushed 'chore: bump version to 3.1.2'. A later push added
fix(security) — the workflow re-ran but exited at the 'already bumped
to 3.1.2' check, skipping changelog regen + PR body refresh. The PR
description never gained the fix(security) bullet, and the release
notes (had we merged then) would have lost it too.

Fix:
- check-release-commit: new opt-in input 'allow-already-bumped'.
  When true, instead of exiting should-create-pr=false on duplicate
  target version, emit should-create-pr=true + bump-already-applied=true
  with all the usual outputs so downstream steps can refresh state.
- update-release-pr: pass allow-already-bumped=true and split the
  step gates. Version-mutating steps (install, build, update-pkg,
  restore-src, commit) gate on bump-already-applied != 'true'.
  Body-refresh steps (range, changelog, PR description, labels)
  gate only on should-create-pr == 'true'.

Callers create-release-pr and create-release are unchanged — they
omit the new input (default 'false'), preserving the short-circuit
behavior they actually want (nothing to create / nothing to publish
when target is already bumped).

The misleading 'Release Summary' that previously reported 'updated
successfully' when nothing happened becomes accurate by construction:
the body really does get updated now.
Shinrai added a commit that referenced this pull request May 21, 2026
The local-sync-release-prs.yml gate excluded PRs authored by cldmv-bot,
intended to 'avoid recursion'. The reasoning was wrong:

  - sync-fan-out's only side effect is force-pushing a refreshed
    'chore: bump version to X.Y.Z' commit onto each open release PR.
    It never merges anything itself.
  - A force-push to a release branch triggers Local Release PR + Local
    CI, neither of which fire local-sync-release-prs.yml (which is
    gated on pull_request closed). No recursion path exists.

Real-world impact of the bug: EVERY release PR is auto-opened by
cldmv-bot (the release flow creates them), so the gate fired 'skip'
on exactly the merges it was built for. Concrete symptom from PR #12's
merge (35 min ago): sync-fan-out fired and exited in 1s, leaving PR
#10's branch at its pre-merge state ('chore: bump version to 3.1.2'
even though master is now at 3.1.2 and PR #10's target should be
3.1.3).

Fix: drop the cldmv-bot exclusion. Keep the github-actions[bot] guard
as defensive — some workflows post merges under that identity and
genuinely shouldn't trigger fan-out.
Shinrai and others added 2 commits May 20, 2026 22:00
Adds a one-line reminder above the pinned ref to re-verify against the
upstream advisory before any future bump. No behavior change — purely a
maintenance comment.

Secondary effect: triggers a fresh release-flow run on this PR. The PR
has been stuck at its pre-PR-#12-merge state ('chore: bump version to
3.1.2'), but master is now AT v3.1.2 — sync-fan-out should have re-
calculated this PR's target to 3.1.3 when PR #12 merged, except its
gate skipped because PR #12 was authored by cldmv-bot (the fix for
that gate is in PR #11, not yet on @V3). Pushing this commit triggers
local-release.yml directly, which calls update-release-pr@v3 — and
that code DOES have the gate fix from PR #12. Expected: a new
'chore: bump version to 3.1.3' commit gets force-pushed onto this
branch, the PR body refreshes with the security fix entry, and the
title goes from 'release: v3.1.2' to 'release: v3.1.3'.
@cldmv-bot cldmv-bot Bot changed the title release: v3.1.2 release: v3.1.3 May 21, 2026
@cldmv-bot cldmv-bot Bot added area: core and removed type: ci labels May 21, 2026
Shinrai and others added 2 commits May 20, 2026 22:16
Adds a one-line note to the docblock showing how to run the validator
ad-hoc from a developer shell (matches how CI runs it). No behavior
change.

Secondary effect: triggers local-release.yml to fire on this PR again.
After PR #11's v3.2.0 merge, @V3 now includes the title-suffix output
and the broadened bot-author filter for the changelog. Expected on this
push:

  - PR title updates from 'release: v3.1.3' to
    'release: v3.1.3 - broken refs + new validator to catch this…'
    (title-suffix derived from first fix commit in the branch).
  - PR body refreshes without ANY bot-trail commits — the bot bump
    commits, release commits, and merges all get filtered out by
    isBotCommit. Only the human-authored fix(security), fix(actions),
    and these chore docs/maintenance commits should appear.
@cldmv-bot cldmv-bot Bot changed the title release: v3.1.3 release: v3.2.1 - SHA-pin trivy-action to v0.35.0 per March 2026 advisory May 21, 2026
@cldmv-bot cldmv-bot Bot added area: core and removed type: ci labels May 21, 2026
The 'replace' mode used PUT /issues/N/labels with the full desired
set. Semantically correct (the result is the right set), but GitHub
emits a remove + add activity event for EVERY label in the new set —
even ones that already matched the current set. Symptom on PR #10
(visible in your activity log):

  - 'added area: core type: ci type: config and removed type: ci
     type: config area: core labels'  (net change: 0)

Each release-PR refresh painted the same three labels off and back on,
flooding the timeline.

Fix: GET the PR's current labels, compute the symmetric difference:

  - toAdd    = desired - current  (labels not yet present)
  - toRemove = current - desired  (labels no longer wanted)

If both are empty → zero API calls, zero activity events. Otherwise:

  - Per-label DELETE for each label being removed (one event each).
  - Single batched POST for all additions (one event per added label).

URL-encodes label names in the DELETE path so labels with colons,
spaces, or slashes (e.g. 'type: ci', 'priority: high') don't break the
endpoint.
Shinrai added a commit that referenced this pull request May 21, 2026
## 🚀 What's Changed

### 💥 Breaking Changes
_No breaking changes_

### ✨ Features
_No new features_

### 🐛 Bug Fixes
- fix(actions): declare ref input on checkout-code (matches PR #10's
fix) (a18df4e)
- fix(audit): allow ' - <subject>' suffix on release commits (c804026)

### 🔧 Other Changes
_No other changes_



<details>
<summary>👥 Contributors</summary>

- @Shinrai

</details>

---------

Co-authored-by: Nate Corcoran <[email protected]>
Co-authored-by: cldmv-bot[bot] <230771808+cldmv-bot[bot]@users.noreply.github.com>
Shinrai and others added 2 commits May 21, 2026 08:02
…race

Real-world failure traced from PR #10's logs: when a release PR merges
to master, two workflows fire in parallel — 🏷️ Update Major Version
Tags (rolls @V3 to the new commit) and 🔄 Local Sync Open Release PRs
(refreshes every open release PR). If sync-fan-out resolves its
`uses: ...@v3` refs BEFORE tag-update lands the new @V3, it pulls
the PREVIOUS release's code.

Concrete symptom: checkout-code without the `ref:` input declared
(fixed in PR #17). update-release-pr's checkout step then ignores the
`ref: ${{ inputs.head-ref }}` input, falls through to
actions/checkout's default = github.ref = refs/heads/master, checks
out master instead of the release branch, runs find-divergence on
master vs master, gets 0 commits in range, and silently exits without
refreshing the PR. Every release merge from PR #11 onward hit this
race; PR #10 was visibly stuck behind master as a result.

Fix: add a wait-for-tags job at the head of the dependency chain.
Polls refs/tags/v3 against github.sha (the merge commit) every 5
seconds for up to 2 minutes. enumerate now `needs: wait-for-tags`;
refresh transitively waits via enumerate. If @V3 never advances
(non-release merges where Update Major Version Tags doesn't fire),
the poll times out and downstream jobs proceed — that's the right
behaviour, since @V3 wouldn't have moved anyway.

User-visible: future release-PR merges will see sync-fan-out fire
~30–60s later than before, but with action code that actually matches
the just-merged master state. The release PRs in flight finally get
their bumps recalculated against the new base.

This also pushes a commit to PR #10, re-triggering its release flow.
Since @V3 has now rolled forward to v3.2.3 (with the ref input
declared), this run will check out PR #10's branch correctly and
recalculate target = patch(3.2.3) = 3.2.4.
@cldmv-bot cldmv-bot Bot changed the title release: v3.2.1 - SHA-pin trivy-action to v0.35.0 per March 2026 advisory release: v3.2.4 - broken refs + new validator to catch this class of bug May 21, 2026
@cldmv-bot cldmv-bot Bot added area: core and removed type: ci labels May 21, 2026
@cldmv-bot cldmv-bot Bot removed type: ci labels May 21, 2026
@Shinrai
Shinrai merged commit ac51ac6 into master May 21, 2026
12 checks passed
@cldmv-bot
cldmv-bot Bot deleted the fix/checkout-code-ref-and-trivy branch May 21, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release Marks a pull request as a pending release — merge to publish a new version semver: patch This release contains only backwards-compatible bug fixes type: bug Something is broken or not behaving as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant