Skip to content

Commit 6fb13bc

Browse files
Merge pull request #2506 from step-security/feature/exclude_pin_actions_main
feature/exclude_pin_actions -> main
2 parents d48f26d + b71adb4 commit 6fb13bc

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

remediation/workflow/pin/pinactions.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func PinAction(action, inputYaml string, exemptedActions []string, pinToImmutabl
5252
tagOrBranch := leftOfAt[1]
5353

5454
// skip pinning for exempted actions
55-
if actionExists(leftOfAt[0], exemptedActions) {
55+
if ActionExists(leftOfAt[0], exemptedActions) {
5656
return inputYaml, updated
5757
}
5858

@@ -196,7 +196,7 @@ func getSemanticVersion(client *github.Client, owner, repo, tagOrBranch, commitS
196196
}
197197

198198
// Function to check if an action matches any pattern in the list
199-
func actionExists(actionName string, patterns []string) bool {
199+
func ActionExists(actionName string, patterns []string) bool {
200200
for _, pattern := range patterns {
201201
// Use filepath.Match to match the pattern
202202
matched, err := filepath.Match(pattern, actionName)

remediation/workflow/secureworkflow.go

+3
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ func SecureWorkflow(queryStringParams map[string]string, inputYaml string, svc d
8585
}
8686

8787
if addHardenRunner {
88+
if pin.ActionExists(HardenRunnerActionPath, exemptedActions) {
89+
pinActions = false
90+
}
8891
secureWorkflowReponse.FinalOutput, addedHardenRunner, _ = hardenrunner.AddAction(secureWorkflowReponse.FinalOutput, HardenRunnerActionPathWithTag, pinActions, pinToImmutable)
8992
}
9093

0 commit comments

Comments
 (0)