@@ -51,8 +51,9 @@ results contains poutine.finding(rule, pkg_purl, {
5151 " path" : workflow_path,
5252 " line" : step.lines.run,
5353 " details" : sprintf (" Detected usage of `%s`" , [cmd]),
54+ " event_triggers" : workflow_events,
5455}) if {
55- [pkg_purl, workflow_path, step] := _steps_after_untrusted_checkout[_]
56+ [pkg_purl, workflow_path, workflow_events, step] := _steps_after_untrusted_checkout[_]
5657 regex.match (
5758 sprintf (" ([^a-z]|^)(%v)" , [concat (" |" , build_commands[cmd])]),
5859 step.run,
@@ -63,24 +64,27 @@ results contains poutine.finding(rule, pkg_purl, {
6364 " path" : workflow_path,
6465 " line" : step.lines.uses,
6566 " details" : sprintf (" Detected usage the GitHub Action `%s`" , [step.action]),
67+ " event_triggers" : workflow_events,
6668}) if {
67- [pkg_purl, workflow_path, step] := _steps_after_untrusted_checkout[_]
69+ [pkg_purl, workflow_path, workflow_events, step] := _steps_after_untrusted_checkout[_]
6870 build_github_actions[step.action]
6971}
7072
71- _steps_after_untrusted_checkout contains [pkg.purl, workflow.path, s.step] if {
73+ _steps_after_untrusted_checkout contains [pkg.purl, workflow.path, events, s.step] if {
7274 pkg := input.packages[_]
7375 workflow := pkg.github_actions_workflows[_]
7476
7577 utils.filter_workflow_events (workflow, github.events)
7678
79+ events := [event | event := workflow.events[i].name]
7780 pr_checkout := utils.find_pr_checkouts (workflow)[_]
7881 s := utils.workflow_steps_after (pr_checkout)[_]
7982}
8083
81- _steps_after_untrusted_checkout contains [pkg_purl, workflow.path, s.step] if {
84+ _steps_after_untrusted_checkout contains [pkg_purl, workflow.path, events, s.step] if {
8285 [pkg_purl, workflow] := _workflows_runs_from_pr[_]
8386
87+ events := [event | event := workflow.events[i].name]
8488 pr_checkout := utils.find_pr_checkouts (workflow)[_]
8589 s := utils.workflow_steps_after (pr_checkout)[_]
8690}
@@ -142,17 +146,17 @@ results contains poutine.finding(rule, pkg.purl, {
142146 " path" : pipeline.path,
143147 " job" : task.name,
144148 " step" : step_idx,
145- " line" : step.lines[ " script" ] ,
149+ " line" : step.lines. script,
146150 " details" : sprintf (" Detected usage of `%s`" , [cmd]),
147151}) if {
148- pkg := input.packages[_]
149- pipeline := pkg.pipeline_as_code_tekton[_]
150- contains (pipeline.api_version, " tekton.dev" )
151- pipeline.kind == " PipelineRun"
152- contains (pipeline.metadata.annotations[" pipelinesascode.tekton.dev/on-event" ], " pull_request" )
153- contains (pipeline.metadata.annotations[" pipelinesascode.tekton.dev/task" ], " git-clone" )
154- task := pipeline.spec.pipeline_spec.tasks[_]
155- step := task.task_spec.steps[step_idx]
152+ pkg := input.packages[_]
153+ pipeline := pkg.pipeline_as_code_tekton[_]
154+ contains (pipeline.api_version, " tekton.dev" )
155+ pipeline.kind == " PipelineRun"
156+ contains (pipeline.metadata.annotations[" pipelinesascode.tekton.dev/on-event" ], " pull_request" )
157+ contains (pipeline.metadata.annotations[" pipelinesascode.tekton.dev/task" ], " git-clone" )
158+ task := pipeline.spec.pipeline_spec.tasks[_]
159+ step := task.task_spec.steps[step_idx]
156160 regex.match (
157161 sprintf (" ([^a-z]|^)(%v)" , [concat (" |" , build_commands[cmd])]),
158162 step.script,
0 commit comments