CLI command

probierz evaluate dependencies

Say whether the packages a product ships carry known advisories: every lockfile its repositories track, each pinned version asked of OSV.

Invocation#

Shell
probierz evaluate dependencies --app <APP_ID>

Required inputs and options#

  • --app names the product; its manifest's repositories are the checkouts read. The lockfiles read are those git tracks there, at any depth: Cargo.lock (crates from crates.io; git and path crates are the product's own source and are not asked) and package-lock.json or npm-shrinkwrap.json (npm: the packages layout of lockfile versions 2 and 3 and the nested dependencies of version 1; linked folders and file: versions are not asked). An untracked lockfile is no version the product ships and is not read.
  • Example: probierz evaluate dependencies --app shop.

Output and state effects#

Asks OSV's batch query (https://osv.dev) for every distinct version pinned, following its next page when a version has more advisories than one answer holds, and reads each advisory's record once. Prints JSON: lockfiles (each lockfile as <repository>/<path>, its ecosystem and how many packages it pins), packages (distinct versions asked), advisories (distinct advisories found), vulnerable (each affected ecosystem, name, version, the lockfiles pinning it and its advisories: id, aliases, summary, severity when the record gives one, fixed versions of that package and the advisory's url) and pass, true only when no version is affected; when it is false the command exits with the verdict refused, the result printed whole.

Exact refusals#

  • repository-unlisted (probierz.dependencies, exit 1): git cannot list the tracked files of a repository the manifest names (it is not checked out, or not a git repository), naming it and git's error. lockfiles-none (exit 1): no repository tracks a lockfile, naming them. lockfile-unreadable (exit 1): a lockfile that cannot be read, is not JSON, holds neither packages nor dependencies, a package without a version, or a [[package]] without a name or version, by its line. Nothing is asked of OSV after any of them.
  • osv-unanswered (exit 69, error code infra_down): OSV could not be reached, answered an HTTP error, an answer that is not JSON, or a batch whose results do not match the queries, naming the address and what came back; no verdict is given. Real test: tests/dependencies/audit.rs.

Declared refusals#

What probierz refusals list declares for this command at revision d2cd6156e8b8dc6204dab7b46ec0b34b2bb03cea (probierz 0.1.7 (revision unknown, not built from a git checkout)): each cause's id, the operation declaring it, its exit status and code, and its remedy.

  • verdict-failed (probierz.verdict, exit 1, refused): {point}: the run completed and its verdict at {verdict} is false, blocked by {blockers}. read the result's blockers, errors or reason: each names what to fix in the artifact, the product or the declaration, then run the command again.
  • verdict-missing (probierz.verdict, exit 1, refused): {point}: the result states no boolean verdict at {verdict}, so whether it passed is unknown. this is a defect of the command that produced the result: report it with the result shown.
  • workspace-unset (probierz.manifest.discover, exit 1, config): finding the repositories that hold product manifests: this instance names no workspace, so there is no directory of repositories to look in. run probierz config set workspace <directory holding one checkout per repository>.
  • workspace-unreadable (probierz.manifest.discover, exit 1, config): listing {workspace}: the operating system would not list it: {error}. give this user read permission on {workspace}, or set another workspace with probierz config set workspace.
  • listing-failed (probierz.manifest.discover, exit 1, config): asking the git of {repository} which manifests it tracks: {cause}. make {repository} a git repository this user can read.
  • untracked (probierz.manifest.discover, exit 1, config): reading the manifests of {repository}: {file} is not tracked by the repository's git, so no other host and no review sees it. run git -C {repository} add {relative} and commit it, or remove the file.
  • duplicate (probierz.manifest.discover, exit 1, config): finding the manifest of {app}: two repositories declare {app}: {first} and {second}. keep the manifest of {app} in the product's own repository and remove the other.
  • not-found (probierz.manifest.discover, exit 1, config): finding the manifest of {app}: no repository under {workspace} has .probierz/{app}.yaml. add .probierz/{app}.yaml to the product's repository (probierz project adopt or probierz author manifest write it), or name an app probierz apps list lists.
  • file-name-invalid (probierz.manifest.discover, exit 1, config): finding the manifests of {repository}: {file} names app "{app}", which is not an id: letters, digits, '.', '_' and '-', starting with a letter or digit. rename it .probierz/<appId>.yaml with the id it declares, with git mv.
  • repository-name-invalid (probierz.manifest.discover, exit 1, config): finding repository "{name}" in the workspace: a manifest names a checkout directly under the workspace, and "{name}" would name another place. name the checkout by its directory name under the workspace in repositories[].repository.
  • app-id-invalid (probierz.manifest.load, exit 2, refused): naming an app: "{app}" is not an id: letters, digits, '.', '_' and '-', starting with a letter or digit. name an app probierz apps list lists.
  • manifest-unreadable (probierz.manifest.load, exit 1, config): reading {file}: {error}. write {file} as YAML the reader accepts (its line and column are named), then load it again.
  • manifest-invalid (probierz.manifest.load, exit 1, config): judging {file}: {problem}. fix the declaration in {file}; probierz app check names every problem it has with the world once it loads.
  • manifest-id-mismatch (probierz.manifest.load, exit 1, config): loading the manifest of {app}: {file} is named for {app} and declares appId {declared}. declare appId: {app} in {file}, or rename the file for the app it declares with git mv.
  • repository-unlisted (probierz.dependencies, exit 1, config): listing the tracked files of {repository} at {root}: {error}. check out {repository} as a git repository under the workspace, where the manifest names it, then ask again.
  • lockfiles-none (probierz.dependencies, exit 1, config): finding the lockfiles of {app}: no repository it declares ({repositories}) tracks a Cargo.lock, package-lock.json or npm-shrinkwrap.json, so the versions it ships are written down nowhere Probierz reads. commit the lockfile the product's build writes (Cargo.lock beside its workspace's Cargo.toml, npm install --package-lock-only), then ask again.
  • lockfile-unreadable (probierz.dependencies, exit 1, config): reading the lockfile {lockfile}: {problem}. restore the lockfile from the last commit that holds it whole (git log -- {lockfile}), or as the package manager writes it (npm install --package-lock-only), and commit it, then ask again.
  • osv-unanswered (probierz.dependencies, exit 69, infra_down): asking OSV at {address}: {problem}. check that this machine reaches api.osv.dev over HTTPS (a proxy in HTTPS_PROXY is used when set), then ask again.

Source snapshot#

Generated from the Rust binaries at revision 99a74945a3598a8d73b6c6cbe5aae4f283becea3 of Probierz's private source repository.

Combined help SHA-256: 77529678a61237f774b59e76df0d1907cb749ef5da56d2ed913b040793b7d30b; binary SHA-256: be9e0eaff0e6ea50403a0c6f6d467697a4eac676f9523b8dc13a596d2b5526c5.