Skip to content

Harden cli-hub: registry install_cmd strings are shell-executed (unpinned curl | bash from third-party hosts) #373

Description

@amaniagent

Thanks for CLI-Anything — the registry-driven installer model is neat. While reading the install path I noticed a supply-chain hardening opportunity worth raising.

cli-hub/cli_hub/installer.py (_run_command) executes a registry entry's install_cmd with shell=True when it contains a pipe/operator, and the registry ships entries whose install_cmd is an unpinned remote script — e.g. in public_registry.json:

"install_strategy": "command",
"install_cmd": "curl -s https://jimeng.jianying.com/cli | bash"

Because the command is fetched-then-piped-to-bash with no version pin or checksum, the safety of an install reduces entirely to "is this registry entry (and the host it points at) trustworthy right now?" A malicious or compromised registry entry — or a hijacked third-party host — becomes arbitrary code execution on the installing user's machine.

This shape is inherent to any "run the install command" tool (Homebrew casks have the same trait), so it isn't a bug — but a few guardrails would shrink the blast radius:

  • Show the exact command and require explicit confirmation before executing a script/command-type entry (interactive y/N, with a --yes to opt out for automation).
  • Prefer non-script install_strategy (package managers with lockfiles/signatures) where an upstream offers one; treat curl | bash as the last resort.
  • Pin + checksum: let registry entries carry an expected SHA for the fetched script and verify before running.
  • Optionally surface in the registry schema which entries are remote-script installs so consumers can filter/trust accordingly.

Happy to send a PR for the confirm-before-exec piece if that'd be welcome.

Surfaced via a static, read-only audit of supply-chain install patterns — no code was executed. Happy to clarify anything.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions