Skip to main content

SKY-D328 · Security in code

Remote script piped into a shell

"curl | bash" downloads a script and runs it in the same breath, so nobody sees or checks what ran. SKY-D328 reports a curl or wget of an outside URL whose output goes straight into a shell or interpreter.

Languages
Dockerfile, Shell, GitHub Actions, GitLab CI, Python, TypeScript/JavaScript
Quality gate
counted toward the gate limits (full and diff scans)
Finding type
review
Catalog name
Remote script piped to shell
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

Whoever controls that URL, its DNS or its CDN at build time controls your build. A swapped install script runs with the image's or runner's permissions and secrets, and the next build may fetch something else again, so the image cannot be reproduced.

What Skylos flags

Dockerfile · DockerfileReported on line 4
FROM debian:bookworm-slimRUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates \    && rm -rf /var/lib/apt/lists/*RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

What Skylos leaves alone

Dockerfile · Dockerfile
FROM debian:bookworm-slimARG RUSTUP_SHA256RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates \    && rm -rf /var/lib/apt/lists/*RUN curl -fsSLo /tmp/rustup-init \      https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init \    && echo "${RUSTUP_SHA256}  /tmp/rustup-init" | sha256sum -c - \    && chmod +x /tmp/rustup-init && /tmp/rustup-init -y

Why Skylos leaves it alone

The installer is saved to a file, its SHA-256 is checked against a value pinned in the build, and only then is the saved copy run. No download is piped into an interpreter; the one pipe feeds sha256sum.

More languages

YAML

Flagged

.github/workflows/lint.yml · YAMLReported on line 12
name: Linton: [push]permissions:  contents: readjobs:  lint:    runs-on: ubuntu-latest    steps:      - uses: actions/checkout@v4      - name: Install the linter        run: |          curl -fsSL https://get.example-lint.dev/install.sh | bash          example-lint --version      - run: example-lint check .

Not flagged

.github/workflows/lint.yml · YAML
name: Linton: [push]permissions:  contents: readjobs:  lint:    runs-on: ubuntu-latest    steps:      - uses: actions/checkout@v4      - name: Install the linter        run: |          curl -fsSL https://get.example-lint.dev/example-lint-1.8.2.tar.gz | tar -xz          ./example-lint --version      - run: ./example-lint check .

Why Skylos leaves it alone

This download is piped into tar, which unpacks a fixed release archive. tar is not an interpreter, so nothing from the URL is run as a script by the pipe itself.

How Skylos decides

  1. Reads shell commands in .sh, .bash, .zsh, .ksh and .bats files, GitHub Actions run: steps, GitLab CI script items, Dockerfile RUN instructions (continuation lines joined), fixed command strings in Python os.system()-style calls or shell=True calls, and fixed strings passed to child_process.exec() in TypeScript and JavaScript.
  2. Splits each command at ;, && and ||, then into pipeline parts at |. Reports when a part whose command is curl or wget has an outside http(s):// URL and a later part of the same pipeline runs bash, sh, dash, ksh, zsh, python, python3, node, ruby or perl (also after sudo, nohup, time or command).
  3. Also reports an interpreter that runs a $(curl …) or $(wget …) substitution of an http(s):// URL anywhere in the command, as in sh -c "$(curl -fsSL https://…)".
  4. Skips http://localhost, 127.0.0.1 and 0.0.0.0 URLs, downloads piped into tools that are not interpreters (tar, jq, sha256sum), and downloads saved to a file and run in a later command. Every finding is HIGH.

How to fix it

Download to a file, check it against a checksum or signature you pinned, then run the saved copy. Better still, install a pinned release from a package manager or copy the binary from a versioned image.

Dockerfile · Dockerfile · the fix, against the flagged file
FROM debian:bookworm-slimAdded: ARG RUSTUP_SHA256RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates \    && rm -rf /var/lib/apt/lists/*Removed: RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -yAdded: RUN curl --proto '=https' --tlsv1.2 -sSfo /tmp/rustup-init.sh https://sh.rustup.rs \Added:     && echo "${RUSTUP_SHA256}  /tmp/rustup-init.sh" | sha256sum -c - \Added:     && sh /tmp/rustup-init.sh -y

When it can be wrong

  • An installer from a host you trust and pin (a vendor's signed script behind a fixed URL) is reported the same as any other, because Skylos cannot see what the URL serves.
  • Missed: process substitution such as bash <(curl -fsSL https://…); and in a GitHub Actions run: | block, or a multi-line GitLab item, a pipe that starts on a later line, because the block is split only at ;, &&, || and |, not at line breaks.

Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.

How to silence it

  • In a Dockerfile the marker goes on the first line of the RUN instruction or on the line directly above it, one rule per marker. Text after # on a RUN line becomes a shell comment, so the build is unchanged.

    Dockerfile
    # skylos: ignore[SKY-D328] vendor script, signature checked in CIRUN curl -fsSL https://get.example-lint.dev/install.sh | sh
  • [tool.skylos] ignore = ["SKY-D328"] turns the rule off for the whole project.

From the Skylos rule handbook, Skylos 5.8.0 (commit 5b880b0). All rules.