Skip to content

Commit

Permalink
Merge pull request #2506 from step-security/feature/exclude_pin_actio…
Browse files Browse the repository at this point in the history
…ns_main

feature/exclude_pin_actions -> main
  • Loading branch information
varunsh-coder authored Feb 4, 2025
2 parents d48f26d + b71adb4 commit 6fb13bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
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 @@ func SecureWorkflow(queryStringParams map[string]string, inputYaml string, svc d
}

if addHardenRunner {
if pin.ActionExists(HardenRunnerActionPath, exemptedActions) {
pinActions = false
}
secureWorkflowReponse.FinalOutput, addedHardenRunner, _ = hardenrunner.AddAction(secureWorkflowReponse.FinalOutput, HardenRunnerActionPathWithTag, pinActions, pinToImmutable)
}

Expand Down

0 comments on commit 6fb13bc

Please sign in to comment.