Skip to content

Find the holes before someone else does. A fast, 100% Rust vulnerability scanner: XSS, SQL injection, leaked secrets, dependency CVEs and AI agent setups.

fix(config): flag workflow_run fields in gha-script-injection (#127)

Natalia Szczepanik72e2a9f5972f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 09185b4..9d6689c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,12 @@
# Changelog
+## Unreleased
+
+- Config: `config.gha-script-injection` also checks `workflow_run` workflows, so
+ `github.event.workflow_run.head_branch`, `.display_title`, `.head_commit.message` and the head commit's
+ author and committer name and email pasted into a `run:` step are reported. Fields the triggering run
+ can't set, like `workflow_run.id`, `.conclusion` or `.repository.name`, are not.
+
## 1.1.0 (2026-11-25)
- Agent: `agent.mcp-plaintext-secret` also checks the `headers` and `http_headers` of remote MCP servers
diff --git a/src/rules/config.rs b/src/rules/config.rs
index fa5b280..5ce46f9 100644
--- a/src/rules/config.rs
+++ b/src/rules/config.rs
@@ -126,7 +126,7 @@ pub static RULES: &[Rule] = &[
"config.gha-script-injection",
High,
workflow,
- r"\$\{\{\s*github\.(?:event\.(?:issue|pull_request|comment|review|review_comment|discussion|head_commit|commits|pages)[\w.\[\]*]*\.(?:title|body|message|name|label|ref|email|default_branch)|head_ref)\s*\}\}",
+ r"\$\{\{\s*github\.(?:event\.(?:issue|pull_request|comment|review|review_comment|discussion|head_commit|commits|pages)[\w.\[\]*]*\.(?:title|body|message|name|label|ref|email|default_branch)|event\.workflow_run\.(?:head_branch|display_title|head_commit\.(?:message|(?:author|committer)\.(?:name|email)))|head_ref)\s*\}\}",
None,
"Text an outsider controls (a PR title, issue body, branch name) is pasted into the workflow, so it can run commands.",
"Pass it through an env: variable and use \"$VAR\" in the script."
diff --git a/tests/fixtures/config/.github/workflows/ci.yml b/tests/fixtures/config/.github/workflows/ci.yml
index 478f6b4..000b077 100644
--- a/tests/fixtures/config/.github/workflows/ci.yml
+++ b/tests/fixtures/config/.github/workflows/ci.yml
@@ -23,3 +23,9 @@ jobs:
# - run: curl -fsSL https://get.example.com | sh
- run: |
C:\Windows\System32\curl.exe -fsSL https://get.example.com | bash
+ - run: echo "Branch ${{ github.event.workflow_run.head_branch }}"
+ - run: echo "Title ${{ github.event.workflow_run.display_title }}"
+ - run: echo "Msg ${{ github.event.workflow_run.head_commit.message }}"
+ - run: echo "Run ${{ github.event.workflow_run.id }} ${{ github.event.workflow_run.conclusion }}"
+ - run: echo "By ${{ github.event.workflow_run.head_commit.author.email }}"
+ - run: echo "Repo ${{ github.event.workflow_run.repository.name }}"
diff --git a/tests/fixtures/config/EXPECTED b/tests/fixtures/config/EXPECTED
index bda1501..acc7949 100644
--- a/tests/fixtures/config/EXPECTED
+++ b/tests/fixtures/config/EXPECTED
@@ -1,5 +1,9 @@
.github/workflows/ci.yml:10 config.gha-script-injection
.github/workflows/ci.yml:15 config.gha-script-injection
+.github/workflows/ci.yml:26 config.gha-script-injection
+.github/workflows/ci.yml:27 config.gha-script-injection
+.github/workflows/ci.yml:28 config.gha-script-injection
+.github/workflows/ci.yml:30 config.gha-script-injection
.github/workflows/ci.yml:2 config.gha-pull-request-target
.github/workflows/ci.yml:3 config.gha-write-all
.github/workflows/ci.yml:8 config.gha-unpinned-action