Re-verify locked pins on the default run, and surface verify failures by nodeselector · Pull Request #85 · github/gh-actions-lock · GitHub
Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion actions/lint/action.yml
24 changes: 12 additions & 12 deletions cmd/gh-actions-lock/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,15 @@ jobs:
// Lockfile Forgery Detection Tests
//
// These tests verify that the ancestry check promotes ref-moved to
// lockfile-forgery when the pinned SHA is not an ancestor of the live SHA.
// unreachable-pin when the pinned SHA is not an ancestor of the live SHA.
// This detects cases where someone manually injected a SHA into the lockfile
// that was never part of the ref's legitimate history.
// ==========================================================================

// TestCheck_LockfileForgery_NotAncestor verifies that when the Compare API
// TestCheck_UnreachablePin_NotAncestor verifies that when the Compare API
// shows the pinned SHA is NOT an ancestor of the live SHA, the finding is
// promoted from ref-moved to lockfile-forgery.
func TestCheck_LockfileForgery_NotAncestor(t *testing.T) {
// promoted from ref-moved to unreachable-pin.
func TestCheck_UnreachablePin_NotAncestor(t *testing.T) {
reg := &httpmock.Registry{}
defer reg.Verify(t)

Expand Down Expand Up @@ -325,14 +325,14 @@ jobs:
for _, f := range payload.Findings {
categories[f.Category] = true
}
assert.True(t, categories["lockfile-forgery"], "should detect lockfile forgery: %+v", payload.Findings)
assert.True(t, categories["unreachable-pin"], "should detect lockfile forgery: %+v", payload.Findings)
assert.False(t, categories["ref-moved"], "should NOT have ref-moved (promoted to forgery): %+v", payload.Findings)
}

// TestCheck_LockfileForgery_LegitAncestor verifies that when the Compare API
// TestCheck_UnreachablePin_LegitAncestor verifies that when the Compare API
// confirms the pinned SHA IS an ancestor of the live SHA, the finding stays
// as ref-moved (legitimate tag movement, not forgery).
func TestCheck_LockfileForgery_LegitAncestor(t *testing.T) {
func TestCheck_UnreachablePin_LegitAncestor(t *testing.T) {
reg := &httpmock.Registry{}
defer reg.Verify(t)

Expand Down Expand Up @@ -388,14 +388,14 @@ jobs:
categories[f.Category] = true
}
assert.True(t, categories["ref-moved"], "should keep as ref-moved for legit ancestor: %+v", payload.Findings)
assert.False(t, categories["lockfile-forgery"], "should NOT have lockfile-forgery: %+v", payload.Findings)
assert.False(t, categories["unreachable-pin"], "should NOT have unreachable-pin: %+v", payload.Findings)
}

// TestCheck_LockfileForgery_RateLimited verifies that when the ancestry
// TestCheck_UnreachablePin_RateLimited verifies that when the ancestry
// check is rate-limited, the finding surfaces as ancestry-unknown — not
// ref-moved (which would imply a benign-but-known move) and not
// lockfile-forgery (which requires an authoritative not-ancestor answer).
func TestCheck_LockfileForgery_RateLimited(t *testing.T) {
// unreachable-pin (which requires an authoritative not-ancestor answer).
func TestCheck_UnreachablePin_RateLimited(t *testing.T) {
reg := &httpmock.Registry{}
defer reg.Verify(t)

Expand Down Expand Up @@ -446,7 +446,7 @@ jobs:
categories[f.Category] = true
}
assert.True(t, categories["ancestry-unknown"], "should classify as ancestry-unknown when rate limited: %+v", payload.Findings)
assert.False(t, categories["lockfile-forgery"], "should NOT have lockfile-forgery when rate limited: %+v", payload.Findings)
assert.False(t, categories["unreachable-pin"], "should NOT have unreachable-pin when rate limited: %+v", payload.Findings)
assert.False(t, categories["ref-moved"], "should NOT downgrade to ref-moved when rate limited: %+v", payload.Findings)
assert.False(t, categories["valid"], "rate-limited ancestry must not regress to CategoryValid: %+v", payload.Findings)

Expand Down
149 changes: 146 additions & 3 deletions cmd/gh-actions-lock/format/terminal.go
Loading
Loading