dify icon indicating copy to clipboard operation
dify copied to clipboard

`difyctl` install docs rely on `curl | sh` for the installer script (no script integrity check)

Open cursor[bot] opened this issue 2 weeks ago • 2 comments

  1. AIS008 (HIGH) — cli/README.md: The primary install instruction pipes the installer from raw.githubusercontent.com straight into sh. The script correctly SHA-256-verifies the difyctl release asset, but the installer script is not verified before execution, so a tampered or substituted script runs with full user privileges. The same one-liner pattern is documented in cli/scripts/install-cli.sh and cli/scripts/install-r2.sh. Fix: Publish versioned installer scripts and checksum manifests on GitHub Releases (alongside difyctl), and document download → sha256sum -c → sh install-cli.sh (or a small verified wrapper). Keep curl | sh only for a stub that verifies and execs the real script.

Found with lacan-scan v7.5.0 and checked by hand.

cursor[bot] avatar Nov 17 '26 10:11 cursor[bot]

I would like to work on this. I verified on current main (0e63474) that cli/README.md still pipes install-cli.sh straight into sh, and that the script itself already sha256-verifies the difyctl binary against the release checksums manifest, so the installer script is the one unverified link. I will open a PR that publishes installer-script checksums on Releases, extending the existing manifest pattern, and documents the download, verify, run flow in cli/README.md. Happy to adjust the direction if maintainers prefer a different fix.

techaurah avatar Nov 18 '26 06:11 techaurah

Verified against current main (HEAD 0e63474, 2026-11-18). The gap is real and narrow:

  1. cli/README.md lines 9-10 still show curl -fsSL https://raw.githubusercontent.com/langgenius/dify/main/cli/scripts/install-cli.sh | sh as the primary install, and the same pattern documents install-r2.sh and the PowerShell one-liner.
  2. The binary itself is already protected: cli/scripts/install-cli.sh lines 209-241 download difyctl-v${version}-checksums.txt from the release and sha256-verifies the asset before installing. The release already publishes that manifest, so the mechanism exists.
  3. The installer script is the only unverified link: nothing checks install-cli.sh, install-r2.sh or install.ps1 before they run, and the README pins them to main, which is mutable. Proposed fix, keeping the existing pattern: extend .github/workflows/cli-release.yml so the release also publishes sha256 checksums for the three installer scripts, then document download, sha256sum -c, sh in cli/README.md, with curl|sh kept only against a pinned release tag. Two questions for maintainers before I write the PR: is publishing script checksums on Releases acceptable, and should the edge/R2 installer get the same treatment as the release installer? If the answer to the first is no, the fallback is docs-only: pin the README one-liners to a release tag instead of main.

techaurah avatar Nov 18 '26 06:11 techaurah