Pulse Beta

User guide

How-to guide

Protected Apps

TuxCare Node.js LivePatch runs the TuxCare ELS for JavaScript fixes in a running Node.js app. The section Protected Apps of the portal shows each app that runs it: the packages that the app loaded, the patches that it runs, and the vulnerabilities that still wait for a restart or an upgrade.

What a live patch does #

When Node loads a file of a package version that has a fix, the library gives Node the fixed copy of the file. The files in node_modules do not change. A fix takes effect when Node loads the file: code that the app loaded before the fix arrived runs the old code until the app restarts. A new start of the app always loads every patch.

Node.js LivePatch is an add-on of ELS for JavaScript. The section Protected Apps shows in the top bar when the add-on is on for the workspace, or when an app of the workspace reported. To turn on the add-on, contact TuxCare.

Set up an app #

  1. Make a portal token for the app. Open Access tokens (My tokens in the account menu) and choose the preset Upload only, with no repository. Keep the token in a secret of your deployment, not in the image.
  2. Add the package to the app: npm install @tuxcare/nodejs-livepatch.
  3. Load it before the app, with no change to the code of the app: NODE_OPTIONS="--require @tuxcare/nodejs-livepatch" node app.js. For an ES module app on Node 20 and later, --import @tuxcare/nodejs-livepatch does the same.
  4. Set these variables in the environment of the app:
TUXCARE_LIVEPATCH_URL
The address of your portal workspace, for example https://acme.sc.tuxcare.cloud. The library gets the patch feed from it, and reports to it. The address must be https://. The library takes an http:// address only for localhost, 127.0.0.1, and [::1], because each request carries the token. With another http:// address, the library fetches and reports nothing, and writes one line to stderr.
TUXCARE_LIVEPATCH_ALLOW_HTTP
1 or true: the library takes an http:// address on purpose. Set it only when the network between the app and the portal is private, for example to a portal that you run on premises.
TUXCARE_LIVEPATCH_KEY
The token of step 1.
TUXCARE_LIVEPATCH_APP_NAME
The name of the app in the portal. By default, the name of the package.json of the app.
TUXCARE_LIVEPATCH_K8S_CLUSTER, TUXCARE_LIVEPATCH_K8S_NAMESPACE, TUXCARE_LIVEPATCH_K8S_WORKLOAD
In Kubernetes: the cluster, the namespace, and the workload. Set all three, so that the pods of one workload are one app.
TUXCARE_LIVEPATCH_APP_ID
The id of the app in the portal. By default, the name plus where the app runs, so staging and production are two apps.
TUXCARE_LIVEPATCH_REPO
The URL of the repository of the app. The app page offers to link it (see Link a repository).
TUXCARE_LIVEPATCH_CACHE_DIR
The cache of the patch feed: an absolute path of a directory that the user of the app can write. By default, a directory in the OS temp directory, one for each app. Set one directory for each app: the cache holds the bundles of the packages of one app only. From the release after version 0.1.6, the first app that starts and can fetch the feed takes the directory. Another app then uses a folder of its own in it, and writes one line on stderr. To give the directory to another app, empty it.

From version 0.1.4, the library downloads the patch feed by package: a signed catalog of the feed, and only the bundles of the package versions that the app has. It finds them in the node_modules directories of the app, and checks the catalog and each bundle before it uses them. When the app loads a package version that the library did not find (one that you installed after the start), that load runs the original code. When the feed has a bundle for that package version, the library downloads it in the background about a minute later, and its fix comes at the next restart. When the download fails (the portal does not answer, or answers with an error), or another process of the app holds the cache at that time, the original code stays until a later fetch gets the bundle. When a bundle changes, the line of the new catalog names its earlier revisions: a library that holds one of them asks for the bundle with those revisions, and the portal can answer a delta — the new records and only the fixed files that the earlier bundle does not hold; the library takes the other files from the earlier bundle and checks each file against the new bundle, and when the delta does not give each file it asks once more for the whole bundle in the same fetch. So the cache keeps an earlier bundle while the catalog names it. From the release after version 0.1.6, a bundle that keeps failing holds back no other fix. When the portal does not have one bundle, or the bundle fails its check or a limit, the library still downloads the other bundles. At the third try of the same catalog while the app runs (about two hours after the first, when only such bundles fail), the library puts the catalog in place without the failed bundle, when it holds at least one bundle of a revision of a line of the new catalog: one that came, or one that it carried from the catalog in use. When the new catalog names the bundle that the package version ran as an earlier revision of its line, that package version keeps the earlier bundle until the new one comes. The kept bundle gives way when a bundle of the new catalog that comes later holds the same patch with other fixed bytes, another module, or other files (the same patch in another version of the package). Up to version 0.1.13, when the install would give a package version of a failed bundle any bundle other than the earlier one that it may keep, or drop that earlier bundle, the library does not install the new catalog: it keeps the catalog in use and each fix of it, and tries again later. From the release after version 0.1.13, when the new catalog does not name the bundle that a package version of a failed bundle ran (for example, the release withdrew a patch of it), that bundle stops. Such a package version, and one that ran no bundle, can then run an older bundle that the library holds and that the new catalog names for its line, when it passes its checks, until the new one comes; else it runs the original code. That release does not install the new catalog when the install would drop a bundle that ran and that the new catalog still names, or run a bundle that the new catalog does not name: it keeps the catalog in use and each fix of it, and tries again later. Each package version of a failed bundle that runs no bundle after the install stays not patched and runs the original code, the other fixes go on, and each later fetch asks for the failed bundle again. When the portal itself fails (no answer, a 5xx, a 429, a 401, or a 403), the library keeps the catalog and each fix that it has.

The cache holds the catalog and the bundles of the app. The catalog has one line of about 100 bytes for each bundle of the feed: the feed of 16 November 2026 had 1,319 bundles, and its catalog was a file of 53 KB compressed. A bundle file in that feed was 7.7 KB compressed at the median, and 1.3 MB at the most. A bundle that changed can stay next to its new revision, at most five earlier revisions, as the base of the next delta. The cache keeps the two newest catalogs, and a fetch writes a third directory before it removes the oldest. The feed grows, so check the size of the cache directory again after some months. When the OS temp directory is memory (a tmpfs), the cache counts against the memory limit of the container: set TUXCARE_LIVEPATCH_CACHE_DIR to a directory on a disk. A temp cleaner of the system can also remove files of the default cache: on EL10, systemd-tmpfiles removes the temp files that nobody read for 10 days. At the next fetch (at most about an hour) the library gets a removed bundle again, and a catalog that lost its files is fetched again too, but a load of a fixed file before that runs the original code. To keep the fixes at each load, set TUXCARE_LIVEPATCH_CACHE_DIR to a directory that no cleaner touches. A release of the library before 0.1.4 kept the whole feed in its cache. From 0.1.4, the library removes those directories after its first catalog.

The app reports a few seconds after the start, after each new feed, after each restart, and at least every 15 minutes. The report holds the name of the app, where it runs, the Node.js version, the loaded packages, and the state of each patch. It holds no source code, no request data, and no other environment value. An instance is live while its last report is less than 1 hour old.

The list of apps #

The page Protected Apps has five tiles: the apps that report and their live instances, the CVEs that are live patched, the CVEs that wait for a restart, the CVEs that are open with no patch, and the apps that the library cannot patch. Under the tiles, one row for each app shows where it runs, the Node.js version, the three counts, the live instances, and the time of the last report. Select the name of an app to open its page.

The portal checks at most 20,000 package versions of one app at a read. The row of an app that loads more says not checked in place of the three counts: its vulnerabilities are not known, and the app is not clean.

A count of Waiting for restart says when the agent restarts the app, or no restart scheduled: then use Restart now, or restart the app yourself.

Who sees the apps #

An admin, and a member or a viewer with no seat in a department, see every app. A member or a viewer with a seat in a department sees no app, and the section Protected Apps does not show for them: an app belongs to no department. A token for one repository or one department reads no app.

Not patchable #

The library cannot patch some apps. The row of such an app has the mark Not patchable and the reason under it. Such an app is not clean: its vulnerabilities stay open. The reasons:

Bundled
A bundler put the packages into the app's own files, so Node does not load them from node_modules. Examples are the output of esbuild or webpack, and a Next.js standalone build.
ES module app on an older Node.js
The app is an ES module app, and Node is older than 22.15. A fix of an ES module file needs Node 22.15 or later.
No node_modules
The app loaded no file from a node_modules directory.
Node.js version not supported
The Node.js version of the app is not a line that this version of the library supports, so the library applies no patch. The reason under the row names the lines that the library supports. Run the app on such a line, or update the library.

The page of an app #

The top of the page shows where the app runs, the linked repository, the Node.js version and the module type, the version of the agent, the serial of its patch feed next to the newest serial, the live instances, and the restart policy with its source.

