Opens in a new tab
PexLens logo
PexLens logo
Pricing
Add your offcanvas content in here
Add your offcanvas content in here

Static analysis

What PexLens looks for in a package without executing it, and which findings should stay quiet.

Static analysis reads the files of a package and reports supply-chain behavior. Nothing is executed. That matters because the most common open-source attack does not wait for a user to call a function. It runs when the package is installed, imported, or built. If you only test the public feature, you never see it.

The result is evidence plus a contribution to the verdict. Open it when you need to know what in the tree caused the score. Do not treat the static result as optional color around a verdict you already believe. For many malicious packages, the static result is the verdict.

What it flags

The patterns below are the ones that turn a dependency into an attack. They are described in product language because that is how you will explain them in a review.

  • Install and publish scripts that download code, start a shell, or reach the network as part of installation. A script that only prints a funding message is not this. A script that fetches a second stage is.
  • Code that runs on import, including module-level execution and language startup hooks that start a process before any function of yours is called. If merely depending on the package runs code, the review changes.
  • Build-time execution, such as a build script that fetches code or runs commands while the package compiles, a constructor that runs before the program’s main entry point, or a build file that executes a command during an ordinary restore.
  • Obfuscated payloads and unexpected callbacks, where the purpose of the code is to hide what it will do, or to phone home to a destination the package has no reason to know.
  • Impersonation, where the name, metadata, or packaging is trying to be mistaken for a known project.
  • Model files that are unsafe to load, when those files are in the tree. A pickle that executes on load is a package problem even when the directory calls itself a model. See AI and models.

Findings that should stay quiet

Ordinary capabilities are not malware by themselves. Reading an environment variable, writing a log, or starting a process inside a normal build tool will appear in a careful reading of almost any real package. Those observations stay low unless a real threat signal is in the same file, or the package already has a malicious install hook, a known indicator, or a name that impersonates another project.

This is the rule to repeat in reviews: a lone low finding is context, not a block. If you block on it, developers will learn to ignore the verdict. If you ignore a new install script because the rest of the file looks boring, you will miss the attack the check was built to catch. The score is designed so those two mistakes are not equally easy. Weak notes do not add up. A real install-time payload does not need them to.

How to read a result

Open the version and read the static findings next to the verdict. You should see a score out of 100, a level, and what triggered. Ask three questions before you write the review comment.

  1. Did anything run, or prepare to run, without the application calling it? Install scripts, import-time code, and build hooks are this category.
  2. Is the new behavior explained by the package’s purpose? A downloader that downloads is different from a date parser that downloads.
  3. Is the finding alone, or does it sit next to obfuscation, impersonation, or a known indicator?

A clean static result does not erase a known threat-intelligence match, and it does not erase dangerous behavior seen when the package was executed. If those exist, the verdict keeps them. Static analysis is the check you can always explain from the files. It is not the only check.

When the files are missing

Static analysis needs the archive or an ingested copy. A name with no files can sit in the catalog, and you can still see whether the name is known, but you cannot claim the code was read. If the version matters and the catalog does not have the bytes, supply them. See A package you supply.