Pulse Beta

User guide

Reference

CLI commands

The commands of the CLI (tuxcarectl), how it signs in and what that writes, the options of sca and compare, and the failure reports of the CLI.

This page describes the newest release of the CLI. A part that needs a recent release names it, for example CLI 0.1.86 or later. tuxcarectl version prints the version that you have, and names a newer release when there is one (see Upgrade the CLI).

securechain is the old name of the CLI. It still works, and so do the old env vars, file names, and packages. The new names (tuxcarectl, the TUXCARE_ variables, .tuxcare.yaml) need CLI 0.1.93 or later. Pin 0.1.94 or later: it is the first promoted release with them.

Sign in the CLI #

The CLI uses one secret: an access token of your workspace.

On your computer
Run tuxcarectl auth login. The CLI shows a link and a code, and opens the link in your browser. Sign in, check that the page shows the same code, select your workspace, select the box that says that you started this sign-in, and select Approve CLI access. If you did not accept the terms in that workspace yet, the next page shows them: select the box to accept them, and select Accept. Then approve CLI access again. TuxCare Pulse sends you an email about each new CLI sign-in. If you did not start a sign-in in that email, revoke its token on the Access tokens page. The CLI keeps the token in a file in its login folder: ~/.config/securechain on Linux ($XDG_CONFIG_HOME/securechain when that variable is set), ~/Library/Application Support/securechain on macOS, and %LocalAppData%\securechain on Windows. When TUXCARE_CACHE is set, the login folder is that directory (for its old name, see The two names of each variable). On Linux and macOS the file has mode 0600, so only your user can read it. The CLI does not use the keychain of your computer. auth login prints the path of the file in its line stored in. Over SSH, or on a computer with no browser, open the link on another device. With no terminal and nothing on standard input, for example docker run with no -i and no -t, the CLI opens no browser: it prints the link and the code, and waits while you open the link on any device. A standard input that stays open, as with docker run -i, makes the CLI wait for a token: after 2 seconds with no input, it prints a line that tells you to pipe the token, or to press Ctrl-D in a Unix terminal for the browser sign-in (see Troubleshooting).
In CI
Make a token in the portal and keep it in a masked CI variable with the name TUXCARE_PORTAL_TOKEN. The CLI reads the variable and writes the token nowhere. In a CI job, the browser sign-in does not start, and auth login with no token stops. Where standard input is not a terminal, which is the usual case in CI, it stops with exit code 3. Where standard input is a terminal, it stops with exit code 2. The message names the two ways: set TUXCARE_PORTAL_TOKEN, or pipe the token to tuxcarectl auth login --with-token. See Get started: CI/CD.
CommandWhat it does
tuxcarectl auth loginSigns in with the browser, as above. The CLI keeps one sign-in for each workspace (CLI 0.1.46 or later). A new sign-in to the same workspace replaces its old sign-in and revokes the old token. A sign-in to another workspace keeps the others. Then it writes the TuxCare registry into the files of your package managers, and lists them: see The files that auth login and registry login write.
tuxcarectl auth login --with-tokenAsks you to paste a token, in place of the browser sign-in. A token that you pipe to auth login works the same way.
tuxcarectl auth statusLists each workspace that the computer has a sign-in to. Prints the workspace that this directory uses and why, the portal address, and the subscription of the workspace (the line subscription).
tuxcarectl auth use workspaceSends the scans of this repository to that workspace. --default makes it the default workspace of the computer.
tuxcarectl auth logoutRemoves every sign-in, or with --tenant workspace the sign-in of that workspace only. It removes the token file, and revokes the token when it came from a browser sign-in. It also removes the registry credential and the registry lines, with their securechain header line, that auth login and registry login wrote. --keep-token keeps the token valid. --keep-registry keeps the registry credential and the registry lines. --tenant also keeps them.

The files that auth login and registry login write #

After the sign-in, tuxcarectl auth login also does what tuxcarectl registry login does: it writes the address of the TuxCare registry and the registry credential into the configuration files of the package managers in your home directory. It does this for the package managers of the directory where you run it. It writes nothing, for example, when the setting Use the TuxCare registry is off, when the workspace has neither SecureChain nor ELS, when the directory has no package manager, and in a CI job. The files are:

Package managerFile
npm, pnpm, Yarn 1~/.npmrc, or the file that npm_config_userconfig names. For pnpm, also its own user files, for example auth.ini.
Bun~/.npmrc, or .npmrc in XDG_CONFIG_HOME when that variable is set. With Bun 1.4.0 and later, also ~/.npmrc when XDG_CONFIG_HOME is set and holds no .npmrc: registry login reads bun --version and writes the file that Bun reads.
Yarn 2 or later~/.yarnrc.yml
pipthe user pip.conf of pip (on Linux ~/.config/pip/pip.conf, on Windows pip.ini), or the file that an absolute PIP_CONFIG_FILE names when that file exists
PDMthe user config.toml of PDM
uvthe user uv.toml of uv
pip, Pipenv, PDM, uv, Poetry~/.netrc, for the credential
Maven~/.m2/settings.xml
Gradle~/.gradle/init.d/securechain.gradle, or init.d/securechain.gradle in GRADLE_USER_HOME

