Let --no-onboard pin SHA bumps on tracked actions · github/gh-actions-lock@0d17985 · GitHub
Skip to content

Commit 0d17985

Browse files
committed
Let --no-onboard pin SHA bumps on tracked actions
Since bare SHAs became not-pinned whenever unlocked, --no-onboard turned a SHA bump on an already-locked action into onboarding-required: it dropped the old pin, wrote no new one and exited 0. Dependabot SHA bumps shipped a workflow with no lock entry. Mark those findings as a tracked action so the gate lets them through to resolution and the history check; an impostor SHA now blocks with unreachable-pin.
1 parent 15e0c7c commit 0d17985

4 files changed

Lines changed: 143 additions & 3 deletions

File tree

Lines changed: 132 additions & 0 deletions

‎cmd/gh-actions-lock/onboard_gate.go‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,18 @@ func noOnboardFlag(cmd *cobra.Command) bool {
1616
}
1717

1818
// gateNoOnboard rewrites per-workflow NotPinned findings to OnboardingRequired
19-
// and drops their refs so Plan never pins them. Returns the refused entry labels
20-
// (e.g. "actions/checkout@v4 in .github/workflows/ci.yml").
19+
// and drops their refs so Plan never pins them. A bare SHA on an action the
20+
// workflow already locks is a ref change, not onboarding: it stays NotPinned
21+
// so the pin path resolves and history-checks it. Returns the refused entry
22+
// labels (e.g. "actions/checkout@v4 in .github/workflows/ci.yml").
2123
func gateNoOnboard(report *checks.Report) []string {
2224
var refused []string
2325
for wi := range report.Workflows {
2426
wr := &report.Workflows[wi]
2527
refusedKeys := make(map[string]bool)
2628
for fi := range wr.Findings {
2729
f := &wr.Findings[fi]
28-
if f.Category != checks.NotPinned || f.ActionRef == nil {
30+
if f.Category != checks.NotPinned || f.ActionRef == nil || f.TrackedAction {
2931
continue
3032
}
3133
ar := f.ActionRef

‎internal/pipeline/checks/finding.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ type Finding struct {
5151
// exist upstream. Terminal output titles it separately; the JSON
5252
// category stays not-pinned.
5353
RefMissing bool
54+
// TrackedAction marks a not-pinned bare SHA whose owner/repo the
55+
// workflow already locks at another ref. It is a ref change on a
56+
// tracked action, not onboarding, so --no-onboard lets it through to
57+
// be resolved and history-checked.
58+
TrackedAction bool
5459
}
5560

5661
// InventoryEntry describes a single dependency with context.

‎internal/pipeline/checks/structural.go‎

Lines changed: 1 addition & 0 deletions

0 commit comments

Comments
 (0)