When patches wait for a restart, a notice says how many, when the agent restarts the app, and the last restart. An admin can select Restart now: the agent restarts each live instance of the app once, one at a time, after the instance drains. It works under every restart policy, also Manual. Each instance reads the request at its next report.

The page has three tabs:

Patches
Each vulnerability of a loaded package: the package and its version, the vulnerability, the severity, the state (Live patched, Waiting for restart, Patch failed, Patch runs in part of the app, or Open, no patch), the patch, the live instances that run it, and the permanent fix. The portal decides the state. A vulnerability is live patched only when each live instance runs the patch. When 1 of 3 instances runs it and the other 2 wait for a restart, it waits for a restart. When the other 2 do not run it, the state is Patch runs in part of the app: the app still runs the vulnerable code there.
Loaded packages
Each package copy that the live instances loaded, with its path and the count of the instances.
Instances
Each instance of the app: live or gone, the Node.js version, the supervisor, the patches, the last restart, and the last report.

Link the app to the repository or the image that it is built from, so that the findings of that repository show the live patches. On the page of the app, an admin selects Link a repository and picks the repository. When the report of the app names a repository that the workspace has, the page offers it in one button. The portal never links an app by itself.

The restart policy #

The restart policy says what the agent does when a patch arrives for code that the app already loaded. The agent restarts one instance of an app at a time. The old instance finishes its open requests first. When a new instance does not start, the old one keeps running, and the patch shows as failed.

Immediately
Restart as soon as the patch arrives.
Urgent now, the rest in a window
The default. A patch for a CVE that is exploited (KEV) or critical restarts the app at once. The other patches wait for the window. The default window is 02:00 to 04:00 every day, in the local time of the server.
In a window only
Every patch waits for the window, also an urgent one.
Manual
The agent never restarts the app. Use Restart now, or restart the app yourself.

An admin sets the policy of the workspace in Settings › Protected Apps, and the policy of one app on its page (Change the policy). Use the workspace policy removes the policy of the app. An app can also set its policy itself, with the variable TUXCARE_LIVEPATCH_RESTART: the portal then shows Set locally, and cannot change it.

The app takes its policy and its window from the first source that sets them: the variables TUXCARE_LIVEPATCH_RESTART and TUXCARE_LIVEPATCH_RESTART_WINDOW; else the config file tuxcare-livepatch.json in the app root (the directory of the package.json of the app); else the key tuxcareLivepatch of the package.json of the app; else configure() in the code of the app. The file and the key take the keys restart and restartWindow. Each of the two values takes its own first source. A local policy with no window of its own uses 02:00 to 04:00.

The window is in the local time of the server: 02:00-04:00 every day, or with a day range or a list of days, for example Mon-Fri 02:00-04:00 or Mon,Wed,Sat 22:00-01:00. A window that ends before it starts crosses midnight.

The agent restarts an app at most 6 rounds a day. A round restarts each instance of the app once, so 20 instances that restart once are one round. The portal counts the rounds in the UTC day. A restart over the limit waits for the next day. Whatever the portal answers, also for Restart now, one instance restarts at most 12 times in its local day (two UTC days of 6 rounds), with at least 10 minutes from the start of one restart to the start of the next. Over this limit, the instance reports the health event restart_limit and waits for its next local day. When the portal does not answer (no answer, a 5xx status, or a 429), an instance does not wait for its turn: it waits a random time inside the window (up to 5 minutes for an immediate restart, an urgent patch, or Restart now), and then restarts. Only these answers make an instance restart with no turn. A refused token or a switched-off add-on (a 401 or a 403), a redirect, or an answer that the library cannot read does not restart the app: the library reports the health event internal_error with the status, and asks for a turn again after about 15 minutes.

Live patches on the findings of a repository #

A live patch closes no finding of the linked repository: the source is still vulnerable. The finding stays open in the CI gate of tuxcarectl sca, in the open counts, in the grade, and in the alerts. On Vulnerabilities, the repository page, and the finding page, an npm finding that a linked app runs a patch for has the badge Node.js LivePatch and a note, for example live patched in 2 of 3 linked apps.

When each linked app runs the patch, the fix deadline of the finding moves to the deadline of the next lower severity band (a critical finding gets the deadline of a high one), and the finding leaves the lists of exploited and critical findings. When one linked app stops running the patch, both go back. Upgrade the package for a permanent fix.

Next: Install the agent