These files give the registry key to your own installs. A run of harden, update, fix, or registry check with an https registry gives npm, pnpm, Yarn 1, Bun, pip, uv, PDM, Pipenv, and Poetry no key. Securechain adds the key itself to each request to the registry. A project or user CA setting that replaces the tool's CA list stops the command at exit 5. The command also refuses such settings in files above the checkout root. A readable cafile in the npm user configuration works because the run joins it with its own certificate authority.

Two cases give the tool the key in its settings for the registry host alone. The first is when the run cannot start its certificate authority or guard. The second is when a Python tool runs on a host with no system CA file and none of SSL_CERT_FILE, REQUESTS_CA_BUNDLE, or PIP_CERT supplies one. Both set TUXCARE_TOKEN to the placeholder securechain-guard-adds-the-registry-key. A project file that uses ${TUXCARE_TOKEN} for another host sends no key there. See The package tools of a run get no registry key.

With CLI 0.1.69 or later, the first line of each file that the CLI writes a registry line into tells you where the line came from and how to remove it:

# securechain wrote the TuxCare registry lines in this file. Run "securechain auth logout" to remove them.

In ~/.m2/settings.xml, the same text is an XML comment after the XML declaration:

<!-- securechain wrote the TuxCare registry lines in this file. Run "securechain auth logout" to remove them. -->

The CLI writes the Gradle init script whole. Its first lines name securechain registry login and say Delete this file to undo it. A second sign-in does not add a second header line. A file that an earlier release of the CLI wrote gets the header line at the next sign-in, and nothing else in it changes.

After the sign-in lines, the CLI lists the files that it changed, and the command that removes its lines. For example, for pip:

wrote /home/u/.config/pip/pip.conf, for pip
wrote /home/u/.netrc, for pip
the files that this login changed:
  /home/u/.config/pip/pip.conf
  /home/u/.netrc
to undo: tuxcarectl auth logout removes the registry lines from these files. It also signs this machine out of the portal.

A file that is already current is not in the list. When the run changes no file, it prints no list. If a file has a format with no comments, it gets no header line, and its line in the list ends with (no tuxcarectl header: its format has no comments). With --output json, auth login gives the list in registry_login.files (for each file: path, managers, and header) and the command in registry_login.undo.

To undo the changes:

More than one workspace #

You can sign in the CLI to more than one workspace, for example your own workspace and the workspace of your company (CLI 0.1.46 or later). Each repository then sends its scans to one workspace. The CLI selects it in this order:

  1. --tenant, the variable TUXCARE_TENANT, or the key tenant in .tuxcare.yaml.
  2. The workspace that the CLI saved for this repository on your computer.
  3. The only workspace, when the computer has a sign-in to one workspace.

When none of these applies, the CLI asks Which workspace gets the scans of this repository? and saves your answer. Without a terminal, for example in a script, it stops with exit code 3 and sends nothing. The first scan of a repository saves its workspace, so a later sign-in to another workspace does not move the repository. Each run prints the workspace on a line that starts with workspace:. To move a repository to another workspace, run tuxcarectl auth use workspace in the repository.

A CI job is not affected: it uses the token in TUXCARE_PORTAL_TOKEN.

Commands #

