Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/exclude_pin_actions -> main #2506

Merged
merged 1 commit into from
Feb 4, 2025
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
4 changes: 2 additions & 2 deletions remediation/workflow/pin/pinactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func PinAction(action, inputYaml string, exemptedActions []string, pinToImmutabl
tagOrBranch := leftOfAt[1]

// skip pinning for exempted actions
if actionExists(leftOfAt[0], exemptedActions) {
if ActionExists(leftOfAt[0], exemptedActions) {
return inputYaml, updated
}

Expand Down Expand Up @@ -196,7 +196,7 @@ func getSemanticVersion(client *github.Client, owner, repo, tagOrBranch, commitS
}

// Function to check if an action matches any pattern in the list
func actionExists(actionName string, patterns []string) bool {
func ActionExists(actionName string, patterns []string) bool {
for _, pattern := range patterns {
// Use filepath.Match to match the pattern
matched, err := filepath.Match(pattern, actionName)
Expand Down
3 changes: 3 additions & 0 deletions remediation/workflow/secureworkflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@
}

if addHardenRunner {
if pin.ActionExists(HardenRunnerActionPath, exemptedActions) {
pinActions = false
}

Check warning on line 90 in remediation/workflow/secureworkflow.go

View check run for this annotation

Codecov / codecov/patch

remediation/workflow/secureworkflow.go#L89-L90

Added lines #L89 - L90 were not covered by tests
secureWorkflowReponse.FinalOutput, addedHardenRunner, _ = hardenrunner.AddAction(secureWorkflowReponse.FinalOutput, HardenRunnerActionPathWithTag, pinActions, pinToImmutable)
}

Expand Down
Loading