Skip to content

Commit c802283

Browse files
vaindclaude
andauthored
fix(danger): harden extra-install-packages against host-shell interpolation (#169)
* fix(danger): harden extra-install-packages against host-shell interpolation The package list was interpolated by the host shell into the `docker exec ... sh -c "..."` command string. Although the upstream "Validate package names" step already rejects shell metacharacters, building the command string on the host is the exact pattern #152 (VULN-1100) set out to eliminate everywhere. Pass the value into the container via `docker exec -e` and expand it inside a single-quoted `sh -c` body so neither the host shell nor GitHub Actions expression evaluation ever constructs the command string. Behavior is unchanged for valid inputs (covered by the existing extra-packages-test CI job). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(changelog): add PR number to unreleased entry Danger requires the changelog entry to reference the PR number. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b6d9e26 commit c802283

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Fixes
6+
7+
- Danger - Harden `extra-install-packages` handling: pass the package list into the container via env var instead of host-shell string interpolation (defense in depth) ([#169](https://github.com/getsentry/github-workflows/pull/169))
8+
39
## 3.4.0
410

511
### Features

danger/action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ runs:
8888
EXTRA_INSTALL_PACKAGES: ${{ inputs.extra-install-packages }}
8989
run: |
9090
echo "Installing packages: $EXTRA_INSTALL_PACKAGES"
91-
docker exec --user root danger sh -c "set -e && apt-get update && apt-get install -y --no-install-recommends $EXTRA_INSTALL_PACKAGES"
91+
# Pass the (already-validated) package list into the container via env var and
92+
# let the container's shell expand it. Single quotes prevent the host shell
93+
# from interpolating the value into the command string (defense in depth).
94+
docker exec --user root -e EXTRA_INSTALL_PACKAGES danger \
95+
sh -c 'set -e && apt-get update && apt-get install -y --no-install-recommends $EXTRA_INSTALL_PACKAGES'
9296
echo "All additional packages installed successfully."
9397
9498
- name: Run DangerJS

0 commit comments

Comments
 (0)