Reference
Package managers
What the scan reads for each package manager, what a CI job must install before the scan, and the details of Python, Go, and a repository with more than one project.
What the job needs before the scan #
Run the scan in the image that builds the project, after its install step. For some package managers the CLI reads what is installed, not only the lockfile:
| Package manager | What the job needs before the scan |
|---|---|
| npm, pnpm, Yarn, Bun | The installed node_modules. Run npm ci, pnpm install --frozen-lockfile, yarn install --immutable, or bun install --frozen-lockfile. |
| pip, PDM, Pipenv, conda | The environment of the project, with the requirements installed in it. For pip, activate the virtual environment, set VIRTUAL_ENV, or keep it in .venv in the project (CLI 0.1.34 or later). An earlier CLI does not read .venv by itself: activate the environment or set VIRTUAL_ENV. From CLI 0.1.75, an installed environment comes before a uv.lock, poetry.lock, pdm.lock, or Pipfile.lock beside the requirements.txt (see Python projects). |
| Maven, Gradle, uv, Poetry | The tool on the PATH (mvn, ./gradlew or gradle, uv, poetry). The CLI asks it for the dependency tree. |
| Go, Cargo, Composer, Bundler, NuGet, and the others | Nothing. The CLI reads the lockfile. |
A job with no package manager of its own can use the image tuxcare/tuxcarectl:<version>-toolchains, which has npm, mvn, and pip. See Install the CLI.
Python projects #
A pip job must install the requirements, or the CLI finds no packages. Each job ends with tuxcarectl sca --fail-on high. Use the install line of your project in place of the one shown.
uv (GitLab CI):
tuxcarectl:
image: ghcr.io/astral-sh/uv:python3.12-bookworm
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script:
- uv sync --frozen
- curl -fsSL https://securechain.tuxcare.com/get/tuxcarectl | sh
- tuxcarectl sca --fail-on high
The line uv sync --frozen is optional. The CLI reads the packages from uv.lock, so the findings are the same without it. The line installs the packages into .venv, and the CLI reads from .venv the version ranges that each package sets for its dependencies. Without .venv, the CLI assumes a range that admits every version. Then, in the CLI report, the WHERE cell of a fix that rests on such a range ends in (range assumed)
, and the fix that it names can fail when the real range is narrower. On a large project, the install can download several hundred MB on each run. Remove the line to save the download, or keep it to get exact WHERE cells.
WHERE names the file that you change to move the package to the fixed version, not the file that holds the version. For a package that comes in through another package, this is often the override section of your package manager, for example pyproject.toml (tool.uv.override-dependencies)
, while the version is in uv.lock. add
, as in pyproject.toml (add tool.uv.override-dependencies)
, means that the section does not exist in the file yet: the fix adds it (from the CLI release after version 0.1.72).
Poetry (GitLab CI):
tuxcarectl:
image: python:3.12
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script:
- pip install poetry
- poetry install --no-root
- curl -fsSL https://securechain.tuxcare.com/get/tuxcarectl | sh
- tuxcarectl sca --fail-on high
pip (GitLab CI):
tuxcarectl:
image: python:3.12
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script:
- python -m venv .venv
- .venv/bin/pip install -r requirements.txt
- curl -fsSL https://securechain.tuxcare.com/get/tuxcarectl | sh
- tuxcarectl sca --fail-on high
- The pip job needs CLI 0.1.34 or later. That release reads the
.venvdirectory of the project whenVIRTUAL_ENVis not set. An earlier release finds no packages unless the job activates the environment. With an earlier release, add. .venv/bin/activatebeforetuxcarectl sca, or setVIRTUAL_ENV: "$CI_PROJECT_DIR/.venv"invariables. - CLI 0.1.34 or later also reads a requirements file as a lockfile when every requirement is pinned with
==and has a--hash. An--index-urlline does not change this. A fully hashed file other than the rootrequirements.txt, for exampledev-requirements.txt, is a lockfile in each run. An earlier release reads such a file only with--declared, as the requirements of the project and not as the installed versions. - When pip finds an environment, the CLI reads the installed packages from it, and not the root
requirements.txt. When pip finds no environment and the rootrequirements.txtis fully hashed, the CLI reads that file as a lockfile. With CLI 0.1.66 or later,tuxcarectl scathen exits 0 or 1 by its findings, so the job passes with the setting allow exit code 1 only. The CLI prints this note:No virtual environment: tuxcarectl read the hashed requirements.txt. Create the environment to scan what is installed.
An earlier release reads the file and prints the report, but exits with code 5, and the job fails. - Keep the virtual environment and the
pip installlines also for a fully hashed file: the CLI then reads the packages that are installed. The environment can hold packages that the file does not name, for example a package that a person installed by hand or that another requirements file installed. - When pip finds no environment and the root
requirements.txtis not fully hashed, or when there is no rootrequirements.txt,tuxcarectl scaexits with code 5, and the job fails. It also exits with code 5 when pip fails for another reason, for example when it finds an environment and cannot list its packages.
On a PyPI release line with both TuxCare build forms, tuxcarectl check and tuxcarectl harden can warn that a version range may install a .postN+tuxcare build instead of the selected +tuxcare.N build. The warning names both builds and gives the requirement that keeps the selected build.
The installed environment comes before a lockfile #
From CLI 0.1.75, the installed Python environment is the source of the scan. The scan then shows what the image or the job holds, not what a lockfile recorded at an earlier time. An earlier release reads the lockfile first. Your results can change after the upgrade when the project has both an environment and a lockfile: the report shows the versions of the environment, and no package that only the lockfile names.
- The CLI finds an environment in
VIRTUAL_ENV, inCONDA_PREFIX, or in the.venvdirectory of the project. A.venvcounts only when the machine that runs the scan made it: itspythonlinks to a Python outside the project, the project is in a git work tree, and git tracks no file of the.venv. In other cases, for example in a copy of the project with no.git, setVIRTUAL_ENV. When the CLI finds an environment and the project has arequirements.txtor arequirements.in, the CLI reads the environment. It does not read theuv.lock,poetry.lock,pdm.lock, orPipfile.lockbeside it, and uv, Poetry, PDM, and Pipenv need not be installed. A warning names each lockfile that the CLI did not read. When thepythonof the environment does not start, the CLI reads the lockfile in its place. This is also true with--ecosystem pip: each package is counted once, and you do not need--exclude uv.lock. - When the CLI finds no environment, nothing changes: the tool of the lockfile reads it, as before.
- A project with only a
pyproject.tomland auv.lock,poetry.lock, orpdm.lockstays with the tool of the lockfile, also with an environment.hardenmust change the settings of the tool that installs the build. When the tool is uv and uv is not installed, the CLI reads the environment. The CLI also warns where the lockfile and the environment disagree: see A lockfile that disagrees with the installed environment. - An environment with no pip, for example one that
python -m venv --without-piporuv venvmakes, works: the CLI reads the metadata of the installed packages. An earlier release exits with code 5. - When the CLI read the environment, a
pyproject.toml,setup.py, or requirements file of a sub-project iscovered by the environment
when the environment holds the sub-project or each package that the file lists. The report does not show it under NOT ANALYSED. A file that names no package and no project is not covered. When the environment holds neither the sub-project nor each listed package, the file stays under NOT ANALYSED, and the report names the packages that the environment does not hold. - Pipenv: when the job runs
pipenv install --system, Pipenv makes no environment of its own, andpipenv graphfails. The CLI then reads the installed environment (VIRTUAL_ENV,CONDA_PREFIX, or the.venvdirectory of the project). With no environment, the CLI readsPipfile.lock, exits with code 5, and the report says that the scan is partial, fromPipfile.lock. The portal marks the scan partial. --excludechanges only the report of one run. The scan on the portal still holds the files that it leaves out. To leave a file out of the scan too, list it underignore:in.tuxcare.yaml(see the configuration file).
A lockfile that disagrees with the installed environment #
The project with only a pyproject.toml and a uv.lock, poetry.lock, or pdm.lock is the one exception to the rule above: it keeps the tool of the lockfile, also with an installed environment, because no requirements file says that pip installs the environment. The findings of uv and Poetry then come from the lockfile, and a stale lockfile reports versions that the environment does not hold. From CLI 0.1.75, sca, check, and harden compare the lockfile with the installed packages and warn where the two disagree.
- When a warning comes. Only when the CLI finds an installed environment:
VIRTUAL_ENV,CONDA_PREFIX, or the.venvof the project, as above. With no environment, nothing is compared and no warning comes. - A version that differs. One warning for each package that the two sides hold at different versions. It names the package, the version of the lockfile, the installed version, and the environment, and it gives the command that syncs them:
uv sync,poetry sync(poetry install --syncbefore Poetry 2.0), orpdm sync --clean. Two spellings of one version agree. Withpdm.lock, a hardened install is no disagreement: an installed1.4.5+tuxcare.1agrees with a locked1.4.5. - A package that only one side holds. One warning lists the packages that only the lockfile holds, and one lists the packages that only the environment holds, each with its version. pip, setuptools, and wheel make the environment and count only where the lockfile names them. A package that the lockfile marks for another platform, for example
colorama; sys_platform == 'win32'on Linux, is on no list. A package installed in editable mode or from a directory is the project's own code and is not compared. - When the environment has no
site-packagesdirectory, for example only Debian'sdist-packages, one warning says that the run did not compare. A warning also names eachsite-packagesdirectory and each package's metadata (.dist-infoor.egg-info) that the CLI cannot read.
Go projects #
The CLI matches the Go standard library against the Go version of the build. In CI, state the toolchain with --go-toolchain 1.24.13 or with the variable TUXCARE_GO_TOOLCHAIN=1.24.13 (CLI 0.1.34 or later; a CLI before 0.1.93 reads only the old name SECURECHAIN_GO_TOOLCHAIN). The commands tuxcarectl sca, check, harden, update, status, and compare all read the variable. Without it, the CLI uses go env GOVERSION, then the toolchain line of go.mod, then the go line. An earlier release has no flag and no variable: it uses go env GOVERSION, then the go line of go.mod. With an earlier release, run the job in an image that holds the Go toolchain of your build, for example golang:1.24.13.
tuxcarectl:
image: golang:1.24
variables:
TUXCARE_GO_TOOLCHAIN: "1.24.13"
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script:
- curl -fsSL https://securechain.tuxcare.com/get/tuxcarectl | sh
- tuxcarectl sca --fail-on high
More than one project in a repository #
- Run the CLI in each project directory, or give the directory with
--dir path/to/project. The portal keeps the scans of each directory and each set of package managers apart. It calls each one a slot. - The CLI finds the package managers by itself. To choose them, use
--ecosystem npm(repeat it for more), or setecosystemsin.tuxcare.yaml. - To leave a path out of the scan, for example test fixtures, add it to
ignorein.tuxcare.yaml. - The repository page of the portal shows a Slot list when a branch has two or more slots. The repository list counts the findings of all the slots. When a new slot of the same directory replaces an old one, for example after a CLI upgrade changed the set of package managers, the old slot retires after 14 days with no scan: it leaves the counts, and the Slot list marks it retired.
Next: Terms