ci/no-pipe-to-shell
Downloads are not piped into a shell
| Severity | warning |
| Tiers | 1, 2 |
| Stacks | any |
| Scope | root |
| Kind | expr |
| Source | library v0.1.0 |
| Selected by | fleetlint-recommended@v0.1.0 |
Requirement
CI scripts (Actions run steps, GitLab scripts) and Dockerfile/Containerfile instructions never pipe a download into a shell (curl ... | sh, wget -O- ... | bash, sh -c "$(curl ...)", bash <(curl ...)). Tools come from a pinned action, a package manager or a downloaded file whose checksum is verified before it runs.
Why
Whatever the server returns at that moment runs with the job’s secrets or ends up in the image, with nothing pinned and nothing verified.
Applies when
workflows().size() > 0 || tracked().exists(p, p.matches("(^|/)((Dockerfile|Containerfile)[^/]*|[^/]+\\.(Dockerfile|Containerfile|dockerfile|containerfile))$"))Check
For each item in:
[r'((?:curl|wget)\b[^|#\n]*\|\s*(?:sudo\s+(?:-\S+\s+)*)?(?:ba|z|da|k)?sh\b|(?:ba|z|da|k)?sh\s+(?:-c\s+)?["\x27]?(?:<\(|\$\()\s*(?:curl|wget)\b)'].map(re,
workflows().map(w, grep(w, re)).flatten()
+ grep("Dockerfile*", re) + grep("Containerfile*", re)
+ grep("*.Dockerfile", re) + grep("*.Containerfile", re)
+ grep("*.dockerfile", re) + grep("*.containerfile", re)).flatten()item.text.startsWith("#") || item.path.endsWith(".dockerignore") || item.path.endsWith(".containerignore")Fix
Download the installer or release archive to a file, verify its sha256 against a pinned value, then run it; or install through a pinned action or the package manager.
Agent instruction: Replace each flagged pipe with: download to a file, sha256sum -c against a pinned checksum (Renovate-annotated), then execute or extract; keep the installed version unchanged.
See: https://fleetlint.org/baseline/#security
Generated by fleetlint docs from catalog v0.1.0.