Skip to main content

SKY-SCA-UPG002 · Supply chain and agent configuration

Dependency upgrade adds code worth reviewing

Medium

A pull request adds an npm or PyPI package to a lockfile, or moves one to a new version. SKY-SCA-UPG002 reports a new release that contains code worth reading before it is installed: an install script, a changed install script, network or process calls when the package is imported, more obfuscated code, a new native binary, or a different publisher.

Languages
package-lock.json, npm-shrinkwrap.json, pnpm-lock.yaml, yarn.lock, bun.lock, uv.lock, poetry.lock, Pipfile.lock
Turned on by
skylos . --sca --review-upgrades --diff origin/main on a pull request; the workflow skylos setup writes turns this on
Quality gate
Full scan: not checked. Diff scan: listed, not counted by the gate. The built-in gate reports it without counting it: it asks for a look, it does not block. A gate policy pulled from Skylos Cloud counts it toward max_dependency_vulnerabilities. It only runs in diff scans with --review-upgrades.
Finding type
review
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

These changes are common in honest releases, so they do not block. They are also what a compromised release looks like, and the lockfile diff shows only a version number. The finding names the file to read, so the check takes minutes instead of a full audit.

What Skylos flags

A change: the first version of these files is committed, then the edit below is made without committing, and Skylos reviews it as a diff scan (--diff).

package-lock.json · JSON · changed
{  "name": "shop",  "version": "1.0.0",  "lockfileVersion": 3,  "requires": true,  "packages": {    "": {      "name": "shop",      "version": "1.0.0",      "dependencies": {        "ms": "2.1.3"Added:       },Added:       "devDependencies": {Added:         "esbuild": "0.24.0"      }    },Added:     "node_modules/esbuild": {Added:       "version": "0.24.0",Added:       "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.0.tgz",Added:       "dev": true,Added:       "hasInstallScript": true,Added:       "license": "MIT"Added:     },    "node_modules/ms": {      "version": "2.1.3",      "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",      "license": "MIT"    }  }}

What Skylos leaves alone

A change: the first version of these files is committed, then the edit below is made without committing, and Skylos reviews it as a diff scan (--diff).

package-lock.json · JSON · changed
{  "name": "shop",  "version": "1.0.0",  "lockfileVersion": 3,  "requires": true,  "packages": {    "": {      "name": "shop",      "version": "1.0.0",      "dependencies": {        "ms": "2.1.3"Added:       },Added:       "devDependencies": {Added:         "picocolors": "1.1.1"      }    },    "node_modules/ms": {      "version": "2.1.3",      "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",      "license": "MIT"Added:     },Added:     "node_modules/picocolors": {Added:       "version": "1.1.1",Added:       "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",Added:       "dev": true,Added:       "license": "ISC"    }  }}

Why Skylos leaves it alone

The pull request also adds a new development dependency, but picocolors is plain library code: no install script, nothing that reaches the network or starts a process when it is imported.

More languages

JSON

Flagged

A change: the first version of these files is committed, then the edit below is made without committing, and Skylos reviews it as a diff scan (--diff).

package-lock.json · JSON · changed
{  "name": "shop",  "version": "1.0.0",  "lockfileVersion": 3,  "requires": true,  "packages": {    "": {      "name": "shop",      "version": "1.0.0",      "dependencies": {        "ms": "2.1.3"      },      "devDependencies": {Removed:         "esbuild": "0.24.0"Added:         "esbuild": "0.24.2"      }    },    "node_modules/esbuild": {Removed:       "version": "0.24.0",Removed:       "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.0.tgz",Added:       "version": "0.24.2",Added:       "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.2.tgz",      "dev": true,      "hasInstallScript": true,      "license": "MIT"    },    "node_modules/ms": {      "version": "2.1.3",      "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",      "license": "MIT"    }  }}

Not flagged

A change: the first version of these files is committed, then the edit below is made without committing, and Skylos reviews it as a diff scan (--diff).

package-lock.json · JSON · changed
{  "name": "shop",  "version": "1.0.0",  "lockfileVersion": 3,  "requires": true,  "packages": {    "": {      "name": "shop",      "version": "1.0.0",      "dependencies": {Removed:         "ms": "2.1.2"Added:         "ms": "2.1.3"      }    },    "node_modules/ms": {Removed:       "version": "2.1.2",Removed:       "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",Added:       "version": "2.1.3",Added:       "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",      "license": "MIT"    }  }}

Why Skylos leaves it alone

A patch upgrade of ms changes code but adds nothing that runs on install or at import. The flagged upgrade of esbuild changes install.js, the script npm runs after installing it.

How Skylos decides

  1. Runs with --sca --review-upgrades in a diff scan. Each npm and PyPI version that changed in a lockfile is paired with the version the base branch locked; a package new to the project has no old version.
  2. The ca9 library downloads the releases and compares their files as text and syntax trees. It never installs, imports or runs them.
  3. The warning list: new network or process calls at import time, more obfuscated code, a new native binary, a different publisher, a changed install script and a changed native binary.
  4. For a package new to the project there is nothing to compare with, so ca9 reviews the release on its own: an install script or a nested start-up module is a warning here, and the strong signals that would be SKY-SCA-UPG001 on an upgrade (a .pth file with code, decode-and-run code, a Git dependency) are reported under this rule too, with a message saying there was no earlier version.
  5. A change on the block list for an upgraded package is SKY-SCA-UPG001 instead. A changed package that could not be reviewed stops the scan as incomplete.

How to fix it

Read the file the message names. For esbuild, install.js downloads the platform binary, which is expected; for a package that has no reason to touch the network at install, ask why before merging. With pnpm or Bun, allow install scripts only for packages you have reviewed (allowBuilds, trustedDependencies).

When it can be wrong

  • Most findings are honest changes, such as a build tool that fetches its binary. That is why the rule only lists them.
  • Behaviour both releases share is not reported, so a package that always called the network at import is not flagged again.

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

  • [tool.skylos] ignore = ["SKY-SCA-UPG002"] turns the rule off. In pull-request CI the setting is read from the base branch.

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