Detects run steps that pipe a remotely downloaded script directly to a shell interpreter (e.g., curl ... | bash, wget ... | sh, irm ... | iex).
Piping a remote script directly to a shell is dangerous because the script executes immediately without inspection. If the remote server is compromised or the connection is intercepted, arbitrary code runs in the CI environment with whatever permissions the workflow has.
Download the script to a file first, verify its integrity (e.g., checksum), then execute:
- run: |
curl -fsSL https://example.com/install.sh -o install.sh
echo "expected-sha256 install.sh" | sha256sum -c
bash install.shOr pin to a specific version and checksum.
warning
curl -o fileorwget -O filewithout piping to a shell does not trigger this rule.