@@ -15,39 +15,85 @@ rule := poutine.rule(rego.metadata.chain())
1515
1616github.events contains event if some event in {
1717 " pull_request_target" ,
18+ " issues" ,
1819 " issue_comment" ,
1920 " workflow_call" ,
2021}
2122
2223github.workflow_run.parent.events contains event if some event in {
2324 " pull_request_target" ,
2425 " pull_request" ,
26+ " issues" ,
27+ " issue_comment" ,
2528}
2629
2730build_github_actions[action] = {
28- " pre-commit/action" : " pre-commit" ,
29- " oxsecurity/megalinter" : " megalinter" ,
30- " bridgecrewio/checkov-action" : " checkov" ,
31- " ruby/setup-ruby" : " bundler" ,
31+ " bundler" :{" ruby/setup-ruby" },
32+ " cargo" :{" actions-rs/cargo" },
33+ " checkov" :{" bridgecrewio/checkov-action" },
34+ " docker" :{" docker/build-push-action" , " docker/setup-buildx-action" },
35+ " eslint" :{" reviewdog/action-eslint" , " stefanoeb/eslint-action" , " tj-actions/eslint-changed-files" , " sibiraj-s/action-eslint" , " tinovyatkin/action-eslint" , " bradennapier/eslint-plus-action" , " CatChen/eslint-suggestion-action" , " iCrawl/action-eslint" , " ninosaurus/eslint-check" },
36+ " golangci-lint" :{" golangci/golangci-lint-action" },
37+ " goreleaser" : {" goreleaser/goreleaser-action" },
38+ " gradle" : {" gradle/gradle-build-action" },
39+ " maven" : {" qcastel/github-actions-maven-release" , " samuelmeuli/action-maven-publish" , " LucaFeger/action-maven-cli" },
40+ " megalinter" :{" oxsecurity/megalinter" },
41+ " mkdocs" : {" mhausenblas/mkdocs-deploy-gh-pages" , " athackst/mkdocs-simple-plugin" },
42+ " msbuild" : {" MVS-Telecom/publish-nuget" },
43+ " mypy" : {" ricardochaves/python-lint" , " jpetrucciani/mypy-check" , " sunnysid3up/python-linter" , " tsuyoshicho/action-mypy" },
44+ " npm" : {" actions/setup-node" ," JS-DevTools/npm-publish" },
45+ " phpstan" :{" php-actions/phpstan" },
46+ " pip" : {" brettcannon/pip-secure-install" , " BSFishy/pip-action" },
47+ " pre-commit" : {" dbt-checkpoint/dbt-checkpoint" , " pre-commit/action" , " pre-commit-ci/lite-action" , " browniebroke/pre-commit-autoupdate-action" , " cloudposse/github-action-pre-commit" },
48+ " pre-commit" :{" pre-commit/action" },
49+ " python" : {" hynek/build-and-inspect-python-package" },
50+ " rake" : {" magefile/mage-action" },
51+ " rubocop" : {" reviewdog/action-rubocop" , " andrewmcodes-archive/rubocop-linter-action" , " gimenete/rubocop-action" , " r7kamura/rubocop-todo-corrector" },
52+ " sonar-scanner" : {" sonarsource/sonarqube-scan-action" },
53+ " stylelint" :{" actions-hub/stylelint" },
54+ " terraform" : {" OP5dev/TF-via-PR" , " dflook/terraform-plan" , " dflook/terraform-apply" },
55+ " tflint" : {" reviewdog/action-tflint" , " devops-infra/action-tflint" },
56+ " tofu" : {" dflook/tofu-plan" , " dflook/tofu-apply" },
57+ " vale" : {" gaurav-nelson/github-action-vale-lint" , " errata-ai/vale-action" },
3258}[action]
3359
3460build_commands[cmd] = {
3561 " ant" : {" ^ant " },
62+ " bash" : {" \\ S+\\ .sh\\ b" },
3663 " bundler" : {" bundle install" , " bundle exec " },
37- " cargo" : {" cargo build" , " cargo run" },
64+ " cargo" : {" cargo build" , " cargo run" , " cargo test" , " cargo bench" },
65+ " checkov" : {" checkov " },
66+ " chmod" : {" ^\\ s*chmod\\ s+(?:.*\\ +x.*|\\ b(?:[0-7]{2}[1357]|[0-7][0-7]{2}[1357])\\ b)" }, # Unit test: https://regex101.com/r/tt7qzw/1
67+ " docker" : {" docker build" }, # docker build need to also be run to have significant impact.
68+ " eslint" : {" eslint " },
3869 " go generate" : {" go generate" },
3970 " gomplate" : {" gomplate " },
71+ " goreleaser" : {" goreleaser build" , " goreleaser release" },
4072 " gradle" : {" gradle " , " ./gradlew " , " ./gradlew.bat " }, # https://docs.gradle.org/current/userguide/gradle_wrapper_basics.html
4173 " make" : {" make " },
4274 " maven" : {" mvn " , " ./mvnw " , " ./mvnw.bat" , " ./mvnw.cmd" , " ./mvnw.sh " }, # https://maven.apache.org/wrapper/
4375 " mkdocs" : {" mkdocs build" },
4476 " msbuild" : {" msbuild " },
45- " npm" : {" npm install" , " npm run " , " yarn " , " npm ci(\\ b|$)" },
77+ " mypy" : {" mypy " },
78+ " npm" : {" npm diff" , " npm restart" , " npm (rum|urn|run(-script)?)" , " npm start" , " npm stop" , " npm t(e?st)?" , " npm ver(si|is)on" ," npm (install|add|i|in|ins|inst|insta|instal|inst|isnta|isntal|isntall)" , " npm ci(\\ b|$)" },
79+ " phpstan" : {" phpstan " },
4680 " pip" : {" pip install" , " pipenv install" , " pipenv run " },
81+ " powershell" : {" \\ S+\\ .ps1\\ b" },
4782 " pre-commit" : {" pre-commit run" , " pre-commit install" },
83+ " python" : {" ^\\ s*python(3)?\\ s+\\ S+\\ .py\\ b" }, # Unit test: https://regex101.com/r/tuap3y/1
84+ " rake" : {" rails db:create" , " rails assets:precompile" , " ^rake " },
85+ " rubocop" : {" rubocop" },
86+ " sonar-scanner" : {" sonar-scanner" },
87+ " stylelint" : {" stylelint " },
88+ " tar" : {" tar (-?x-?P-?f|-?P-?x-?f|-?x -P -f|-?P -x -f) " }, # Unit test: https://regex101.com/r/pX85P8/1
4889 " terraform" : {" terraform plan" , " terraform apply" },
90+ " tflint" : {" tflint" },
4991 " tofu" : {" tofu plan" , " tofu apply" },
92+ " trivy" : {" trivy " },
93+ " unzip" : {" unzip .*-:" },
5094 " vale" : {" vale " },
95+ " webpack" : {" webpack" },
96+ " yarn" : {" yarn " },
5197}[cmd]
5298
5399results contains poutine.finding (rule, pkg_purl, {
@@ -70,7 +116,24 @@ results contains poutine.finding(rule, pkg_purl, {
70116 " event_triggers" : workflow_events,
71117}) if {
72118 [pkg_purl, workflow_path, workflow_events, step] := _steps_after_untrusted_checkout[_]
73- build_github_actions[step.action]
119+ regex.match (
120+ sprintf (" ([^a-z]|^)(%v)@" , [concat (" |" , build_github_actions[_])]),
121+ step.uses,
122+ )
123+ }
124+
125+
126+ results contains poutine.finding (rule, pkg_purl, {
127+ " path" : workflow_path,
128+ " line" : step.lines.uses,
129+ " details" : sprintf (" Detected usage of a Local GitHub Action at path: `%s`" , [step.action]),
130+ " event_triggers" : workflow_events,
131+ }) if {
132+ [pkg_purl, workflow_path, workflow_events, step] := _steps_after_untrusted_checkout[_]
133+ regex.match (
134+ ` ^\./` ,
135+ step.action,
136+ )
74137}
75138
76139_steps_after_untrusted_checkout contains [pkg.purl, workflow.path, events, s.step] if {
0 commit comments