Pulse Beta

User guide

How-to guide

Fix vulnerabilities

How to close the findings of a project: with an upgrade to a fixed version, or with a TuxCare build of the version that you use now. The CLI makes the change, checks it, and keeps it current.

Two ways to fix #

Upgrade the packageUse a TuxCare build
What changesThe version: you move to the lowest version that fixes the advisory.The source: the same version, built by TuxCare from source with the fix added. Its version ends in -tuxcare.N (Python: +tuxcare.N).
Use it whenThe fixed version is close, and its changes do not break your code.The fix is in a new major version, or the project that made the package no longer fixes your version.
Howtuxcarectl fix writes the change for you. By hand, for a direct dependency: your package manager, with the flag that pins the exact version, for example npm install --save-exact lodash@4.17.21. For pnpm the flag is also --save-exact, and for Yarn and Bun it is --exact. Without it, package.json gets a range such as ^4.17.21. A named install also sorts the dependency list of package.json again: that is your package manager, not harden. For a transitive package, see Upgrade a package.tuxcarectl harden. See TuxCare builds.
NeedsNothing more. tuxcarectl fix needs a portal token and no TuxCare registry.A subscription with TuxCare builds.

The portal tells you which fix applies:

This page is about the packages of a project. An OS package of a server is not a dependency of a project: tuxcarectl harden and tuxcarectl fix do not change it. Its How to fix card gives the update command of the package manager of the server, for example sudo yum update nettle nettle-devel. See Update an OS package.

For a language package, the portal recommends one fix in this order:

  1. A TuxCare build of the version that you use now, for example 7.29.3-tuxcare.4 for 7.29.3. A TuxCare build fixes only the version that it was built from.
  2. Else the lowest upstream version above yours that fixes the finding.
  3. Else, when no upstream version has the fix, the TuxCare build of the nearest higher version.

Upgrade a package #

  1. Open the Fix plan tab of the repository. The packages with the worst severity come first. Inside one severity, a package with a known-exploited finding comes first.
  2. Run tuxcarectl fix, or change the version of the package with your package manager. For a transitive package, upgrade the direct dependency that pulls it in, or pin it with the mechanism of your tool: overrides for npm, pnpm, and Bun, resolutions for Yarn, a constraints file for pip, dependencyManagement for Maven, a constraints block for Gradle, a direct PackageReference for NuGet, or dependency_overrides for Dart. With Go, go get moves it. With Cargo, Composer, and Bundler, cargo update, composer update, and bundle update move it inside the ranges of its parents; outside them, a parent must move. The How to fix card gives the line or the command when one fits your tool. On npm and PyPI, do not install a transitive package by name: that adds a new direct dependency, and the copy under its parent can stay vulnerable. For a TuxCare build, tuxcarectl harden writes the override.
  3. Run your tests, and commit the manifest and the lockfile.
  4. Run tuxcarectl sca, or let the CI job run it. The finding closes when the portal gets a scan that does not have it.

The fix plan marks an upgrade to a new major version with major version. Such an upgrade can break your code. A TuxCare build avoids it.

Write the upgrade: tuxcarectl fix #

tuxcarectl fix (CLI 0.1.81 or later) writes the upstream fix for each open finding, runs the install command of your package manager, and checks the result. It needs a portal token and no TuxCare registry. It also needs no .tuxcare.yaml. On Maven and Gradle, it needs no BOM file.

tuxcarectl fix --dry-run   # print each change; write nothing
tuxcarectl fix

--dry-run prints each change that the write makes, and writes nothing in the project: your package manager runs on a temporary copy. It reads the findings as tuxcarectl sca does, so it sends the package list to your workspace when the portal has no scan of that list.

fix runs the code of the project, also with --dry-run. To compute each change, fix starts your package manager, and the package manager runs the code that the project gives it: for example the pnpmfile, the Yarn release and the Yarn plugins of the project, the Gemfile, mix.exs, Package.swift, conanfile.py, the Podfile, the cpanfile, the .Rprofile, the MSBuild and Bazel files, and the build of a Gradle or Maven project. The preview writes nothing in the project, but the tools run on its copy in the same way. --run-project-hooks does not change this. So run fix only on a project that you trust. Do not run it on a merge request from outside, or run it in a sandbox job that holds no secret.

