Skip to main content

SKY-D312 · CI/CD pipelines

JavaScript install runs dependency scripts in CI

High

The catalog lists HIGH, but the detector reports every finding as MEDIUM, whether or not the job holds secrets or a write token.

npm ci, npm install, yarn install, pnpm install and bun install can run each dependency's lifecycle scripts, such as postinstall, while installing. SKY-D312 reports such an install in a workflow run: block that does not pass --ignore-scripts.

Languages
GitHub Actions workflows, composite actions
Quality gate
counted toward the gate limits (full and diff scans)
Finding type
review
Catalog name
GitHub Actions JavaScript install scripts
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

A compromised dependency's postinstall script runs inside the job, where it can read the job's token, secrets and OIDC token. Several npm attacks stole publish tokens from CI exactly this way, then used them to release infected versions of other packages.

What Skylos flags

.github/workflows/release.yml · YAMLReported on line 24
name: Releaseon:  push:    tags: ["v*"]permissions:  contents: readjobs:  publish:    name: Publish to npm    runs-on: ubuntu-latest    timeout-minutes: 15    environment: npm    permissions:      contents: read      id-token: write    steps:      - uses: actions/checkout@v4        with:          persist-credentials: false      - uses: actions/setup-node@v4        with:          node-version: 22          registry-url: https://registry.npmjs.org      - run: npm ci      - run: npm run build      - run: npm publish --provenance --access public

What Skylos leaves alone

.github/workflows/release.yml · YAML
name: Releaseon:  push:    tags: ["v*"]permissions:  contents: readjobs:  publish:    name: Publish to npm    runs-on: ubuntu-latest    timeout-minutes: 15    environment: npm    permissions:      contents: read      id-token: write    steps:      - uses: actions/checkout@v4        with:          persist-credentials: false      - uses: actions/setup-node@v4        with:          node-version: 22          registry-url: https://registry.npmjs.org      - run: |          npm ci --ignore-scripts          npm rebuild esbuild      - run: npm run build      - run: npm publish --provenance --access public

Why Skylos leaves it alone

Install scripts are off, and the one dependency that needs its build step is rebuilt by name. npm run build runs the project's own script from package.json, which is reviewed with the repository; the rule only looks at installs.

How Skylos decides

  1. Reads workflow files under .github/workflows and composite actions (action.yml, action.yaml). Every run: block is checked, in any job, whatever its trigger or permissions.
  2. Reports a line that starts (after spaces) with npm, pnpm, yarn or bun followed by ci or install, unless --ignore-scripts appears later on that same line.
  3. Takes only the first match in each run: block. Reports MEDIUM on the first line of the file that contains the matched text, such as npm ci; blocks whose match has the same text give one finding there.

How to fix it

Install with --ignore-scripts. If a dependency really needs its install step (a native module, esbuild), run npm rebuild <name> for that package only, after reviewing it.

.github/workflows/release.yml · YAML · the fix, against the flagged file
name: Releaseon:  push:    tags: ["v*"]permissions:  contents: readjobs:  publish:    name: Publish to npm    runs-on: ubuntu-latest    timeout-minutes: 15    environment: npm    permissions:      contents: read      id-token: write    steps:      - uses: actions/checkout@v4        with:          persist-credentials: false      - uses: actions/setup-node@v4        with:          node-version: 22          registry-url: https://registry.npmjs.orgRemoved:       - run: npm ciAdded:       - run: npm ci --ignore-scripts      - run: npm run build      - run: npm publish --provenance --access public

When it can be wrong

  • Only the command line is read. ignore-scripts=true in .npmrc or npm config set ignore-scripts true is not seen, and Bun, or pnpm from version 10, which skip dependency scripts unless the project trusts the package, are still reported.
  • --ignore-scripts anywhere later on the line, even in a # comment, clears it. Installs that do not start the line (cd web && npm ci), npm i and a bare yarn are missed.
  • Location: the finding goes to the first line containing the same text, so after an earlier npm ci --ignore-scripts a later plain npm ci is reported on the earlier, safe line.

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

  • Put # skylos: ignore[SKY-D312] <reason> on the reported line or on the line directly above it, one rule per marker. In a multi-line run: block the marker can be a shell comment.

    YAML
    run: |  # skylos: ignore[SKY-D312] test job, no secrets or write token  npm ci
  • [tool.skylos] ignore = ["SKY-D312"] turns the rule off for the whole project. A baseline also works, but it records the absolute file path and line, so it stops matching when the checkout moves or lines above the finding change.

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