Dhairya-007 opened a new pull request, #31071:
URL: https://github.com/apache/camel/pull/31071
# Rationale for this change
Three `${{ }}` expressions are expanded directly inside `run:` blocks, where
GitHub substitutes them **textually before bash parses the script**. The
surrounding quotes do not help, because they are already part of the text when
the value is pasted in, so a value containing shell metacharacters runs as code
in the job.
| Workflow | Expression | Source of the value |
| --- | --- | --- |
| `check-container-versions.yml` | `github.event.inputs.scan_path` |
`workflow_dispatch` input |
| `check-container-versions.yml` | `github.event.inputs.check_prereleases` |
`workflow_dispatch` input |
| `camel-launcher-native-exe.yml` | `github.base_ref` | the base branch of a
pull request |
The fix is the standard one: bind the value to an `env:` entry on the step
and read it as a shell variable, so it arrives as data rather than as script
text.
**On how much this matters.** The two `workflow_dispatch` inputs can only be
set by someone who already has write access, so that pair is hardening rather
than an open hole. `github.base_ref` is the weaker one of the three — it is the
*base* branch, not the contributor's head branch, so on a normal PR it is a
branch name from this repository. I am not claiming a working exploit for any
of them. They are cheap to close and the project's own `CLAUDE.md` asks
contributors to avoid introducing static-analysis findings, so leaving three
known ones in place seemed the wrong default.
## What changed
`check-container-versions.yml` — both inputs via `env:`, keeping the
existing `test-infra` fallback:
```yaml
env:
SCAN_PATH_INPUT: ${{ github.event.inputs.scan_path }}
CHECK_PRERELEASES: ${{ github.event.inputs.check_prereleases }}
run: |
SCAN_PATH="${SCAN_PATH_INPUT:-test-infra}"
```
This workflow also runs on `schedule`, where `github.event.inputs.*` is
empty. `${SCAN_PATH_INPUT:-test-infra}` yields `test-infra` in exactly that
case, so the scheduled run behaves as before — the `|| 'test-infra'` it
replaces did the same thing.
`camel-launcher-native-exe.yml` — `base_ref` via `env:`:
```yaml
env:
BASE_REF: ${{ github.base_ref }}
run: |
...
CHANGED="$(git diff --name-only "origin/$BASE_REF"...HEAD)"
```
**What I deliberately left alone** in that same `run:` block:
`github.event_name`, `github.event.before` and `github.sha`. zizmor does not
flag them — `event_name` comes from a fixed vocabulary and the other two are
hex SHAs — so converting them would be churn in a block this PR has no other
reason to touch. Happy to convert them too if you would rather the whole step
be consistent.
## Are these changes tested?
These are the two tools the repo's own guidance points at, run on the two
changed files:
```console
# zizmor, before
25 findings (2 ignored, 20 suppressed, 2 fixable): 0 informational, 0 low, 0
medium, 3 high
-> 3x error[template-injection]
# zizmor, after
No findings to report. Good job! (2 ignored, 17 suppressed)
# actionlint, before and after: byte-identical output
```
actionlint reports the same pre-existing `SC2086`/`SC2034` shellcheck infos
before and after, at line numbers shifted by the three added lines, so this
introduces no new findings and fixes none of those either.
I could not execute these workflows — `check-container-versions.yml` is
`schedule` + `workflow_dispatch` on the apache repo, and the launcher one needs
a pull-request event — so the argument here rests on the semantics of `env:`
versus `${{ }}` expansion, which is well established, plus the static checks
above.
## Are there any user-facing changes?
No. CI only.
---
_Claude Code on behalf of Dhairya-007_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]