For each package, fix writes the first change that applies:

  1. The lockfile entry, when the fix fits each range that requests the package. Your package manager chooses the version, which can be above the fix. On Bun, the lock moves to the fix, not to the newest version.
  2. The range in the manifest, with the same operator, when that range refuses the fix.
  3. A new release of the parent, when a transitive range refuses the fix and a release of each parent takes it. Except on renv, fix does not move a parent to a new major version: that is your choice. Where your tool has an override, fix writes the override, and a note names the release. Where it has none, fix leaves the finding.
  4. An override, where your tool has one, scoped so that it does not move another version of the package.

The rest of what fix does:

The tools of tuxcarectl fix #

fix covers each package manager that tuxcarectl reads: npm, pnpm, Yarn classic, Yarn Berry, Bun, Deno, uv, PDM, Poetry, Pipenv, pip, pip-tools, conda, Maven, Gradle, Cargo, NuGet, Bundler, Composer, Stack, Cabal, CocoaPods, Julia, renv, CPAN, Pub, Mix, SwiftPM, Paket, Bazel rules_jvm_external, Go modules, GitHub Actions, and Conan.

CLI 0.1.81 covers the JavaScript tools, the Python tools, Maven, Gradle, and Cargo. Each other tool needs a CLI release after 0.1.81. CLI 0.1.81 leaves the findings of such a tool with the code no_fixer, names the tool and the file to edit by hand, and ends with exit code 1.

ToolsWhat fix writesThe override
npm, pnpm, Yarn classic, Yarn Berry, Bun, DenoThe lockfile, with the tool, and the range in package.json. On Deno: the imports of deno.json.overrides on npm and Bun, the override block that your version of pnpm reads, and resolutions on Yarn. Bun also takes resolutions when the manifest declares only that block. Deno has no override.
uv, PDM, Poetry, Pipenv, pip-toolsA lower bound on the fix, name>=version, and the tool chooses the version in its lockfile. On pip-tools, the lockfile is the compiled requirements.txt.tool.uv.override-dependencies on uv and tool.pdm.resolution.overrides on PDM. The others have no override.
pippip has no lockfile: a line in the constraints file that requirements.txt reads, or in a new constraints.txt with a new -c line.None.
condaconda has no lockfile: a line of the pip: list, also for a package that a conda spec names. fix does not edit a conda spec.The pip: list.
MavenThe <version>, the property, or the dependencyManagement entry that the report names.dependencyManagement in the pom of the module. It outranks a BOM and a parent pom outside the project, and fix moves neither of them.
GradleThe coordinate, the variable, or the key of the version catalog that the report names. Then --update-locks of each gradle.lockfile.The block upstream-fix in the settings file, before the block of harden. update and unharden leave it.
Bazel rules_jvm_externalThe version in the module file, then a repin, which writes the lock file.A new entry in the artifacts list, for a transitive artifact.
Cargo, Bundler, Composer, SwiftPM, CocoaPods, Julia, CPANThe update command of the tool for the package and its parents, for example cargo update. Else the version in the declaration, with the same operator. On Julia, a package whose name two packages of Manifest.toml share (for example a fork beside the package of the General registry) gets no move: fix leaves its finding with the reason, and a parent of such a name is not given to Pkg.update either.None: when no release of a parent on its line takes the fix, fix leaves the finding.
renvrenv::install of the fix, then renv::snapshot of the package. Else the version in DESCRIPTION, with the same operator. The package whose record refuses the fix moves to its newest release, also to a new major version.None: when such a move does not take the fix, fix leaves the finding.
NuGetThe Version of the PackageReference, its VersionOverride, or the PackageVersion of Directory.Packages.props. fix does not search the releases of a parent.A direct PackageReference at the fix. Under central package management, a PackageVersion in Directory.Packages.props, and a PackageReference with no version where the PackageVersion alone moves nothing.
Pub, Mix, PaketThe update command of the tool for the package and its parents. Else the version in pubspec.yaml, mix.exs, or paket.dependencies, with the same operator.dependency_overrides on Pub, override: true on Mix, and nuget <id> == <version> on Paket.
Stack, CabalThe extra-dep line of stack.yaml, or the line of cabal.project.freeze. fix does not widen a range of your project.None.
Go modulesgo get of the module at the fix, in each module that requires it, then the vendor step of a vendored project.None. fix does not change a replace: the reason gives the edit.
GitHub ActionsThe uses: line of the workflow or of the composite action: a release tag at or above the fix. A tag of the major or the minor stays in that form when it stands at such a release. A full commit stays a full commit.None.
Conanconan.lock, the line of conanfile.txt or conanfile.py that refuses the fix, or the line of a parent on its major version (0.x: on its minor version).override=True in conanfile.py, and the key overrides of conan.lock for conanfile.txt.