CommandWhat it doesWhat it changes
scaSends the package list of the project to your workspace and prints the findings.Nothing
sca vuln <id>Prints one advisory in full, as your workspace has it. For example tuxcarectl sca vuln CVE-2024-0001.Nothing
compareSends the scan and prints the findings that the latest scan of a base branch does not have. Use it for a pull request. See Pull and merge requests.Nothing
sbomWrites the package list as a CycloneDX or SPDX file. sbom --preview writes exactly what an upload sends, sends nothing, and needs no token.The file that you name
statusReports the package managers that it found, the subscription, and the packages that have a TuxCare build.Nothing
initSets up a repository for TuxCare builds. See Set up a project.Configuration files in the project
registry loginGives the package managers on this computer the credential of the TuxCare registry, and lists the files that it changed. tuxcarectl auth logout removes its lines. See The files that auth login and registry login write.Configuration files in your home directory
registry use on|off|defaultSets the setting Use the TuxCare registry of the repository of the current directory: on, off, or default (the value of the workspace applies). It prints the value that applies now. It needs the sign-in of a member or an admin of the repository (a CLI release after 0.1.67).The setting in the portal; no file
registry checkAsks the registry that the files of the project name, for example your own mirror, whether it serves the TuxCare builds, and says what to fix. It checks npm, pnpm, Yarn 1, and Bun (CLI 0.1.85 or later), and Maven, Gradle, pip, uv, Poetry, and PDM (CLI 0.1.86 or later). It does not check Yarn 2 or later, or Pipenv. See Check the mirror.Nothing
registry env --job-dir <dir>Gives the package managers of one CI job the registry credential. See A CI job that installs TuxCare builds.Files in the job directory only
fixWrites the upstream fix for each open finding, installs it, and checks the result. It needs a portal token and no TuxCare registry. It covers npm, pnpm, Yarn classic, Yarn Berry, Bun, Deno, uv, PDM, Poetry, Pipenv, pip, pip-tools, conda, Maven, Gradle, and Cargo (CLI 0.1.81 or later), and NuGet, Bundler, Composer, Stack, Cabal, CocoaPods, Julia, renv, CPAN, Pub, Mix, SwiftPM, Paket, Bazel rules_jvm_external, Go modules, GitHub Actions, and Conan (a CLI release after 0.1.81). It runs your package manager, so the tool must be on the computer: Cargo needs cargo. Where it cannot vouch that no finding stays open, it exits 1, 2, 5, or 7; the deprecated --on-unvouched warn keeps exit code 0 there until 2027-12-01 (see How a run of fix ends). See tuxcarectl fix.The manifest and the lockfile. On GitHub Actions: the workflow file
hardenChanges the project to TuxCare builds, installs them, and checks the result. See harden.The manifest and the lockfile
updateMoves each TuxCare build of the project to the newest build of the same version. See update.The manifest and the lockfile
checkThe CI gate for a project that uses TuxCare builds. See check.Nothing
guard <tool>Runs one command of npm, npx, pnpm, Yarn, Bun, bunx, pip, uv, uvx, Poetry, gem, Bundler, dotnet, mvn, gradle, go, or cargo through the guard, for example tuxcarectl guard npm install: the tool gets no known malicious version. cargo gets the crates.io filter, on each registry. The guard also runs the wrappers of a project, ./gradlew and ./mvnw (also gradlew and mvnw, the wrapper of --dir; for mvnw, maven-wrapper 3.3.0 to 3.3.4 of the type only-script), with the checks of gradle and mvn: see the wrappers. The guard refuses nuget (nuget.exe): run the restore with dotnet. The lockfile checks read the project of the tool, in each form of the option of the tool: npm -prefix and a prefix such as --prefi, pnpm -dir and --C, the variable PNPM_CONFIG_DIR of pnpm (also in guard check), go --C. For uv, --directory (else UV_WORKING_DIR) moves them first, and --project (else UV_PROJECT) moves them again, relative to it. Poetry reads --directory and --project the same way, also as -Cdir, -Pdir, or a prefix of the name. In a member directory of a uv workspace, the checks also read the uv.lock of the workspace root. The checks also read the lockfile that the tool reads above the folder of the command: for cargo the Cargo.lock of the workspace root of the nearest Cargo.toml, for Bundler the lockfile of the nearest gems.rb or Gemfile, and for go the go.mod of each module of the go.work (else the go.mod above). mvn -f and --file, and gradle -p and --project-dir, name the project. See tuxcarectl guard. A word of a dotnet command that names a project, a folder, or a solution outside --dir adds the checks of that project: guard dotnet checks each one and folds them as one check, and a malicious version of any of them gives exit code 1. CLI 0.1.94 or later.What the tool changes
guard checkStops with exit code 1 when a lockfile of the project holds a malicious version. Run it in CI before the install. See tuxcarectl guard check. It also stops with exit code 5, or 2 when the gap is of the CLI, when it cannot read a lockfile. CLI 0.1.94 or later.Nothing
guard setupMakes a plain npm install of your shells run through the guard, and each command of the other tools of guard <tool>: mvn, gradle, go (also go build and go test), and cargo (also cargo build and cargo test) too. guard setup --ci does the same for the later steps of a CI job. See Run a plain npm install through the guard and In CI. CLI 0.1.94 or later.The start files of your shells. With --ci: a new folder of the job
guard removeRemoves the block of guard setup from the start files of your shells.The start files of your shells
unhardenRemoves the TuxCare builds and the settings that init and harden wrote. See unharden.The manifest, the lockfile, and the configuration files
migrateChanges the old npm aliases npm:@els-js/… to the normal package names.The manifest
authSigns the CLI in and out. See Sign in the CLI.The token file in the login folder (see Sign in the CLI). auth login and auth logout also change the configuration files in your home directory: see The files that auth login and registry login write.
doctorChecks your environment: the package managers, the configuration, the proxy, and the connection to the portal. --bundle <path> writes a support archive, with the tokens removed. See Check your environment.The archive that you name
upgradeMoves the CLI to the promoted release. See Upgrade the CLI.The CLI
versionPrints the version of the CLI.Nothing

