Skip to content

fix(rules): ignore bash scripts under RUNNER_TEMP in untrusted_checkout_exec - #461

Open
Tyagiquamar wants to merge 2 commits into
boostsecurityio:mainfrom
Tyagiquamar:fix/runner-temp-untrusted-checkout-exec
Open

Tyagiquamar wants to merge 2 commits into
boostsecurityio:mainfrom
Tyagiquamar:fix/runner-temp-untrusted-checkout-exec

Conversation

@Tyagiquamar

Copy link
Copy Markdown
Contributor

Problem

untrusted_checkout_exec reports a finding when a workflow checks out code and later runs bash .../*.sh, even when the script lives under RUNNER_TEMP (runner-provisioned tooling), not the checked-out workspace. See #457.

Root cause

The rule matches any .sh invocation in run steps after an untrusted checkout. It does not distinguish workspace paths from \ / \ paths.

Solution

Add a guard so run steps whose script path references RUNNER_TEMP are excluded from untrusted_checkout_exec command matching. Document the behavior in the rule page.

Tests

Docker golang:1.26-bookworm:

go test ./scanner -run TestRunnerTempScriptNotFlaggedAsUntrustedCheckoutExec -count=1 (pass)

Issue

Fixes #457

Compatibility

No API changes. Narrows findings (fewer false positives) for workflows that execute scripts from RUNNER_TEMP.

@Tyagiquamar
Tyagiquamar requested a review from a team as a code owner October 11, 2026 11:22
…ut_exec

Steps that run shell scripts from RUNNER_TEMP are not executing checked-out workspace code. Suppress untrusted_checkout_exec when the run step references paths under RUNNER_TEMP, fixing false positives such as agentic workflow activation jobs (fixes boostsecurityio#457).

Signed-off-by: Abhipsita-coder <76418226+Abhipsita-coder@users.noreply.github.com>
@Tyagiquamar
Tyagiquamar force-pushed the fix/runner-temp-untrusted-checkout-exec branch from c0b060a to 21a37e2 Compare October 12, 2026 12:49
@fproulx-boostsecurity

Copy link
Copy Markdown
Contributor

Sorry, but CI fails. Some tests do not pass @Tyagiquamar

…e list

The regression fixture lives under testdata, so the workflow inventory test has to include its path.

Signed-off-by: Tyagiquamar <Tyagiquamar@users.noreply.github.com>
@Tyagiquamar

Copy link
Copy Markdown
Contributor Author

TestGithubWorkflows lists every workflow under scanner/testdata. The runner-temp fixture was missing from that list, so go test ./... failed in scanner before the new regression could matter.

Added .github/workflows/runner_temp_script.yml to the expected paths in acf59bb.

docker run --rm -v <checkout>:/src -w /src golang:1.26-bookworm go test ./scanner -count=1 -timeout 180s completed with ok github.com/boostsecurityio/poutine/scanner 24.039s.

@Tyagiquamar

Copy link
Copy Markdown
Contributor Author

@fproulx-boostsecurity The failure in that build_test run is only TestGithubWorkflows. The scan found an extra path, .github/workflows/runner_temp_script.yml, because the regression fixture lives under scanner/testdata.

That path is in the expected list as of acf59bb. Locally, go test ./scanner -count=1 in golang:1.26-bookworm passed. The workflow runs for that commit are action_required, so GitHub has not executed them yet.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

untrusted_checkout_exec flags scripts that run from $RUNNER_TEMP

2 participants