fix runs your package manager, so the tool must be on the computer, also for --dry-run. tuxcarectl sca reads many lockfiles with no tool, and fix does not. So Cargo needs cargo, NuGet needs dotnet, Conan needs Conan 2, Bazel needs bazel or bazelisk, and GitHub Actions needs git. The same holds for bundle, composer, stack, cabal, pod, julia, Rscript, carton, dart, mix, swift, paket, and go. With no such tool, the run stops with exit code 5, and the message names the tool. With no npm or uv, fix leaves the finding with the code no_file.

The findings that fix leaves #

fix leaves a finding that has no single edit. It prints the reason for each one, and the file to edit by hand when there is one. --output json gives the same in fix.left, with a code. A left finding never reads as fixed. Each code gives exit code 1, with these exceptions. fixed_by_tuxcare, no_fix_planned, and live_patched do not change the exit code. A finding that TuxCare is investigating on a TuxCare build is not open, and the portal does not send it, so fix does not see it (see Findings with no fix planned). unplaced also gives exit code 1 when it is the only open finding. CLI 0.1.85 to 0.1.92 keep exit code 0 there with a warning, and so does the deprecated --on-unvouched warn.

Each finding of sca is a finding of fix, with one exception. A lockfile beside the tree of your tool can count the same package again, for example a gradle.lockfile. fix then keeps only the finding of the tree. It does this only when the tree covers the directory of the lockfile. A lockfile in a directory that the tree does not cover is a project of its own, also when the root holds the same package. For example, a website/package-lock.json below a root npm project gets the code no_file, and the reason names tuxcarectl fix --dir website. This rule needs CLI 0.1.84 or later. On a Gradle build of several projects, the finding of the gradle.lockfile of a subproject is a copy of the finding of the tree, on Gradle 8 and on Gradle 9: fix moves the package in that lockfile, and the run ends with exit code 0 (measured on Gradle 8.14.3 and 9.7.0). A subproject whose directory is outside the root is a project of its own, and its finding gets the code no_file.

CodeThe finding
no_upstream_fixThe portal names no upstream version.
several_fixesThe portal names several versions, and no comparison chooses one.
no_fileThe report names no file for the package: no lockfile, or a lockfile that no tool of this run read. For example, its tool is not on the computer, or the lockfile is a second project below the directory. The reason names the directory. Run tuxcarectl fix --dir <directory> where the tool is installed, or edit the file by hand.
pinnedThe file of the tool states the version with no range that fix can move. On NuGet: a packages.config entry.
environmentThe package is the tooling of a Python environment, or the Go toolchain. Upgrade the environment, or build with the fixed Go.
range_assumedThe change rests on a range that the CLI assumed. fix writes no edit on a guess.
manifest_rangeA declaration that fix cannot move and keep its meaning: a compound range, a tag, a URL, or an alias. On Stack and Cabal, a range of your project. On Go, a fix in another major version. On GitHub Actions, a branch or a short commit.
customer_overrideAn override that you wrote already matches the package. This includes a Go replace. fix does not replace your line.
hardenedThe project holds a TuxCare build of the package, or a pin that harden wrote. Run tuxcarectl update.
override_scopeNo key moves this copy and leaves another version as it is.
no_overrideThe tool has no override, and no parent that the project declares moves the package: Deno. On Mix and Pub: a file with no place for a new line.
no_parent_releaseNo release on the line of the parent takes the fix, and the tool has no override for it. On NuGet: the range of a parent stops below the fix.
not_movedThe tool ran, and the old version stayed. This includes a change that your package manager refused and a package that did not land: the reason keeps the line of the tool. It also includes a package that a later change of the same run took back below its fix: the reason names the later changes.
no_refGitHub Actions: git cannot read the repository, or the repository has no release tag at or above the fix.
residualThe new version landed, and a copy stayed on the old version. The run keeps the write.
fixed_by_tuxcareThe build in the project already closes the finding. fix has nothing to write.
no_fix_plannedTuxCare stated that it will not fix the finding on the build, so no version closes it. fix has nothing to write. This code needs a CLI release after 0.1.84.
live_patchedA live patch that is loaded on the host closes the finding. fix has nothing to write. This code needs a CLI release after 0.1.84.
unplacedNo step of the run placed the finding: no change and no other left finding names it. A defect of tuxcarectl. Move the package by hand. This code needs a CLI release after 0.1.84.

TuxCare builds #

TuxCare builds the open-source packages that your projects use from their source, and serves the builds from the TuxCare registry. When a vulnerability is found in a version, TuxCare adds the fix to that version and publishes a new build. TuxCare also fixes versions that the project that made them no longer maintains. A new upstream version reaches the registry only after TuxCare checks it, for example for malicious code.

The CLI moves a project to the builds in three steps: init one time for each repository, registry login one time for each computer, and harden each time you want to apply the builds.

If Renovate or Dependabot updates the dependencies of the repository, give it the rule of Renovate and Dependabot. Without the rule, the bot can replace a TuxCare build with an upstream release.

What you need #

Use the TuxCare registry, or your own repositories #

The setting Use the TuxCare registry says whether the CLI uses the TuxCare registry for the projects of the workspace. It is on by default.

The TuxCare registry needs a SecureChain or an ELS subscription. A workspace with neither gets no registry, whatever the setting says: the portal gives the CLI no registry address and no registry token, also for a repository with the value On. The CLI then gets the reason the TuxCare registry needs a SecureChain or an ELS subscription, and this workspace has neither, and the repository page shows Use the TuxCare registry: Not available with the same reason. The values of the setting stay as they are. When TuxCare adds a subscription, the values apply again: with the default, every repository uses the TuxCare registry. Contact TuxCare to add a subscription.

An admin sets the value of the workspace under Settings › Registry and CLI › Use the TuxCare registry. A repository can have a value of its own: open the repository, select More, and under Use the TuxCare registry select Workspace default, On, or Off. In a clone of the repository, tuxcarectl registry use on, off, or default does the same, and prints the value that applies now. When the workspace has neither SecureChain nor ELS, it prints the reason and stops with exit code 3. The value of the repository wins in both directions: a repository with On uses the TuxCare registry in a workspace with the value off. Only an admin can change the value of the workspace. A member or an admin of a repository can change the value of that repository: a person with the role viewer on the repository, a token of one repository or of one department (a CI token), and a TuxCare staff session cannot. A token of a person needs the permission write. The other people see the values on the repository page. The Audit log records each change as settings.registry_use.

For a token of one repository, the portal uses the value of that repository. For another token, it uses the value of a repository only when the CLI names the repository by its git remote. Else it uses the value of the workspace.

After an admin turns the setting off. The files that an earlier auth login, registry login, or init wrote still point your package managers at the TuxCare registry. Remove those lines. Each line names the registry host: the registry: line of .tuxcare.yaml names it, and on sc.tuxcare.cloud it is artifacts.tuxcare.com. git grep -n artifacts.tuxcare.com finds the lines in a repository. A registry: line that names your own mirror is your choice: keep it. While the setting is on, a new auth login writes the lines again.