sca and sbom read the lockfiles of these ecosystems: npm, pnpm, Yarn, Bun, Deno, pip, uv, Poetry, PDM, Pipenv, conda, Maven, Gradle, Go, Cargo, Composer, Bundler, NuGet, Paket, Julia, Mix, Pub, SwiftPM, CocoaPods, Stack, and Cabal. harden and check work for JavaScript, Python, Maven and Gradle projects, and in part for Deno. See TuxCare builds.

Options of sca and compare #

OptionCommandWhat it does
--fail-on <severity>scaExits with code 1 when an open finding is at this severity or higher: critical, high, medium, or low. Without it, sca only reports.
--fail-on-exploitedscaExits with code 1 when an open finding is known exploited, at any severity. It combines with --fail-on: either gate fails the job. --fail-on-exploited=false turns the key fail_on_exploited off for one run. A finding that --baseline-portal skips, a finding that a TuxCare build fixes, a finding with no fix planned or a live-patched finding (see below), and a dev finding under --ignore-dev do not fail this gate. compare has no such option: run sca --fail-on-exploited beside compare --fail-on-new. CLI 0.1.80 or later. See the gate on known-exploited findings.
--base <branch>compareThe branch to compare with, for example main. Required. The base branch needs a scan of its own.
--fail-on-newcompareExits with code 1 when the scan has an open finding that the latest scan of the base branch does not have.
--min-severity <severity>scaHides the findings below this severity from the printed report. JSON and SARIF output still hold them.
--group-by <key>scaGroups the printed findings by ecosystem (the default), package, or severity.
--output <format>bothThe format of the result. sca: human (the default), json, markdown, or sarif. compare: human or json. check also writes junit. The JSON format is stable: use it in scripts.
--baseline-portalscaSkips the findings that your team ignores in the portal.
--wait <duration>bothHow long to wait for the portal to match the scan. The default is 2m for sca and 5m for compare.
--release <name>scaRecords the scan as a release with this name. An empty name stops the run with exit code 2. See Record a release.
--product-release <name>scaAlso adds the release to this product release. Needs --release.
--force-releasescaReplaces a release of the same name that another commit holds. Needs --release.
--on-portal-error warnsca, image submit, check, guard, guard checkChanges exit code 4 (the portal did not answer) to 0 with a warning. guard and guard check take fail too, and their default is fail in CI and warn on your computer: see When the portal does not answer. A signal that ends the wait for the verdicts, and a guard command that stops before the tool starts, stay exit code 4. In guard and guard check, a lockfile that the check did not read is no outage: warn does not lower it, and it stays exit code 5, or 2, also when the --timeout limit ended the wait. sca and image submit take the flag with the default fail. From CLI 0.1.97, under fail too, sca --fail-on, sca --fail-on-exploited, and image submit --fail-on exit with code 5, or 2, for a part that the run did not read (1 when a finding is at a gate), and not with code 4 for an outage at the upload, the release call, or the read of the findings: see A portal that does not answer.
--timeout <duration>allThe time limit of the whole command. The default is 20m. 0 sets no limit.
--dir <path>allThe project root. The default is the current directory.
--ecosystem <name>allUses only this package manager, for example npm. You can give the option more than one time. In sca, sbom, and compare it also takes an ecosystem family, for example golang or cargo. From version 0.1.71, a name that the CLI does not know (for example go) stops the run with exit code 2, and the message lists the names.

Findings with no fix planned, and live-patched findings #

Some findings need no step from you. The portal gives an OS package of a TuxCare build the status no_fix_planned when TuxCare stated that it will not fix the finding on that build. It gives a finding the status live_patched when a live patch that is loaded on the host closes it. sca and tuxcarectl image submit read both statuses (a CLI release after 0.1.84):

CLI 0.1.84 and earlier do not read these statuses: the run stops with exit code 4. Upgrade the CLI (see Upgrade the CLI).

A finding of an OS package of a TuxCare build that TuxCare is investigating (its VEX calls the build under investigation, and nothing else judges it) is not open either. The portal does not send it to the CLI: the report does not list it, and it never fails --fail-on. Before this status, such a finding was open. The Hosts page of the portal lists it as TuxCare is investigating.

Failure reports #

A run that ends with exit code 2, 3, 4, 5, 6, or 7 writes a failure report in cache/failure-reports/, the cache directory of the CLI (TUXCARE_CACHE). When the workspace takes reports (see Failure reports of the admin page), a later run of the same token sends the reports that wait to the portal of that token. The CLI talks to no other host. Exit 0 and exit 1 are no failure, and a run with no token, or a run that a signal stopped, writes no report. A run that the --timeout limit ended is a failure, and writes its report.

Next: .tuxcare.yaml