Skip to content

Commit f9a9b06

Browse files
authored
Harden the greenlight scan against argument injection via just {{args}} (#8440)
**Impact:** greenlight scan CI workflow **Risk:** low ## What Stop passing dispatch inputs through just's `{{args}}` interpolation. The justfile now uses `set positional-arguments` with `"$@"`, and the scan workflow invokes the CLI directly via `mise exec -- uv run greenlight review`. ## Why `just review {{args}}` expands `{{args}}` back into the recipe's shell line, so the free-form `workflow_dispatch` inputs get re-parsed and re-split by the shell in the step that already holds the App token, ClickHouse creds, and AWS OIDC session. A crafted input could inject shell commands or smuggle extra CLI flags (e.g. flipping on `--allow-untrusted-author`). Quoting the arguments as positionals (`"$@"`) passes them verbatim with no re-splitting, closing the injection path while keeping the same argv the workflow already builds. # Notes The workflow calls `mise exec -- uv run greenlight review` rather than `just review` to keep the argv handling in one place; `just run`/`just review` still work locally and now forward arguments safely. Signed-off-by: Jean Schmidt <contato@jschmidt.me>
1 parent ee58c63 commit f9a9b06

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

.github/workflows/greenlight-review.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Green Light Scan
22

3-
# Manually runs the greenlight scanner (`just review`): lists open pytorch/pytorch PRs
3+
# Manually runs the greenlight scanner (`greenlight review`): lists open pytorch/pytorch PRs
44
# from trusted authors and dispatches greenlight-pr-review.yml for each new or changed
55
# PR. Read-only on ClickHouse; dispatches the reviewer workflow via the App token.
66

@@ -138,4 +138,4 @@ jobs:
138138
if [ -n "$IN_REQUESTER" ]; then args+=(--requester "$IN_REQUESTER"); fi
139139
if [ -n "$IN_MAX" ]; then args+=(--max "$IN_MAX"); fi
140140
args+=(--ref "$IN_REF" --timeout-minutes "$IN_TIMEOUT" --log-level "$IN_LOG_LEVEL")
141-
just review "${args[@]}"
141+
mise exec -- uv run greenlight review "${args[@]}"

greenlight/justfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# https://just.systems/
33

44
set shell := ["mise", "exec", "--", "bash", "-euo", "pipefail", "-c"]
5+
set positional-arguments
56

67
# Show available recipes
78
default:
@@ -13,11 +14,11 @@ setup:
1314

1415
# Run the greenlight CLI
1516
run *args:
16-
uv run greenlight {{args}}
17+
uv run greenlight "$@"
1718

1819
# Scan open PRs from trusted authors in pytorch/pytorch; dispatch the reviewer workflow for new/changed PRs
1920
review *args:
20-
uv run greenlight review {{args}}
21+
uv run greenlight review "$@"
2122

2223
# Type-check source and tests, plus the greenlight-owned detector hook
2324
typecheck:

0 commit comments

Comments
 (0)