The command reference lists the options of auth logout, auth login, and registry login.

Set up a project #

cd path/to/your/project
tuxcarectl init             # one time for each repository
tuxcarectl registry login   # one time for each computer

Move the project to the builds: harden #

tuxcarectl harden --dry-run   # show the plan and the changes; write nothing
tuxcarectl harden
  1. harden asks the portal which TuxCare builds your subscription has for the dependencies of the project.
  2. It writes those builds into the manifest and the lockfile.
  3. It can also change .yarnrc.yml, pnpm-workspace.yaml, or bunfig.toml, for example for the release-age excludes. Each such file gets the securechain header line as its first line. package.json and deno.json get no header, and a warning of harden names each one. unharden removes the header with the lines.
  4. It runs the install command of your package manager.
  5. It checks that each planned build is installed. If the check fails, it puts your files back and exits with code 6.
  6. It sends the new package list to your workspace.

Then run your tests, and commit the manifest, the lockfile, and each other file that harden changed.

Keep the builds current: update #

tuxcarectl update --check-only   # exit code 1 when a newer build exists; write nothing
tuxcarectl update

TuxCare publishes a new build when it fixes a new vulnerability in a version. update moves each TuxCare build of the project to the newest build of the same version, for example from 1.3.1-tuxcare.2 to 1.3.1-tuxcare.3. It installs and checks the result, as harden does. Run it on a schedule, or when the portal shows a finding that a newer build fixes.

The gate: check #

tuxcarectl check reads the installed dependencies and changes nothing. It exits with code 1 when the project is not in the state that harden made:

--explain prints the evidence and the fix for each problem.

TuxCare builds in CI #

A job that installs TuxCare builds needs the registry credential before the install step. The job does three things in this order: get the credential, install, run check.

GitHub Actions:

permissions:
  contents: read
  security-events: write
steps:
  - uses: actions/checkout@v4
  - uses: TuxCare/tuxcarectl-action@v0
    with:
      command: registry
      portal-token: ${{ secrets.TUXCARE_PORTAL_TOKEN }}
  - run: npm ci
  - uses: TuxCare/tuxcarectl-action@v0
    if: always()
    with:
      portal-token: ${{ secrets.TUXCARE_PORTAL_TOKEN }}
      registry-login: none

GitLab CI:

tuxcarectl:
  image: node:22        # any image that has curl and your package manager
  script:
    - curl -fsSL https://securechain.tuxcare.com/get/tuxcarectl | sh
    - out="$(tuxcarectl registry env --job-dir "/tmp/tuxcarectl-job-$CI_JOB_ID" --format shell)"; eval "$out"
    - env -u TUXCARE_PORTAL_TOKEN npm ci
    - tuxcarectl check --output junit > report.xml
  after_script:
    - rm -rf "/tmp/tuxcarectl-job-$CI_JOB_ID"
  artifacts:
    reports:
      junit: report.xml
include:
  - component: $CI_SERVER_FQDN/tuxcare/tuxcarectl-ci/check@0
    inputs:
      stage: test
      install: npm ci

Rules for a project with TuxCare builds #

npm: the two paths of the registry #

For npm, the TuxCare registry has two paths on one host:

So a new TuxCare build never changes what an existing lockfile installs, and the install does not fail with EINTEGRITY. pnpm and Yarn 2 or later also use /npm-upstream/ as the source: harden writes /npm/ into the lockfile entry of each build. A project that a CLI before 0.1.21 set up names /npm/ as the source of pnpm and Yarn 2 or later. The next tuxcarectl init changes it, and keeps the lockfile.

A tool that selects a version for a TuxCare build against /npm-upstream/ stops, because that path has no TuxCare builds: npm update and an install with no lockfile stop with ETARGET. On Bun, an edit of the override block has the same effect: see the rule for Bun.

Remove TuxCare builds: unharden #

tuxcarectl unharden --dry-run   # show the changes; write nothing
tuxcarectl unharden

unharden undoes init and harden. Use it when you stop the subscription, or to go back to the public packages.

Then run your tests, and commit the changed files.

Next: Malicious packages