@devries-cameron20 / composio-1 / commits / 7a2892361
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.

fix(install): validate COMPOSIO_GITHUB_* env vars to prevent supply-chain attacks

The install script accepts COMPOSIO_GITHUB_URL, COMPOSIO_GITHUB_OWNER, and COMPOSIO_GITHUB_REPO from the environment to construct the download URL. A malicious override could redirect the download to an attacker- controlled server, bypassing checksum verification (since checksums.txt is fetched from the same source). Fix: - Require COMPOSIO_GITHUB_URL to start with https:// - Require COMPOSIO_GITHUB_OWNER and COMPOSIO_GITHUB_REPO to match safe identifier patterns (alphanumeric, hyphens, underscores, dots)

jkomyno committed Mar 9, 2026 at 16:06 UTC 7a28923617873db641e2e5a3a054a446adad3aab
1 file changed +18
install.sh
+18
@@ -6,6 +6,24 @@ COMPOSIO_GITHUB_REPO=${COMPOSIO_GITHUB_REPO-"composio"}
6 COMPOSIO_GITHUB_URL=${COMPOSIO_GITHUB_URL-"https://github.com"}
7 COMPOSIO_INSTALL_DIR=${COMPOSIO_INSTALL_DIR:-$HOME/.composio}
8
9 +# --- Input validation ---
10 +
11 +# Only allow HTTPS URLs for the download source.
12 +if [[ ! "$COMPOSIO_GITHUB_URL" =~ ^https:// ]]; then
13 + echo "error: COMPOSIO_GITHUB_URL must start with https:// (got \"$COMPOSIO_GITHUB_URL\")" >&2
14 + exit 1
15 +fi
16 +
17 +# Owner and repo must be safe identifiers (alphanumeric, hyphens, underscores, dots).
18 +if [[ ! "$COMPOSIO_GITHUB_OWNER" =~ ^[a-zA-Z0-9._-]+$ ]]; then
19 + echo "error: COMPOSIO_GITHUB_OWNER contains invalid characters (got \"$COMPOSIO_GITHUB_OWNER\")" >&2
20 + exit 1
21 +fi
22 +if [[ ! "$COMPOSIO_GITHUB_REPO" =~ ^[a-zA-Z0-9._-]+$ ]]; then
23 + echo "error: COMPOSIO_GITHUB_REPO contains invalid characters (got \"$COMPOSIO_GITHUB_REPO\")" >&2
24 + exit 1
25 +fi
26 +
27 github_repo="$COMPOSIO_GITHUB_URL/$COMPOSIO_GITHUB_OWNER/$COMPOSIO_GITHUB_REPO"
28
29 # --- Colors (only when interactive) ---