Skip to main content

SKY-SCA-UPG001 · Supply chain and agent configuration

Dependency upgrade adds install-time or import-time code

Critical

A pull request moves a locked npm or PyPI package to a new version, and the new release adds code that runs by itself: an install script, a .pth file or sitecustomize module that Python runs at start-up, or code that decodes and executes a string. SKY-SCA-UPG001 names the package, the versions and the new file.

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: fails the gate on its own. In a diff scan one finding fails the gate on its own, whatever the limits. 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

This is how most compromised releases work: the attacker publishes a new version whose install hook steals tokens from the developer machine or CI runner that installs it. The lockfile diff shows only a new version number, so reviewers merge it without reading the package.

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": {        "es5-ext": "^0.10.53"      }    },    "node_modules/es5-ext": {Removed:       "version": "0.10.53",Removed:       "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.53.tgz",Added:       "version": "0.10.64",Added:       "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.64.tgz",Added:       "hasInstallScript": true,      "license": "ISC"    }  }}

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": {        "es5-ext": "^0.10.52"      }    },    "node_modules/es5-ext": {Removed:       "version": "0.10.52",Removed:       "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.52.tgz",Added:       "version": "0.10.53",Added:       "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.53.tgz",      "license": "ISC"    }  }}

Why Skylos leaves it alone

The same package and the same kind of patch bump. Skylos downloaded both releases and compared them: 0.10.53 changes code but adds nothing that runs on install, at interpreter start-up or by decoding a string.

More languages

TOML

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).

uv.lock · TOML · changed
version = 1requires-python = ">=3.9" [[package]]name = "setuptools"Removed: version = "49.0.0"Added: version = "50.0.0"source = { registry = "https://pypi.org/simple" }

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).

uv.lock · TOML · changed
version = 1requires-python = ">=3.9" [[package]]name = "setuptools"Removed: version = "50.0.0"Added: version = "50.3.2"source = { registry = "https://pypi.org/simple" }

Why Skylos leaves it alone

setuptools 50.0.0 already shipped distutils-precedence.pth, so moving on to 50.3.2 adds no new start-up code. The flagged upgrade from 49.0.0 is where that file first appeared: a .pth line that starts with import runs every time Python starts.

How Skylos decides

  1. Runs with --sca --review-upgrades in a diff scan. It pairs each npm and PyPI version that changed in a lockfile with the version the base branch locked, and hands the pairs to the ca9 library.
  2. ca9 downloads both releases from the registry and compares their files as text and syntax trees. It never installs, imports or runs them. Packages listed in internal_packages and packages from a private registry are skipped, not looked up.
  3. A behaviour is reported only when the old release did not have it. The block list: a new .pth file with code, a new sitecustomize or usercustomize, a new install hook, new decode-and-execute code, a new Git or URL dependency, shipped agent or editor hook files, files that shadow commands such as node or git, import-time code it cannot inspect, contents it cannot attribute, and a download that does not match the hash in the lockfile.
  4. A package that is new to the project has no old release to compare with, so what it ships is reported as SKY-SCA-UPG002 instead.
  5. Any other changed package that could not be reviewed, for example because its download failed, stops the scan as incomplete. Requirements files, pdm.lock and pylock.toml are listed as not reviewed.

How to fix it

Do not merge until someone has read the new code. Here es5-ext's maintainer added a postinstall script that prints a message, which is harmless; a compromised release looks the same in the lockfile. If the change cannot be explained, keep the old version, and report the release to the registry if it looks malicious.

When it can be wrong

  • Legitimate changes are reported too, like the setuptools .pth file. The rule says "read this before merging", not "this is malware".
  • Behaviour that both releases share is not reported, so a package that always had an install script 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-UPG001"] turns the rule off. In pull-request CI the setting is read from the base branch.

  • A baseline cannot hold it: dependency baselines hold only known vulnerabilities, and a pull request must not be able to excuse its own upgrade.

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