diff --git a/CHANGELOG.md b/CHANGELOG.md index a4cd1ae164..1730f18a45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,1033 @@ a version without a non-empty section in this file. ## [Unreleased] +## [5.2.0] — 2026-12-02 + +5.2.0 adds experimental support for projects in Bazel workspaces, the `show` +and `report` commands, and hosted and vendored patching of gems locked as +precompiled platform builds. Known limitations of this release: + +- **RubyGems: hosted mode is the recommended mode, and a gem locked as + precompiled platform builds needs a published patch for every locked + platform.** A `Gemfile.lock` that pins a gem only as platform builds + (nokogiri under a default Bundler lock) is patched in hosted and vendored + mode only when the patch service has published a patch of one fix for every + platform the lock names. Until then the run exits 0, changes nothing for + that gem and warns (`redirect_gem_platform_unsupported` in hosted mode, + `vendor_prebuilt_platform_pending` in vendored mode). At the time of this + release nokogiri's patches cover its `ruby` platform gem only, so a default + nokogiri lock is not patched in either mode yet. In the meantime agent mode + patches such a gem by rebuilding it from its source gem, which needs a C + toolchain and about a minute on each fresh install, and hosted mode patches + a lock that pins only the gem's `ruby` platform build (the plain + `nokogiri (1.18.10)` entry), which Bundler compiles at install. +- **PDM support in hosted and vendored mode is experimental.** PDM 2.29.8 + writes `lock_version = "4.6.0"`, which hosted and vendored mode refuse, and + a project patched earlier cannot be rolled back once PDM has rewritten its + lock in that format. Locks written by PDM 0.12 to 1.4 and 2.8.1 to 2.29.7 + work, and agent mode is not affected. +- **Yarn Plug'n'Play is not supported.** A Yarn project installed with the + Plug'n'Play linker is not scanned or patched in any mode + (`yarn_pnp_unsupported`; vendored mode refuses it). Set + `nodeLinker: node-modules` to patch a Yarn berry project, or use + `yarn patch ` to keep Plug'n'Play. + +### Added + +- **Bazel workspaces (experimental).** + - **Support for projects in a Bazel workspace is new and experimental.** A + project is in a Bazel workspace when its directory, or one above it up to + the root of its git checkout, holds `MODULE.bazel`, `REPO.bazel`, + `WORKSPACE` or `WORKSPACE.bazel`. There socket-patch now reads the + workspace's module files (never running Bazel) so that a patch does not + leave a Bazel build broken or silently unpatched. Everything in this group + is experimental: it is tested in CI only on the build shapes the docs + list, and what a command does, writes or says in a Bazel workspace can + change in any 5.x release. Agent mode is not supported for a project that + Bazel builds. `docs/ecosystems.md` ("Bazel workspaces: what is supported") + has a table by ecosystem and mode, and lists the known cases where a + command exits 0 and the next Bazel build still fails or takes the + unpatched package; build with Bazel before you commit a result. Nothing + changes for a project outside a Bazel workspace (#2188, #2205, #2222). + - **Maven under rules_jvm_external.** Hosted `get` and `scan` run at the + Bazel root patch a Maven artifact that a pinned hub (`maven_install.json`) + builds: one managed block in `MODULE.bazel` (`override_repo`, Bazel 7.4.0 + or later) makes the hub build the patched jar at its sha256, and + `rollback` / `remove` take the block out byte for byte. A hosted scan + finds the jars a pinned hub builds, also in a tree with no `pom.xml`, and + takes out an entry the hub's lock has moved past (`rolledBack`, reason + `maven_bazel_entry_stale`). Vendored mode (`vendor`, `scan --mode + vendored`, `get --mode vendored`) commits the patched jar under + `.socket/vendor/maven//` as a local repository and adds one entry to + `MODULE.bazel`, so the build needs no patch host. Where a hub still builds + an artifact that a patch of the run does not reach, `get`, `scan`, + `vendor` and `apply` warn `maven_bazel_hub_unpatched` (or + `maven_bazel_unreadable` when a file cannot be read) (#2157, #2163, #2191, + #2207). + - **Go.** Vendored mode names socket-patch's module copies in the Bazel + root's `.bazelignore` (creating the file when it is missing), under a + `# socket-patch:` comment line, so the build stays patched after + `bazel run //:gazelle` and `bazel build //...` passes. Commenting the + line out declines it. The module copies of agent mode get the same line + so that they cannot break the workspace, though agent mode is not + supported for a Bazel build (#2123). + - **Hosted pins a ruleset would reject are withheld.** Where hosted `scan` + and `get` used to exit 0 and leave a `bazel build` that fails, they now + write nothing for the package, report it `skipped` (exit 0), and warn with + the call's file and line and what to change: a Cargo crate while a + rules_rust `crate_universe` hub reads the project's Cargo files without + the cargo config hosted mode writes + (`redirect_cargo_bazel_config_unread`); a NuGet package while a + rules_csharp `nuget.from_lock` hub does not take its sources from the + project's `nuget.config` (`redirect_bazel_nuget_config_undeclared`); a gem + while a rules_ruby `ruby.bundle_fetch` call holds it to another sha256 in + `gem_checksums` (`redirect_bazel_gem_checksums_pinned`); and a pnpm lock + that an `npm.npm_translate_lock` call has pnpm 11 or later keep up to date + (`update_pnpm_lock`) without listing `pnpm-workspace.yaml` in its `data`, + or with the file listed while `--no-trust-lockfile-config` keeps hosted + mode from writing `trustLockfile: true` to it + (`redirect_pnpm_bazel_workspace_hidden`) (#2189, #2192, #2210, #2213, + #2232). + - **Composer.** Vendored mode declines a Composer package it would newly + vendor in a Bazel workspace (`vendor_composer_bazel_workspace`, exit 1, + nothing written), because a ruleset that installs from the lock fails on + the vendored path. The new `--allow-vendored-in-bazel` flag (env + `SOCKET_ALLOW_VENDORED_IN_BAZEL`) lifts this refusal and the PyPI, + RubyGems and NuGet ones below: the package is then vendored by its path, + as outside Bazel, for a project whose lock a hub names and which Bazel + does not build. A package that an earlier release or a run with the flag + vendored is not declined on later runs, and `vendor --revert` never is. + Hosted mode is not affected (#2186, #2208, #2223). + - **PyPI vendored mode under rules_python.** Where a `pip.parse` hub reads + the project's `requirements.txt`, the path line that vendored mode + writes fails the build of everything the hub serves. Vendored mode + (`vendor`, `scan --mode vendored`, `get --mode vendored`) now commits + the patched wheel there as a download cache of Bazel: the line of + `requirements.txt` is the one hosted mode writes (the wheel's URL and + sha256), the wheel lies under `.socket/vendor/pypi//`, and one + `common --distdir=` line in the `.bazelrc` at the Bazel root, under a + `# socket-patch:` comment, makes the build take the committed copy and + ask no host. The run warns `vendor_pypi_bazel_download_cache` with what + the form does not do (pip outside Bazel asks the patch host; run + `vendor --check` in CI), and `vendor --revert`, `rollback` and `remove` + take the line out again (`bazelrc_not_updated` when the file cannot be + written). The form is written only where the checkout shows that it + works: a hashed `requirements.txt` and no tool lock, one exact pin, a + `pip.parse` that names that file by `requirements_lock` and no other + file of the project, rules_python 2.5.0 in `MODULE.bazel.lock`, and no + downloader config in an rc file. Elsewhere under such a hub the package + is declined with `vendor_pypi_bazel_hub` (exit 1, nothing written), and + the message names the call and the condition that failed (#2208, #2212). + - **RubyGems vendored mode under rules_ruby.** Where a `ruby.bundle_fetch` + call reads the project's `Gemfile` and `Gemfile.lock`, the `path:` + source of vendored mode fails the hub's `bundle install`. Vendored mode + now commits the patched gem as the archive the patch service serves, + `.socket/vendor/gem//gems/-.gem`, and names it in + both files by the relative source `file:.socket/vendor/gem//`, + with the patched sha256 in the lock's `CHECKSUMS`; the hub builds it + with no patch host. The run warns `vendor_gem_bazel_file_source`: + Bundler outside Bazel does not install from that source, so such a + checkout builds its gems through Bazel only (hosted mode serves both). + The form is written only where the checkout shows that it builds: the + project is the Bazel root, `.bazelversion` (or `.bazeliskrc`) names a + release of Bazel 7, 8 or 9 other than 9.1.0, the lock has a `CHECKSUMS` + section or the call's `gem_checksums` hold the gem, Bundler 2.6 or + later wrote the lock, and the gem is locked as its ruby-platform entry. + Elsewhere under such a hub the gem is declined with + `vendor_gem_bazel_hub` (exit 1, nothing written). A `gem_checksums` + entry for the gem has to hold the patched sha256, which you write; an + undo leaves it and warns `vendor_gem_bazel_checksum_left` (#2208, + #2211). + - **NuGet vendored mode under rules_csharp.** A `nuget.from_lock` hub + reads the folder that vendored mode names in `nuget.config` as a URL, + and the build failed (`Bad URL`) or crashed Bazel. At the root of a + workspace whose tag reads the project's `packages.lock.json`, vendored + mode now lays the package out as a feed + (`.socket/vendor/nuget////..nupkg`) and + keeps one managed block in the root `MODULE.bazel`: a second + `nuget.from_lock` of the hub whose `feeds` list each vendored patch's + folder before the hub's own sources. The build takes the committed + package and asks no host for it, `dotnet restore` outside Bazel takes + the same file, and `vendor --revert`, `rollback` and `remove` take the + block out byte for byte. Where the checkout does not show that the + block works (the project is not the Bazel root, more than one tag, a + tag with `local_package_dirs`, `netrc` or `auth_patterns`, a + rules_csharp other than 0.5.0 in `MODULE.bazel.lock`, a `.bazelversion` + other than 9.3.2, 8.8.2 or 7.7.2, a vendor directory or a remote + downloader) the package is declined with `vendor_nuget_bazel_workspace` + (exit 1, nothing written) (#2223). + - **Hosted pnpm under aspect_rules_js goes through a named registry.** A + pnpm lock that an `npm.npm_translate_lock` hub reads is routed as it is + outside Bazel (see Changed) in the two hub shapes a routed lock was + built with: a hub that runs no pnpm (no `update_pnpm_lock`), and one + with `update_pnpm_lock = True` that lists `pnpm-workspace.yaml` in its + `data` and states a pnpm of 11.20.0 or later. The project has to be at + the Bazel root with one pnpm lock, and the call may pass only `name`, + `pnpm_lock`, `data`, `update_pnpm_lock` and `use_pnpm`. Every other hub + keeps the pin with `trustLockfile: true`, and the + `redirect_pnpm_trust_lockfile` warning names the call and what kept it + off the route (#2232). + - **Cargo vendored mode.** Under a rules_rust crate hub, a vendored crate no + longer breaks `bazel cquery //...` and `bazel query 'deps(//...)'`, and + `vendor --check`, `vex`, `repair` and a repeated `scan --mode vendored` + accept the `BUILD.bazel` that cargo-bazel writes into the copy instead of + taking the crate for a changed one (#2190). + - **VEX.** `vex` and `--vex` attest a package as `affected`, with what to + run, where a Bazel module hub builds it from a lock that does not carry + the patch: aspect_rules_js (`npm.npm_translate_lock`), rules_python + (`pip.parse`), rules_ruby (`ruby.bundle_fetch`), rules_rust + (`crate.from_cargo`), rules_csharp (`nuget.from_lock`) and + rules_jvm_external (`maven.install` with a `lock_file`). Before, a patch + that was only in the installed copy was attested `not_affected`. A + Maven patch is judged in every mode, because a pinned hub reads no + `pom.xml`, Gradle file or vendored tree: the statement is `affected` + while the hub fetches the artifact's jar and the block in the root + `MODULE.bazel` holds no entry of that patch that reaches the hub, also + after a hosted or vendored command that wrote no entry for the hub (a + `maven_bazel_*` warning). It names the `get --mode hosted` (or + `--mode vendored`) command to run at the Bazel root, or says why no + mode writes an entry. The run warns `vex_bazel_not_in_build` and `vex + --json` reports the package as skipped, not verified. A repository + that ships the installed tree rather than what Bazel builds passes + `--no-bazel` (`--vex-no-bazel` on `scan`, `apply` and `vendor`; env + `SOCKET_VEX_NO_BAZEL`) (#2159, #2224, #2236). + - **Projects that Bazel does not build are left as they were.** In a + checkout that holds a Bazel workspace file, a Composer project that is + already vendored is not declined, a workspace with no rules_jvm_external + hub adds no Maven warnings, and `SOCKET_NO_BAZEL=1` switches the Bazel + support off for the run, so every command does what it does in the same + checkout without the workspace file (#2228). +- **RubyGems.** + - **Gems locked as precompiled platform gems (such as nokogiri) in hosted + and vendored mode, on MRI and JRuby.** A `Gemfile.lock` that pins a gem + only as platform builds (`nokogiri (1.18.10-x86_64-linux-gnu)`, …, or + `java` on JRuby) can now be patched with nothing to compile. A fix for + such a gem is one patch per gem: the patch of the `ruby` gem, and for + each platform gem a patch with its own UUID and record + (`pkg:gem/nokogiri@1.18.10?platform=arm64-darwin`). The gem is moved + only when the patch service has a published patch of one fix for every + build the lock names; a lock is never patched for some of its platforms. + Hosted mode then adds `source:` to the gem's `Gemfile` declaration, + naming the patch registry of the `ruby` gem's patch, moves every + platform entry to that registry's `GEM` section and writes each + platform's sha256 into `CHECKSUMS`, after checking that the registry + serves every locked build at that sha256. `bundle install`, frozen or + not, fetches the patched platform gem of its machine, and `bundle lock + --add-platform` adds another from the same registry. Where the `ruby` + gem's patch is not available to the run, the registry of the first + locked platform's patch is used and the run warns + `redirect_gem_member_registry`. When a locked platform has no usable + patch (none published, one still being built, one withdrawn), which + includes a fix that has the `ruby` gem's patch alone, or when the + platforms are covered only by different fixes, neither file changes: + the gem is skipped with `redirect_gem_platform_unsupported`, as every + such lock was in 5.1.0, the warning names the builds with and without a + patch, the gem's advisories count as left to patch, and the run exits + 0. Vendored mode unpacks each platform's patched gem, verified against + the digest the service states, under + `.socket/vendor/gem//-//` behind one + Bundler `path:` source, also in a checkout with nothing installed. The + directory is named after the `ruby` gem's patch, or after the first + locked platform's where that one is not available; the gem then moves + once when that platform leaves the lock. While a locked platform has no + usable patch of the fix, nothing is downloaded or written, the gem is + skipped with `vendor_prebuilt_platform_pending` and the run exits 0, + where 5.1.0 refused such a gem with `platform_gem_unsupported`; a gem + that is already vendored is kept as committed + (`vendor_gem_builds_kept`). A lock that also holds the plain `nokogiri + (1.18.10)` entry, or one written by a Bundler older than 2.3, is still + refused with `platform_gem_unsupported` (exit 1), and the message names + the platforms to take out with `bundle lock --remove-platform`. Both + modes report one event per platform gem under its own patch UUID and + count the gem as one package in the summary, the run's `--vex` attests + each build by its own patch, and `get ` for one patch of such a + gem takes the fix's patch for every locked build. `rollback` and + `remove` restore the `Gemfile` and the lock byte for byte, with every + platform entry back on its upstream sha256, and put the upstream + platform gem back in an installed copy; `vendor --revert` does the same + for a vendored gem, also after `bundle lock --remove-platform` dropped + a platform. When the patch of one locked platform is withdrawn after a + hosted scan moved the gem, the next scan leaves the pair as it is and + names the `rollback` command (#2150, #2154, #2187, #2291, #2300, #2422, + #2442, #2447). + - **Agent mode rebuilds native extensions from the source gem, precompiled + gems included.** A patch to a native build input of a gem (`ext/**`, + `patches/**`, `ports/**`, build scripts) now takes effect by a real + rebuild. `apply` takes the gem's ruby-platform source gem from the gem + home's `cache/`, or downloads it from rubygems.org (or + `SOCKET_RUBYGEMS_URL`) over https and only at the sha256 the registry's + compact index records, checks that it is the installed gem's own source, + patches and builds it with RubyGems' builder in a stage directory, and + installs the result. For a precompiled platform gem the rebuilt binary is + grafted over the one Ruby loads. Before, such a patch was refused, or + reported applied while Ruby kept loading the old binary. A gem from a + private source is never downloaded, `rollback` restores the original + binaries byte for byte, and `--dry-run`, `apply --check` and `vex` still + start no Ruby. A rebuild needs a C toolchain and the libraries the gem + builds against, and can take a minute (#2098, #2112). + - **Agent mode applies gem patches on JRuby.** For the `java` build of a + gem, `apply` writes the files of a ruby-platform patch that the copy holds + and skips the C build inputs the java gem does not ship, the same tree + hosted mode installs. A patch that only changes such inputs is `skipped` + with `not_in_platform_build` and counts as in sync. A patch that changes + Java sources (`.java`, `pom.xml`, `build.gradle`, …) cannot rebuild the + gem's jars and is reported incomplete (see Changed) (#2155). +- **npm family.** + - **Vendored mode works in Rush monorepos** on pnpm 9 or later, subspaces + included; every Rush repository used to be refused with + `vendor_rush_unsupported`. Locks get paths relative to the folder Rush + installs from, transitive dependents get parent-scoped `globalOverrides` + in `pnpm-config.json`, and a direct dependent's `package.json` spec moves + to `file:` (named by `vendor_rush_package_json_edited`), so the patch + survives `rush install`, `rush update` and `rush update --full`. `vendor + --revert`, `remove`, `vex`, `vendor --check` and takeover to and from + hosted mode work on the result. A Rush repo on npm or yarn, pnpm 8 and + older locks, and shapes Rush would reject are refused before anything is + written (#2134). +- **PyPI.** + - **pixi projects.** The environments pixi installs under `.pixi/envs/` are + found without activation, so `scan --mode agent`, `apply` and `vex` patch + and attest them; `scan --global` reads `pixi global` tool environments. A + conda-built copy takes a PyPI patch only when it is a pure-Python build + whose replaced files all have the PyPI release's bytes; a compiled conda + package is never patched, whatever the flags, and is skipped with a + `conda_build_not_pypi_release` warning (`N not supported` in the summary) + without failing the run. Hosted mode still changes nothing in a pixi + project, and now says how to patch it in agent mode + (`redirect_pypi_pixi_project`) (#2166, #2183). +- **JVM.** + - **Hosted mode patches Maven reactors and `${property}` versions.** `scan + --mode hosted` used to read only the root `pom.xml`, and refused a + multi-module reactor and any declaration whose version is a `${property}`. + It now plans them as vendored mode does: a module's declaration of the + base version is rewritten where it stands, a module that reaches it + transitively gets a `` pin in the highest pom whose + modules all select it, a property only the patched artifact reads takes + the patched version, and a shared property is left alone while the one + declaration takes the literal version. `list`, `vex` and `rollback` read + every pom involved. A reactor that cannot be planned is still refused, + with the reason, and nothing written (#2114). +- **General.** + - **`socket-patch report`** tells Socket that a patch broke something: + `socket-patch report [--reason build|tests|runtime|other] + [--message ]`. It sends one `patch_reported` event with each + selected patch's UUID, ecosystem and mode, the reason and the message (on + one line, with URL credentials and the home directory redacted, at most + 1,000 characters), and no package name, path or file content. A report the + endpoint does not take fails the run (`report_not_sent`, exit 1), and + `--dry-run` prints the report and sends nothing. A targeted `rollback` of + one to three patches at a terminal ends with the command to report them + (#2193). + - **`socket-patch show `** prints a patch: the advisories it fixes, + what Socket measured about it, the files it changes and each file's diff + (`--file` to pick files, `--json` for the metadata). On a terminal it + opens full-screen, and a row of `list` opens the same page. On a terminal + `list` is now a full-screen table that fills in advisories, severity and + measurements from the patch service; pipes, `--yes` and `--verbose` keep + the printed listing (#2153). + - **A merged patch that is not published yet is named.** When a package + version has several advisories and the merged patch that fixes them + together is not ready, `scan` counts the advisories it leaves as `await a + merged patch` instead of `need a package upgrade` and says to run `scan` + again later; `get` prints the same. `scan --json` lists them in the new + `packages[].mergePendingIds` key, and `get --json` carries one + `merged_patch_pending` warning per package (#2220). + - **Experimental: a patch mirror for hosted mode behind an internal artifact + host.** `SOCKET_PATCH_MIRROR_URL` (or `--patch-mirror-url`, hidden from + `--help`) names a caching proxy of Socket's patch server, such as an + Artifactory generic remote repository, and hosted mode then writes its + pins under that base with the same path and integrity. Each new mirrored + pin is checked with one `HEAD` first (`SOCKET_PATCH_MIRROR_AUTHORIZATION` + authenticates it); Cargo and NuGet are skipped with + `redirect_mirror_unsupported`. A project already pinned on the patch + server is re-pinned onto the mirror by the same run for npm, pnpm, yarn + classic, vlt, `requirements.txt`, uv and Pipenv; a yarn berry, Bun, + Bundler, Poetry or PDM pin is left where it is with + `redirect_mirror_pin_not_moved` and the remedy. A Go pin names no host, so + a Go build lists the mirror's base first in `GOPROXY`. A package the + project installs from another repository of the mirror's host stays the + project's own source. It is tested against an Artifactory generic remote + repository with npm, pnpm, yarn classic, yarn berry, Bun, vlt, pip, uv, + PDM, Pipenv, Bundler and Go. `list`, `vex`, `rollback`, `remove`, `vendor` + and `repair` read a pin under the mirror as a hosted patch. The setting, + its variables and its `redirect_mirror_*` codes are experimental and + outside the semver policy, and `socket.yml` cannot set it. For every + hosted run, mirror or not, a pin of the same patch on a host the run was + not given is left alone (`redirect_pin_on_unconfigured_host`) (#2180, + #2255, #2256, #2282). + - **`scan --selection-filter `** (env `SOCKET_SELECTION_FILTER`), + hidden from `--help`: a versioned JSON file (`"version": 1`) that tells + one scan which paths, packages and advisories it need not patch, and which + advisories are reachable, for tools that drive socket-patch. Its format is + described in `docs/selection-filter.md` and versioned on its own rather + than by the CLI's semver policy (#2062). + - **`vex --grype-config []`** (env `SOCKET_VEX_GRYPE_CONFIG`) keeps + the `vex-documents` list of a Grype config naming the `--output` + document, so a plain `grype dir:.` run from the config's directory reads + it without `--vex`. The default is `.grype.yaml`. A missing config is + created; an existing one gains one list item and keeps every other byte. + Grype fails a scan whose listed document is missing, so a run that + leaves no document at `--output` takes the entry out again. A config the + editor cannot read with certainty (a flow list, a key named twice, + nested content) is left as it is, with a `grype_config_not_updated` + warning that names the line to add. `vex --json` reports `grypeConfig: + { path, entry, change }`, `--dry-run` writes nothing, and the flag + without `--output` is a usage error (`grype_config_requires_output`, + exit 2) (#2252). + - **A patch can fix a package's file permissions in agent mode.** A file + entry of a patch record may carry a `mode` (`"0644"`, `"0755"`), also + when the patch leaves the file's content as it is, for a release that + shipped its files group- or world-writable. The mode is an upper bound + on write bits: `apply` (and the apply step of agent-mode `get` and + `scan`) clears the group-write and other-write bits the mode lacks, + through the usual stage and rename, and reports the file with + `appliedVia: "permissions"`. No other bit is read or changed. + `apply --check` and `vex` judge a copy patched in place by the same + rule. Hosted and vendored copies are judged by their content alone, as + before. `rollback` and `remove` restore content only and keep the + tightened mode. A `mode` this release cannot read fails only its own + patch (`unreadable_file_mode`; `apply` reports `errorCode: + apply_failed` with `cause: unreadable_file_mode` before it writes any + file). Patch requests now carry `capabilities=file-modes`. Records + without a `mode` behave and serialize exactly as before, and off Unix a + `mode` changes nothing. A release that predates `mode` ignores it, reads + an entry with unchanged content as already patched, and saves the + manifest without it, so a manifest that holds a `mode` must not be + driven by an older release (#2433). + - **Hosted `scan` and `get` say which pins a run changed.** Under + `--json`, the event of each confirmed hosted pin (`applied`, or + `verified` on a dry run) carries `details.pinChanged`: `true` when the + project's dependency files show a new or updated hosted reference for + that package and patch UUID, `false` when its references stayed the + same or the run rewrote nothing, and `null` when the CLI could not tell + (for example when the final reference cannot be attributed to a package + version). A change to another package in the same lockfile does not + count (#2307). + - A `failed` apply event in `--json` output (`apply`, and the apply step + of agent-mode `get` and `scan`) keeps `errorCode: apply_failed` and adds + `cause`: `hash_mismatch`, `file_not_found`, `unsafe_path`, + `shared_store`, `conda_build`, `blob_missing`, `blob_corrupt`, + `write_failed`, `sidecar_failed`, `no_matching_variant`, a refusal's own + code, or `unclassified`. Error codes and exit codes are unchanged + (#2247). + +### Changed + +- **General.** + - **`vex` names each patched package as a product of its own,** after the + project, so Trivy and Grype match a statement by the package's PURL and + the document suppresses their findings. A platform gem is also named the + way each scanner reports it (`pkg:gem/@` and, unless the + platform is `ruby`, `pkg:gem/@-`); a name that + would stand for packages with different statuses is left out. The + project's `subcomponents` are unchanged (#2243). + - **Reworked terminal output for `scan`, `get`, `rollback`, `list` and + `vex`.** `scan` prints one row per patched package (severity, advisories, + what Socket measured about the patch, advisories left unpatched) and then + the run's totals once, including what is left to patch and why and an + estimate of the upgrade work the patches stand in for. The packages a + project patches itself are one note instead of a warning each (`--verbose` + lists them). Status lines carry an activity mark on a terminal. `get` + shows the measurements of the patches it lists, `rollback` lists what it + restored once, and `vex` groups the patches it leaves out by reason and + says how to get them installed. `--json` envelopes, warnings and events + are unchanged (#2153). + - **Plain output in an AI coding agent's terminal.** A command run by an AI + coding agent (recognized by a variable it sets, such as `AI_AGENT`, + `CLAUDECODE`, `CURSOR_AGENT`, `CODEX_SANDBOX` or `GEMINI_CLI`) gets the + output a pipe gets, on a pseudo-terminal too: no status line, color, + full-screen `list` or `show`, or arrow-key menu. `SOCKET_PLAIN=0` keeps + the terminal output, and `SOCKET_PLAIN=1` asks for the plain output + anywhere. Typed yes/no confirmations are still asked (#2153). + - **Telemetry names the patches a run acted on.** Events about patches + (`patch_applied`, `patch_vendored`, `patch_fetched`, `patch_removed`, + `patch_rolled_back` and their failures) now carry up to 50 `{uuid, + ecosystem, mode, outcome, code}` entries in `metadata.patches`, with + `patches_truncated`, per-outcome counts and the distinct ecosystems and + modes; a patch UUID identifies the package version it is for, and no + package name, path or file list is sent. Every failure event carries an + `error_code`, a failed patch's `code` is the cause of its failure, and + `metadata.failure_codes` counts the failed patches per code. Every event's + `context` carries `channel` (`npm`, `cargo`, `homebrew`, `pypi`, + `launcher_cache` or `standalone`), the install channel and never the path, + and `ci`, whether the run is in CI (`CI` or `GITHUB_ACTIONS` is set) and + never which provider, repository or job. Counts that were wrong or missing + are fixed: `scan` and `get` report agent-mode downloads, `vendor --revert` + reports what it takes out, vendor events carry `mode` and the command the + user ran, rollback events carry `dry_run` and `targeted`, `remove` sends + one event per run, and `removed_count` counts patches taken out rather + than manifest records (#2178, #2247). + - **The free tier is defined, and paid-only advisories are counted as + such.** The README and docs now say what the free tier is: every patch for + a critical vulnerability, merged patches included. An advisory on a + patched package that only a paid patch fixes now counts as `needs a paid + Socket plan` instead of `needs a package upgrade` (#2220). + - The CLI contract's semver policy now says that a subcommand or flag which + `--help` does not show and the contract does not describe can change or be + removed in any release (#2095). +- **RubyGems.** + - **A gem patch that is written but not in effect fails the run.** When a + native build exits cleanly without compiling anything the patch changes (a + gem built against the system's libxml2, a build script that downloads its + binary, a library the build finds and keeps), or a JRuby patch changes + Java sources, `apply` writes the patch's files, never attests the copy, + and exits 1 with one `Error:` line that names the sources missing from the + compiled code (`native_extension_not_rebuilt`). Before, such a build was + taken for a build of the patch, attested by `vex`, and the run exited 0 + (#2108, #2136, #2155). + - Hosted `scan` and `get` say that a newly wired gem is held at the patched + version (its only source serves no other, so `bundle outdated` drops it + and `bundle update` cannot move it), and how to move it to a newer release + (#2074). + - **Agent mode patches only the gem copies Bundler loads for the + project.** With a Bundler `path` (`bundle config set path`, + `BUNDLE_PATH`) or deployment mode, `apply`, and the apply step of `scan + --mode agent` and `get`, used to patch every copy of the gem version + they found, including copies in the shared gem homes (the system gems, + `~/.gem`, an rbenv or asdf home) that Bundler never loads for the + project and that other projects use. On a fresh clone they reported the + patch as applied while the project had no patched gem. They now write + only the copies in the project's path, plus default gems (`json`, + `uri`) and Bundler itself, which are loaded from the gem home they are + installed in. A gem that only a shared gem home holds counts as not + installed: an agent-mode scan, and `get` by name or advisory, record + nothing for it (`get --save-only` still does), and `apply` on a fresh + clone reports the gems `Gemfile.lock` lists as not found on disk and + exits 0, so run `bundle install` first. A recorded patch for a gem that + only a shared gem home holds and the lock does not list is skipped with + `gem_other_project_copy_skipped` (`not applicable` in the summary, exit + 0), and the warning names `socket-patch rollback `. `rollback` + and `remove` still restore a shared copy that holds the patch, such as + one an earlier release patched, and leave out a shared copy that holds + nothing of it instead of failing on it. A shared copy that an earlier + release patched beside the project's own copy stays patched until + `rollback --preserve-state` followed by `apply`. A project with + no Bundler `path`, one whose `vendor/bundle` holds its gems, and + `--global` runs are unchanged (#2402). +- **npm family.** + - **Hosted pnpm pins go through one named registry per patch.** On pnpm + 11.20 and later, a hosted scan routes each patched release to the patch + server through a `namedRegistries` entry (`socket-<8 hex digits of the + patch UUID>`) and an override in `pnpm-workspace.yaml`, and writes the + lock as pnpm does for that configuration. pnpm verifies those entries + itself, so no `trustLockfile: true` is written, and the patch survives + `pnpm add`, `pnpm update` and `pnpm dedupe`; as with any pnpm override, a + dependency whose range admits the patched version stays at it until the + next scan. pnpm 12 matches an `allowBuilds` approval against the id a + routed release installs under, so where `package.json` pins pnpm 12 or + later the scan repeats the approval of a routed package's install script + under that id, on a line marked `# socket-patch:`; a project pinned to + pnpm 11 needs nothing. Older pnpm, Rush projects, mirrored pins, a lock + that a Bazel hub reads in a shape no routed build was run for (see Added), + lock shapes the route cannot write, and a project that approves a routed + package's install script without pinning pnpm to one of the two majors + stay on `trustLockfile`, with a warning that names the reason. `vex` + attests a routed pin from the lock only while `pnpm-workspace.yaml` still + declares its registry and override (`patched_ref_invalid` otherwise; a + hosted re-scan declares them again), and after an install over an existing + `node_modules` it judges the store entry the project links, not the + upstream entry pnpm leaves behind. Every hosted scan, `repair`, `scan + --prune`, `rollback`, `remove` and a switch to vendored mode take out the + entries of a patch that is gone (`registry_entry_unused`, + `gc.removedRegistryEntries`), the repeated approval included, and a + registry or approval the user wrote is never touched (#2167, #2232, #2420, + #2427, #2430). +- **PyPI.** + - **A project with no environment of its own scans only its own packages.** + A project with a Python marker and no venv fell back to every interpreter + on the machine and to tool environments (`uv tool`, pipx, the Poetry + installer), and offered their packages as the project's. It now reads only + the interpreter on `PATH` (asked from the project directory, so a version + manager's shim follows `.python-version`) and, from a shared interpreter, + keeps the packages the project declares and what they require. An + interpreter on `PATH` inside a venv or a non-base conda environment is + read as the project's environment. `--global` is unchanged. A package only + pre-installed in a system Python (`pip`, `setuptools`), or installed with + an interpreter other than the one on `PATH`, is no longer offered by a + project scan (#2170). + - **Agent mode keeps `.dist-info/RECORD` in line with the files it + patches.** `apply` used to leave a distribution's `RECORD` describing + the unpatched files, and a file a patch adds had no row: tools that + verify an environment reported the files as modified, and `pip + uninstall` / `uv pip uninstall` left an added file behind. `apply` now + writes the new sha256 and size into the row of each file it replaces + and appends a row for a file it adds; `rollback` and `remove` put the + rows back, and apply then rollback leaves `RECORD` byte for byte as the + installer wrote it. Only a row that describes the file as it was before + the patch is rewritten. A `RECORD` that cannot be brought in line (an + `.egg-info` install, a symbolic link, a row somebody else changed, a + copy conda built) never fails the patch: the run keeps the + `pypi_record_stale` warning, which now ends with the reason, names the + packages (`Warning: : …`) and no longer says to run `pip check`. + `rollback` and `remove` print it too, and `remove --json` carries it in + `warnings[]`. `--json` reports the rewrite in `sidecars[]` (`action: + "rewritten"`). With `RECORD` in line, the warning that 5.1.0 printed + after every apply that wrote files is gone; a wheel in a pixi or conda + environment keeps a note that a reinstall reverts the patch + (`pypi_reinstall_reverts`). **After upgrading:** an environment that + 5.1.0 or earlier patched still has the old rows, and `apply` cannot + tell them from rows somebody else wrote. Every `apply` there, also the + one an agent-mode `scan` or `get` runs, warns `pypi_record_stale` + ("RECORD rows of files an earlier run patched do not describe them, and + were left as they are …") until you run `socket-patch rollback + --preserve-state` followed by `socket-patch apply`, or reinstall the + package and apply again. The exit code does not change (#2417). +- **JVM.** + - **A Maven patch is pinned only where Maven already selects its base + version.** Hosted and vendored scans could change which version of a + dependency a build resolves (a downgrade, a forced upgrade, a version only + an excluded path or another project's cache held) and exit 0. socket-patch + now models Maven 3's dependency mediation per module from the poms and the + local repository, without running Maven. A version no module selects is + not pinned (`redirect_maven_version_not_selected`; vendored + `vendor_maven_version_not_selected`, a `skipped` event, exit 0) and the + run names the version Maven selects instead; when the selection cannot be + told for certain (a missing pom, a profile, a Maven 4 build) no new pin is + written (`redirect_maven_selection_undetermined`). A declaration that + already names the base version is still rewritten, and agent mode is + unchanged (#2100). + - **Hosted Maven does not wire a pin behind a mirror that would take its + repository.** Before writing anything, a hosted scan reads the Maven + settings that machine's builds use (user and global `settings.xml`, `-s` / + `-gs` from `MAVEN_ARGS` or `.mvn/maven.config`, a project + `.mvn/settings.xml`) and applies Maven's `` rule to the + repository the pin would add. When a mirror would take it over, nothing is + written for the dependency and `redirect_maven_mirror_captures_repository` + names the mirror, its settings file and the ways forward; when an earlier + run's wiring is already there, it says how to take it out. A refused or + skipped Maven dependency now touches no file, and the warnings say what + the run wrote (#2135, #2165). + - **An unpatched versioned copy of a patched class in a multi-release jar + is reported.** A jar whose manifest says `Multi-Release: true` can hold + a class again under `META-INF/versions//`, which Java `` and + later load in place of the base class. Where a patch changes the base + class and not that copy, the patch was reported applied and `vex` + attested it. Now agent-mode `apply` leaves the jar patched, reports the + patch as incomplete and exits 1 (`multi_release_unpatched_copy`; + `apply --check` reports drift), vendored mode vendors the jar with a + `vendor_jvm_degraded` warning of that reason and exits 0, and `vex` + writes no statement for the package wherever it reads the jar. For a + hosted pin that is only where a build has left the suffixed jar in a + local cache; a pin whose jar no cache holds is attested from the pin, + as before. Running the command again does not clear it: it takes a + patch that lists the versioned copy. Jars nested in a Spring Boot or + war archive, and shaded copies, are not read (#2411). + - **Hosted Maven asks the Socket repository only for the patched + version.** Maven asks a `` a pom declares, before Maven + Central, for every artifact its local repository does not hold, so + each hosted pin sent the patch server a request for every dependency + of a cold build. With each pin that lands, a hosted scan now also + writes `.mvn/socket-patch/prefixes-socket-patch-.txt`, which + lists the one path that repository serves, and two lines in + `.mvn/maven.config` that switch on Maven Resolver's `prefixes` + repository filter and point it at `.mvn/socket-patch`; commit them + with the poms. Maven 3.9.2 and later, and Maven 4 in a project that + declares it, then ask the Socket repository for the patched jar and + pom only; an older Maven builds as before, unfiltered. The run that + adds the lines warns `redirect_maven_repository_filter_enabled` once, + because every build of the project then reads prefix files from that + directory only. A project that already configures the filter keeps its + configuration (`redirect_maven_repository_filter_conflict`), a filter + that cannot be written never keeps a pin from landing + (`redirect_maven_repository_filter_skipped`), and `rollback` and + `remove` take the files and the lines out again + (`maven_repository_filter_left` where they cannot). A pin that 5.1.0 + wrote is left as it is: a re-scan writes no file for it and its + repository stays unfiltered until `rollback`, then `scan` (#2133). + +### Fixed + +- **RubyGems.** + - Installed copies after an unwind: `rollback`, `remove` and `vendor + --revert` of a vendored gem now put the upstream gem back in an installed + copy that a hosted scan or agent mode had patched, also for platform gems, + and name a copy they may not replace with `upstream_gem_stale_install` + (#2113, #2122, #2175). A hosted unwind judges a copy in a gem home with no + `cache/` by its patch record instead of skipping it silently (#2130), and + works behind a private gem server named by `SOCKET_RUBYGEMS_URL` (#2233), + also one whose index writes the sha256 in base64, as a static index built + with `gem generate_index` does (#2288). Hosted rollback checks and + downloads the upstream gem over https only (#2112). + - A hosted scan over a gem that agent mode had patched in place replaces the + upstream `.gem` left in the gem home's `cache/`, which `bundle pristine` + and `bundle install --redownload` would have reinstalled from (#2103). + - Vendored mode: a gem the `Gemfile` does not declare is added with + `require: false`, so `Bundler.require` no longer loads it at boot; blocks + written by 5.1 gain the option when the gem is re-vendored (#2097). A gem + version the lock does not resolve (one Ruby ships, or another project + installed in a shared gem home) is skipped with + `vendor_gem_version_not_locked` instead of failing the run (#2079). + Un-vendoring a gem beside a hosted one puts its spec back in the right + `GEM` section of `Gemfile.lock` (#2102). A hosted gem whose patch was + superseded is vendored at the newer patch instead of failing as not + installed (#2143). + - In-place native rebuilds: `rollback` restores the libraries a gem builds + into its own tree (scrypt, digest-crc), `apply --check` and `vex` stop + attesting once one changes, and a failed build puts the whole tree back + (#2108). A gem whose build script uses up a file it ships (argon2) can be + rebuilt (#2161). A failed build shows its cause (the last 30 lines, + without mkmf's option list) and names what a precompiled gem's rebuild + needs, printed once (#2128). `scan --mode agent` and `get --mode agent` + honour `--no-gem-native-rebuild` (#2073). + - `apply` finds an installed gem that ships no `lib/` directory and no + gemspec of its own (cassandra-web) (#2185). `vex` and `apply --check` no + longer count the leftover directory of an uninstalled gem build (#2124). + An installed gem that matches no variant of its patch is reported as + `no_matching_variant` with `bundle pristine ` as the remedy, instead + of "not installed" (#2237). + - Messages and remedies: vendored refusals name their way out (#2127); a + gemspec-only gem's remedy no longer suggests `--mode vendored`, which + refuses it too (#2160); a Gemfile with several top-level `source` lines + gets a warning that names that cause and a remedy that works (#2164); an + unwind's warning for a shared gem home names the files to remove instead + of a re-run that cannot work (#2156); a native gem rollback's progress + line says it builds "from its upstream gem" (#2172); `rollback` of a gem + that was only vendored no longer says installed trees keep patched bytes + (#2215); `vex` names a remedy that works for a hosted gem whose installed + copy is still upstream (#2221); and `vex` describes how to clear a + vendored gem's leftover registry copy (#2081). + - `scan --mode vendored` no longer fails on every run over a gem that + vendored mode refuses and that was then patched in the mode the refusal + names. A gem refused for its native extension + (`native_extensions_unsupported`) or for a declaration inside a block + (`gemfile_declaration_not_editable`) that holds the selected patch in + hosted or agent mode, in every installed copy, is skipped with + `vendor_gem_patched_in_other_mode` and counted as patched, and the run + exits 0 instead of 1 (#2274, #2397). + - A hosted scan no longer reports a gem as patched, and its `--vex` no + longer attests it, when the `Gemfile` lost the gem's `source:` option + while `Gemfile.lock` kept the patch registry's section; Bundler + installs the upstream gem from such a pair. The gem is a `skipped` + event (`redirect_unconfirmed`), and the `redirect_gem_source_option` + warning names the way back: `bundle install` once without frozen mode, + then the scan again (#2408). + - `apply` updates a gem copy that holds an earlier Socket patch to a + newer patch whose record names the copy's platform + (`pkg:gem/@?platform=ruby`), instead of failing with + `no_matching_variant`. A copy of another platform, a copy with no + gemspec and a local edit are still not overwritten, and `--strict` + still refuses (#2392). + - `rollback`, `remove`, `vendor --revert` and `scan --prune` clean up a + vendored gem the project dropped (`bundle remove`, or a move to another + release). When neither the `Gemfile` nor `Gemfile.lock` names the + vendored copy, the copy and its ledger entry are removed with a + `vendor_lock_entry_removed` warning and both files stay as they are. + Before, the entry was kept as drift on every run and `vendor --check` + kept failing (#2418). + - A vendored gem's directory is committed whole. A project ignore rule + (the `.rspec` line of GitHub's `Rails.gitignore`) or a `.gitignore` the + gem ships could keep files of the copy out of the commit, so a fresh + clone failed `vendor --check` and `vex` with + `vendor_inventory_mismatch`. Every vendored gem now gets a `.gitignore` + and a `.gitattributes` in `.socket/vendor/gem//`, a shipped + `.gitignore` that hides a file of the copy is emptied + (`vendor_gem_gitignore_neutralized`), and a gem git would still not + commit in full is refused with `vendor_artifact_gitignored`. For a copy + an earlier release vendored, the next vendored run or `repair` writes + the two files and warns `vendor_gem_copy_gitignored`, naming `git add + -f`, when a file is still hidden (#2451). + - A vendored run names the `COPY .socket/vendor ./.socket/vendor` line a + Docker build needs when a `Dockerfile` or `Containerfile` in the + project root runs `bundle install` after copying only the `Gemfile` and + its lock. That layer fails with "The path … does not exist" once a gem + is vendored, and nothing said so. The note is part of the human next + steps only (#2425). + - The remedy a hosted scan prints for a stale installed gem also removes + the gem directory (`rm -rf && + bundle install`) where `rm -f` of the gemspec and archive left an + unpatched directory behind: a copy in the tree of another Ruby + (`vendor/bundle/ruby/3.2.0` beside `ruby/3.3.0`), and a gem directory + that already lost its gemspec, for which no re-run is named any more + (#2251, #2258). +- **npm family.** + - Bun: `bun.lock` version 3 (Bun 1.4.0 and later) is read; the dependencies + of a `bundleDependencies` copy are no longer rewired, vendored or + attested, since Bun installs them from the parent's tarball; a + `package.json` with comments or trailing commas is read as Bun reads it; a + package Bun trusts by default (`sqlite3`, `sharp`) with no + `trustedDependencies` is left unpatched with the way to patch it + (`redirect_bun_default_trust_skipped`, `vendor_bun_default_trust_refused`) + instead of breaking its install script; a revert with both `bun.lock` and + `bun.lockb` restores the lock Bun installs from; and `vendor --check` and + `vex` check the lock's integrity pin and the tarball's layout (#2120). + - A project whose pnpm workspace pattern names only the root (`'.'`) no + longer has every npm package skipped as project-patched when a symlink at + the root leads to a directory with a `package.json` (such as Bazel's + `bazel-` link) (#2121). + - A pnpm package that depends on a project-patched package is no longer + itself treated as patched by the project, so it gets Socket patches again + (#2153). + - pnpm 12.23 and later refuse a lock in which a package fetched from a + hosted patch depends on a vendored one + (`ERR_PNPM_LOCAL_SUBDEP_NOT_ALLOWED`, on every install). The run that + created that pair used to exit 0. It is now refused before anything is + written, on every pnpm: hosted mode leaves the package unpinned, + reports it `skipped` and warns `redirect_pnpm_local_dependency`, and + vendored mode refuses the dependency with + `vendor_lock_entry_unsupported` (exit 1). Patch both in one mode: `scan + --mode hosted` takes a vendored dependency over, and `vendor` moves + every hosted patch to vendored mode in one run (#2266). + - Vendored pnpm packages that pnpm would not install are no longer + verified. `vendor --check` exited 0 and `vex` attested a package whose + override is missing from the file the project's pnpm reads + (`package.json` before pnpm 10.5.1; from 10.5.1 through 10.x + `package.json` when it declares any override, else + `pnpm-workspace.yaml`; the workspace file alone on pnpm 11 and later), + though a frozen install fails and a plain install takes the registry + release. `vendor --check` now fails it (`wiring incomplete`, naming the + file, exit 1) and `vex` omits it (`patched_ref_invalid`, + `vendor_unwired`); re-running `vendor` declares the override again, or + the message gives the entry to add (#2396). With pnpm's `lockfile` + setting off, `vex` applies the same rule per pnpm release instead of + accepting either file for pnpm 10 (`vex_lock_not_read`, naming the map + pnpm reads) (#2441). A lock entry that pnpm 11.0.0 to 11.0.2 rewrote + without its tarball is read as the vendored entry it is: `scan --mode + vendored --prune` no longer reverts the patch, the next vendored scan + writes the entry back with or without an installed tree, and `vendor + --check` reports `wiring incomplete` with the lock and the pnpm + releases named; `vex` omits it (`vendor_unwired`) as before (#2434). + - After the `pnpm install` that a vendored scan asks for, run over an + existing `node_modules`, pnpm links the project to the patched store + entry and keeps the upstream `@` entry with nothing + linking to it. `vex` warned `vendored_tree_out_of_sync` for that + leftover, `apply --check` counted it as an installed copy, and the + reinstall the warning asked for changed nothing. An entry that no link + in the project leads into is no longer judged, also on Windows + (junctions included), under a nested `modulesDir` and where links lead + out of the project (a Bazel workspace's `bazel-*` links, a `link:` + dependency). A copy that a link reaches is still judged. Where the + links cannot all be read (`node-linker=hoisted`, `shamefully-hoist`, a + moved virtual store, a `--global` run, on Windows a link that leads out + of the project) every entry is judged as before; `pnpm prune` removes + the leftover (#2430, #2437, #2443, #2446). + - vlt: after `rollback`, `remove` or a hosted to vendored takeover, an + installed copy that could not be checked (`node_modules` is a link, or + `node_modules/.vlt-lock.json` is missing or unreadable) is reported as + that run: "restored registry pins for N packages … run `vlt ci` to be + sure the registry packages are installed", or "vendored N hosted-pinned + packages …". Both used the hosted scan's text, "vlt-lock.json pins + Socket-patched packages". The warning code and the exit codes are + unchanged (#2265). +- **PyPI.** + - A Poetry or PDM project whose lock resolves no packages and that installs + from `requirements.txt` is vendored through `requirements.txt` instead of + being refused with a remedy that rewrites the same empty lock (#2229). + - `rollback` undoes the vendoring of a PDM 0.x dependency declared with + extras (#2060). + - Agent mode no longer fails on a release whose patch has one record made + from the wheel and one from the sdist (such as urllib3 2.2.2, 2.3.0 + and 1.26.20). A wheel's install was also matched to the sdist's + record, whose files sit under `src/`, so every `scan --mode agent` and + `apply` exited 1 with "File already exists, but the patch adds it as a + new file", and a vendored scan failed on the same record. An installed + copy now takes the record of the wheel its `WHEEL` metadata names; a + record made from another artifact is used only when every file it + lists matches the copy, whatever flags are passed. This also stops + `apply` from writing another platform's compiled module over the + installed one, with exit 0, when a release has records for several + platform wheels. A copy no record matches is reported as + `no_matching_variant` and names the file (#2409). +- **Go.** + - A project scan looks up only the modules the project builds, instead + of walking the machine's module cache, in two more cases. A module + with no `go.sum` is scanned for its `go.mod` requires. A Go workspace + is scanned for what its `use` members' `go.sum` files and the + workspace's sum file record, what the members require and what the + workspace's module graph selects; a module under a `go.work` that does + not `use` it is scanned as the module it is. Before, such a scan + reported every module any project had left in `GOMODCACHE`, sent their + names to the patch service and offered each a patch. Without a + `go.sum`, the ones the build does not link were then refused: a + warning each in hosted mode, exit 1 in vendored mode. In a workspace + they failed at apply time, the scan exited 1, and their records stayed + in the manifest. A module that a Socket `replace` serves and only a + dependency requires stays in the scan after `go mod tidy` drops its + `go.sum` line, so a pruning scan no longer drops the record of a patch + the build still links. `--global` and `--global-prefix` still walk the + cache, and so does a project whose files do not describe the build (a + `-modfile`, a workspace go refuses, a sum file or member `go.mod` that + cannot be read) (#2169, #2431). + - `rollback ` and `remove ` of the record that a version + bump left behind no longer take the `replace` of the version in use. A + module has one Socket `replace`, which after a bump serves the newer + version; undoing the stale record dropped it and exited 0, so the next + build linked the unpatched module while the manifest still recorded + its patch. The undo (agent mode and `vendor --revert`) and the cleanup + of a failed apply now drop only the directives of the record's own + version or copy (#2428). +- **Cargo.** + - A lock source whose URL only contains crates.io's host + (`sparse+https://index.crates.io.evil.example/`) is no longer taken for + crates.io, and crates.io spelled the way cargo treats as the same source + (a trailing `/`, `.git`, host case) is accepted. `vex` remedies name a + lock entry by its source so the `cargo update -p` / `cargo tree -i` + commands run, and a stale entry from another registry is recognised + (#2131). + - Workspace `exclude` is read the way cargo reads it (a literal path + prefix), so a member that is also listed in `exclude` is still a member + for `vex` and hosted mode, and a run from an excluded directory under a + `.` member is not treated as its own root (#2077). + - Hosted `remove` gives back a `.cargo/config.toml` that had no final + newline byte for byte (#2078). +- **JVM.** + - The Maven Trusted Checksums line that hosted mode writes into + `.mvn/maven.config` no longer stops Maven 3.9.2 to 3.9.8 from starting a + build run with `-f` from outside the project. It uses + `${maven.multiModuleProjectDirectory}` unless the project declares Maven + 4, and any hosted scan rewrites a line an earlier release wrote (#2145). + - Agent and vendored mode read jars within the limits every package archive + now has (200,000 entries, 1 GiB inflated per pass; see General), so large + jars such as `hive-exec` can be patched, and compare a patched jar with + the original member by member, every member the JVM would load included. + `-Dmaven.repo.local` in `.mvn/maven.config` is honoured, a mismatch + refusal carries `jvm_agent_service_jar_mismatch`, and `rollback` of an + already-patched `~/.m2` copy can fetch the original from the registry + (#2132). + - A signed provider jar (such as Bouncy Castle's `bcprov`) that the patch + service patched and signed again is accepted in agent and vendored mode + (#2137). + - `vex` no longer attests a Maven patch for a reactor in which a module + keeps the unpatched jar through a version of its own. Maven reads the + version a module declares before any ``, so a + pin does not reach a module that requires the base version as a hard + range (`[1.0]`). Vendored mode pinned the root all the same, with only + a `vendor_jvm_degraded` warning (`range`), and `vex` wrote + `not_affected`. Now `vex` writes no statement and `vendor --check` + names the declaration (`vendor_jvm_unattested`); a reactor with + nothing else to wire is refused by vendored mode + (`vendor_jvm_shape_unsupported`, `nothing_wired`, exit 1) and left + alone by hosted mode. A range added under a pinned root later is + judged the same way, in vendored and hosted mode (#2393). +- **NuGet.** + - Agent mode says when a build still runs the unpatched assembly. A .NET + application loads the copy a build put in the project's output, so a + project built before `apply` kept running the old file with no signal. + `apply`, also the one an agent-mode `scan` or `get` runs, now warns + `nuget_stale_output_copies`, naming each copy under the project's + `bin` and `publish` directories that still holds the unpatched file, + until each output is rebuilt; `rollback` and `remove` warn the same + way for copies that still hold the patched file. The search is bounded + and says when it stops at a limit; a `--global` run and a dry run + search nothing, and output written elsewhere (`OutputPath`, `dotnet + publish -o`) is not seen. When a patch replaces an assembly that was + strong-name or Authenticode signed and the patched file carries no + valid signature of that kind, `apply` prints a note per package + (`nuget_assembly_signature_invalidated`, a `sidecars[]` record under + `--json`). Neither changes a status, an exit code or what `vex` + attests (#2416). +- **General.** + - A bare agent-mode `scan` from a monorepo root now warns + `projects_not_scanned`, naming the project directories below it that keep + their own install directory, instead of reporting success or "No packages + found" (#2126). + - In agent mode, a `scan` or `get` that replaces a recorded patch with one + that does not change every file of the old one rolls the old patch back + first, so no file stays patched without a record; when it cannot, the + replacement is refused (`replaced_patch_not_restored`, exit 1) (#2119). + - Commands that messages print (`rollback ` remedies, prune notes, the + stale-pin note) name a purl that works in a shell: quoted where needed, + and the base purl where `rollback` selects a pin by it (#2204). + - When socket-patch is a container's PID 1, a stop signal (`docker stop`) + now ends it at once with exit status 128 plus the signal number, instead + of waiting out the grace period; the CLI contract lists it under exit + codes (#2095). + - `--update` recognizes a `cargo install` binary on Windows or under a + symlinked home directory and refuses to replace it in place, as documented + (#2178). + - An unreadable vendor ledger (`.socket/vendor/state.json`, such as one + with a merge conflict left in it) is reported instead of being read as + an empty one. `remove ` and `rollback ` fail with + `vendor_state_unreadable` (exit 1, as before) where they answered "No + patch found" (`not_found`, `patch_not_found`, `path_glob_no_match`), + and `remove` refuses before it restores any installed file. `scan + --prune` warns `vendor_state_unreadable` and reverts and sweeps nothing + vendored, where it reported a clean pass, and `vendor --json` with no + manifest carries the same warning. A ledger that cannot be stat'd is no + longer taken for a missing one by `remove`, `rollback` and `repair` + (#2250, #2261). + - `scan --prune` reports what its vendored pass kept. A revert that + restored the lock but kept the artifact because another project file + still installs from it was reported as lock drift; it now carries + `vendor_revert_residual_reference` and names the file. A revert the + backend refused gives its reason in the human line and in the + `vendor_revert_failed` event. A vendored directory that no ledger entry + owns and a project file still installs from is reported as + `vendor_orphan_still_wired` instead of being kept without a word. Event + codes, counts and the exit code are unchanged (#2246, #2261). + - With a manifest outside a `.socket/` directory (`--manifest-path + state/patches.json`, or a bare file name), the cleanup of `repair`, + `scan --prune`, `rollback` and `remove` took `blobs/`, `diffs/` and + `packages/` beside it for socket-patch's stores and deleted the + project's own files there (a monorepo's `packages/README.md`) as unused + archives, exiting 0. Beside such a manifest the cleanup now removes + only an unreferenced file in `blobs/` named by 64 hex digits whose + bytes hash to that name, and leaves `diffs/` and `packages/` alone; a + pre-v5 archive left there is deleted by hand. Under `.socket/` nothing + changes (#2390). + - **One set of size limits for every package archive, and a limit is an + error.** npm tarballs, wheels, source distributions and `.nupkg` files + were read within limits sized for patch archives (64 MiB unpacked, + 10,000 entries, 16 MiB for one tarball member), so a wheel with a 60 + MiB extension or an npm package of 31,858 files could not be vendored + or checked, and `vendor` said the service's archive "does not carry the + patched files". Every path that reads, unpacks or downloads a package + now uses one set: 200,000 entries, 1 GiB unpacked and at most 100 times + the archive's own size once past 64 MiB, 256 MiB for a download (a + registry download was 128 MiB) and 512 MiB for a committed file. The + registry extractors of vendored mode had 60,000 entries, 512 MiB and + 128 MiB for one entry, and the inventory of a committed directory + 10,000 files. No limit is lowered. What is unpacked is held in memory. + An archive past a limit is `vendor_artifact_too_large` with the limit + named (a committed one was `vendor_artifact_unreadable`): `vendor` does + not vendor the package, `vendor --check` fails it, `vex` omits it, and + `repair` fails a download past a limit. Before, the tarball readers + took a limit for the end of the archive: `vendor --check`, `vex` and + `repair` did not see an entry past 64 MiB, and a registry tarball that + unpacks past its cap was extracted short and taken as complete (#2410). + - **Credentials in URLs that these messages quote from project files + are redacted.** A token in a URL that a message quotes from a lockfile + or a setting went to the terminal, the CI log and `--json` output. It + now reads `` in: vendored refusals (the `Cannot vendor` line, the + `[would-refuse]` preview and the event's `error`), which quote a + `Cargo.lock` source, a `yarn.lock` key or a registry; the `Cannot + restore` refusals of `rollback`, `remove` and a vendored takeover (the + sources of a `nuget.config`, the registry of a `uv.lock` or + `pylock.toml`, the URL of a failed request); the warnings of a hosted + `scan` or `get` that name a lock entry they leave alone (a `yarn.lock` + git block, a Poetry source, a requirements direct reference), on stderr + and in `warnings[].detail`; the `gradle_maven_local_undetermined` note, + which quotes the wrapper's `distributionUrl`; the notes of `vex` about + a lock entry it cannot attribute; and the messages that name the + `patchedDependencies` key of a `bun patch` made over a hosted tarball, + which holds the grant token. A message with a non-ASCII character + directly before a URL no longer crashes the run (#2445). + +### Maintenance + +- Tests on real Bazel in CI for hosted and vendored flows of every ecosystem + (#2107, #2109, #2110, #2111, #2139, #2140, #2146, #2147, #2227), Maven flows + against the live patch service and the undo of a shared pin (#2118, #2171), + and hermetic unit and integration tests kept off the host's npm, yarn, + Python, Bundler, Go, Composer and Hatch environment (#2054, #2055, #2056, + #2057, #2063, #2064, #2065, #2066, #2067). +- Other CI, test, docs and refactor work with no change in behavior: #2058, + #2061, #2071, #2094, #2099, #2116, #2141, #2142, #2148, #2173, #2176, #2179, + #2206, #2209, #2217, #2218, #2225, #2234, #2239, #2241, #2245, #2260, #2267, + #2278, #2280, #2388, #2405, #2432. + +### Performance + +- **General.** + - Scans start and finish sooner: a hosted scan paints its first line at + once, a scan of several project directories crawls them together and asks + the patch service about each package once for the run, and `vex` fetches + patch records without their file contents. On a 17-directory pnpm monorepo + a hosted scan of all directories drops from about 20 s to about 12 s and + `vex` from 12.7 s to about 5 s (#2153). +- **Cargo.** + - A hosted Cargo scan parses `Cargo.lock` once instead of several times per + patched crate (#2138). + ## [5.1.0] — 2026-11-06 ### Added diff --git a/Cargo.lock b/Cargo.lock index 25d1f4b221..e1236afc9c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1892,7 +1892,7 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "socket-patch-bench" -version = "5.1.0" +version = "5.2.0" dependencies = [ "base64", "clap", @@ -1911,7 +1911,7 @@ dependencies = [ [[package]] name = "socket-patch-cli" -version = "5.1.0" +version = "5.2.0" dependencies = [ "base64", "clap", @@ -1945,7 +1945,7 @@ dependencies = [ [[package]] name = "socket-patch-core" -version = "5.1.0" +version = "5.2.0" dependencies = [ "aho-corasick", "base64", @@ -1987,7 +1987,7 @@ dependencies = [ [[package]] name = "socket-patch-node" -version = "5.1.0" +version = "5.2.0" dependencies = [ "napi", "napi-build", diff --git a/Cargo.toml b/Cargo.toml index acbbe4672a..419ce4f9c1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,13 +14,13 @@ default-members = [ resolver = "2" [workspace.package] -version = "5.1.0" +version = "5.2.0" edition = "2021" license = "MIT" repository = "https://github.com/SocketDev/socket-patch" [workspace.dependencies] -socket-patch-core = { path = "crates/socket-patch-core", version = "=5.1.0" } +socket-patch-core = { path = "crates/socket-patch-core", version = "=5.2.0" } clap = { version = "=4.5.60", features = ["derive", "env", "wrap_help"] } serde = { version = "=1.0.228", features = ["derive"] } serde_json = { version = "=1.0.149", features = ["preserve_order", "raw_value"] } diff --git a/crates/socket-patch-cli/CLI_CONTRACT.md b/crates/socket-patch-cli/CLI_CONTRACT.md index 462004f075..a14c8e6816 100644 --- a/crates/socket-patch-cli/CLI_CONTRACT.md +++ b/crates/socket-patch-cli/CLI_CONTRACT.md @@ -28,7 +28,7 @@ For task-oriented guidance, start with [usage](../../docs/usage.md), | `remove` | — | Restore and remove one patch across hosted, vendored, and agent state; requires positional `identifier`. | | `repair` | — | Download missing agent blobs and replace corrupt ones (every referenced blob on disk is re-hashed against its git-sha256 name), redownload missing/corrupt vendored artifacts (never re-synthesizing a lost ledger), and clean up unused ones: a blob no manifest patch references (the afterHash and beforeHash blobs of every manifest patch are kept, so an offline `rollback` still has its originals; `scan --prune` keeps the same set) and every obsolete diff or package archive (refuses with `lock_held` when a live process holds the lock; see "Lock lifecycle" below). The cleanup phase also removes the pnpm registry entries of hosted patches that no lockfile uses any more, offline, from the project's files alone (see the vendored-phase section's "Registry cleanup") | -Rows are in `--help` order (v5.0): the hosted/vendored workflow (`scan` → `vex` → `vendor`, with `list` to inspect), then the agent-mode (in-place patching) commands. +Rows lead with the hosted/vendored workflow (`scan` → `vex` → `vendor`, with `list` to inspect), then the agent-mode (in-place patching) commands. `--help` lists the commands in its own order: `scan`, `get`, `show`, `list`, `remove`, `rollback`, `report`, `vex`, `vendor`, `apply`, `repair`. **Removed in v5.0:** the `setup` subcommand (see [Agent mode in CI](#agent-mode-in-ci-v50-setup-removed)). @@ -120,6 +120,7 @@ Every subcommand accepts the same set of "global" flags via a single shared `Glo | `--no-trust-lockfile-config` | — | `SOCKET_NO_TRUST_LOCKFILE_CONFIG` | `false` | bool | Opt out of hosted mode's automatic write to `pnpm-workspace.yaml`: the `namedRegistries` entries and `overrides` of the registry route, or `trustLockfile: true` (see the pnpm lockfile-verification notes under the scan arguments) | | `--no-npm-allow-remote-config` | — | `SOCKET_NO_NPM_ALLOW_REMOTE_CONFIG` | `false` | bool | Opt out of hosted mode's automatic `allow-remote=all` write to the project `.npmrc` (see the npm allow-remote note under the scan arguments). Read by `scan --mode hosted` and `get --mode hosted`; other subcommands accept it silently | | `--no-vlt-install-cleanup` | — | `SOCKET_NO_VLT_INSTALL_CLEANUP` | `false` | bool | Opt out of hosted mode's warm-tree heal for vlt: stale installed copies (`node_modules/.vlt-lock.json` and the stale `node_modules/.vlt/` entries) are left in place after `vlt-lock.json` is repointed (`scan`/`get --mode hosted`) or restored (`rollback`/`remove`), and the `redirect_vlt_reinstall_required` advisory tells you to run `vlt ci` instead. Stale copies of optional dependencies are always left in place (see `redirect_vlt_reinstall_required`). Other subcommands accept it silently | +| `--no-gem-native-rebuild` | — | `SOCKET_NO_GEM_NATIVE_REBUILD` | `false` | bool | Agent mode (`apply`, `scan`/`get --mode agent`): write a gem patch that changes native-extension sources without rebuilding the extension, for a caller that compiles it itself. Ruby keeps loading the old build until then, so `vex` and `apply --check` do not attest those patches (`native_extension_not_rebuilt`; see "Ruby gems with native extensions in agent mode"). Other subcommands accept it silently | | `--no-gem-install-refresh` | — | `SOCKET_NO_GEM_INSTALL_REFRESH` | `false` | bool | Opt out of hosted mode's gem stale-install refresh: the gems Bundler already holds for the project (an installed gem under the project and its cached `.gem`, an archive in `vendor/cache`) are left as they are after `Gemfile.lock` is repointed (`scan`/`get --mode hosted`) or restored (`rollback`/`remove`, of a hosted pin or of a vendored gem; `vendor --revert`), and the `redirect_gem_stale_install` / `upstream_gem_stale_install` warning names the files to remove by hand instead (see the "Gem stale-install guard" section). Other subcommands accept it silently | | `--gem-refresh-shared` | — | `SOCKET_GEM_REFRESH_SHARED` | `false` | bool | Extend the gem stale-install refresh to gem homes OUTSIDE the project (the system gems, `~/.gem`, an rbenv or asdf home) and to project bundle or cache paths that resolve outside the project directory. Off by default: another project on the machine may pin the other build of the same gem version, and its `bundle pristine` then fails on the replaced archive's checksum (see the "Gem stale-install guard" section). Other subcommands accept it silently | | `--allow-vendored-in-bazel` | — | `SOCKET_ALLOW_VENDORED_IN_BAZEL` | `false` | bool | **Experimental** (no stability guarantee; see [Bazel workspaces (experimental)](#bazel-workspaces-experimental)). Let vendored mode write for a package although the project is in a Bazel workspace, where the build may not find the vendored copy. Vendored mode declines such a package by default, and the switch lifts each of those refusals. `vendor_composer_bazel_workspace`, which a package meets until `packages` of the lock, or the section of the lock that holds the package, names a vendored copy: the lock then names the patched copy by a path relative to the directory Composer runs in, and a Bazel rule that runs `composer install` anywhere else fails on it. `vendor_pypi_bazel_hub` and `vendor_gem_bazel_hub`: a rules_python or rules_ruby hub of the workspace reads the lock, which then names the patched copy by a path under `.socket/vendor`, and neither ruleset builds from that. `vendor_nuget_bazel_workspace`: the package is then vendored as in a project without Bazel, which a rules_csharp hub does not take, and its build fails. For a project whose build does find the copy, does not take its packages from that lock, or which Bazel does not build. With it a PyPI package is written by its path also where vendored mode would otherwise commit its wheel as a download cache of Bazel (`vendor_pypi_bazel_download_cache`). A gem that vendored mode commits for a rules_ruby hub as an archive without the switch (`vendor_gem_bazel_file_source`) is vendored by its path with it, like every other gem. Read by `vendor`, `scan --mode vendored` and `get --mode vendored`; other subcommands accept it silently. See docs/ecosystems.md "Bazel workspaces: Composer", "Bazel workspaces: PyPI and RubyGems vendored mode" and "Bazel workspaces: NuGet" | @@ -383,7 +384,7 @@ Beyond the globals above, each subcommand defines a small set of local arguments | `scan` | `--no-socket-yml` | `SOCKET_NO_SOCKET_YML` | (v5.0) Ignore the repository's socket.yml patch policy (its `patches` block and `projectIgnorePaths`) for this run; the built-in test/fixture ignores still apply. The `policy` block reports `source: "bypassed"`. See "socket.yml patch policy". | | `scan` | `--min-severity ` | `SOCKET_MIN_SEVERITY` | (v5.0) Severity floor for the patch a package may receive (worst advisory severity; unknown severity is skipped whenever a floor is set). Beats `patches.minSeverity`; the flag beats the env; `none` lifts the floor. A malformed value is exit 2. | | `get`, `scan` | `--all-releases` | `SOCKET_ALL_RELEASES` | Download patches for every release/distribution variant of a matched package — PyPI wheel/sdist (`artifact_id`), RubyGems (`platform`), Maven (`classifier`) — not just the one(s) matching the locally-installed distribution. On `scan` this makes the stored manifest portable across environments (e.g. cross-platform CI caches). On `get` (v3.6) it ALSO disables the coarse installed-**version** narrowing of CVE/GHSA fan-outs (see "get --mode and installed narrowing"): every found version's patch is fetched, installed or not | -| `get` | positional `identifier`; `--id` / `--cve` / `--ghsa` / `--package` (`-p`); `--save-only`; `--mode ` | `SOCKET_SAVE_ONLY` | Patch lookup + consumption mode (v3.6). `--mode` reuses scan's value enum (same hidden value aliases `host`/`redirect`/`vendor`; deliberately no env binding, matching scan). Default (v5.0): the mode the project's patch state records, like scan (see **Mode resolution**), so `hosted` for a project with no state; `agent` (save + apply in place) when `--save-only` or `--global`/`--global-prefix` is given. An explicit `--mode hosted\|vendored` with `--global`/`--global-prefix` is a usage error (exit 2, scan's wording: global installs have no project lockfile). An explicit `--save-only` conflicts with `--mode hosted\|vendored` — rejected with **exit 1** via get's established self-enforced-conflict style (unlike scan's exit-2 mode conflicts; see the exit-code table) | +| `get` | positional `identifier`; `--id` / `--cve` / `--ghsa` / `--package` (`-p`); `--save-only`; `--mode ` | `SOCKET_SAVE_ONLY` | Patch lookup + consumption mode (v3.6). `--mode` reuses scan's value enum (so the hidden value aliases `host`/`redirect`/`vendor` are gone here too since v5.0, an invalid-value usage error; deliberately no env binding, matching scan). Default (v5.0): the mode the project's patch state records, like scan (see **Mode resolution**), so `hosted` for a project with no state; `agent` (save + apply in place) when `--save-only` or `--global`/`--global-prefix` is given. An explicit `--mode hosted\|vendored` with `--global`/`--global-prefix` is a usage error (exit 2, scan's wording: global installs have no project lockfile). An explicit `--save-only` conflicts with `--mode hosted\|vendored` — rejected with **exit 1** via get's established self-enforced-conflict style (unlike scan's exit-2 mode conflicts; see the exit-code table) | | `remove` | positional `identifier` (target grammar: UUID, PURL with or without version, or exact package name); `--skip-rollback`; `--preserve-state` (v5.0) | `SOCKET_SKIP_ROLLBACK`, `SOCKET_PRESERVE_STATE` | Manifest entry removal. The identifier matches like a `rollback` target (a PyPI name compares by its PEP 503 canonical form). `--preserve-state` is the single-patch twin of `rollback --preserve-state`: restore the tree and unwind the identifier's vendored/hosted wiring, but keep the manifest entry, the vendored artifact + ledger entry, and skip all GC. Combining it with `--skip-rollback` is a self-enforced usage error (exit 2): one flag keeps the tree and drops the state, the other restores the tree and keeps the state — together they select the do-nothing quadrant ("the combination would be a no-op: nothing would change"). The conflict fires whether either flag is spelled on the command line or sourced from its env var | | `rollback` | optional variadic positional `targets` (PURL \| UUID \| package name \| path glob); `--preserve-state` (v5.0) | `SOCKET_PRESERVE_STATE` | Rollback scope. Multiple targets union. A token becomes a path glob ONLY when it is path-SHAPED — contains a separator (`/` or `\`) or a glob metacharacter (`*?[`), or starts with `./`, or is absolute (an npm `@scope/name` is a name, not a path; a relative slash name without glob metacharacters or `.`/`..` segments — composer `vendor/pkg`, a go module path — is a name when it selects a recorded or hosted patch); a `pkg:` prefix is a PURL and every other token keeps the target grammar (UUID, PURL or exact package name), so a mistyped identifier or truncated UUID stays a safe exit-1 "No patch found matching identifier: X" (with a hint suggesting `./X` or `X/**` for directory targeting) instead of silently becoming a path scope. An unparseable glob is a usage error (exit 2) | | `vex` | `--output` / `-O`, `--product`, `--no-verify`, `--no-bazel`, `--doc-id`, `--compact`, `--grype-config []` | `SOCKET_VEX_OUTPUT`, `SOCKET_VEX_PRODUCT`, `SOCKET_VEX_NO_VERIFY`, `SOCKET_VEX_NO_BAZEL`, `SOCKET_VEX_DOC_ID`, `SOCKET_VEX_COMPACT`, `SOCKET_VEX_GRYPE_CONFIG` | OpenVEX 0.2.0 document generation; see "vex output channels" below. `--grype-config` lists the document in a Grype config (see "Grype config" below). `--no-bazel` is **Experimental** (Bazel workspaces) | @@ -458,7 +459,7 @@ The route is taken only when **all** of these hold; otherwise the run takes the `socket-patch report ... [--reason ] [--message ]` tells Socket that the patches named broke something, so a patch that breaks projects is found and fixed or withdrawn. There is no report that a patch works. It reads which patches the project holds (to turn a PURL or a package name into a patch), sends one request, and changes nothing: it takes no lock and writes no file. To take the patch off, use `rollback`. -- **What is sent.** One `patch_reported` event, on the route the run's telemetry takes (see [Telemetry](#telemetry)): for each patch its UUID, its ecosystem and the mode the project holds it in (`agent`, `hosted`, `vendored`, or `unknown` with an empty ecosystem for a UUID the project does not hold), the reason (`breaks_build`, `breaks_tests`, `breaks_runtime`, `other`), the message when one was given, and the `context` every event carries (CLI version, platform, architecture, install channel). Never a package name, a path or a file's contents. A patch is named once, however many targets reach it. One report names at most 50 patches and never leaves one out: more is `too_many_patches` (exit 1, nothing sent), and where a full list and a long message together would exceed the event's size, the message is cut further and the list is not. +- **What is sent.** One `patch_reported` event, on the route the run's telemetry takes (see [Telemetry](#telemetry)): for each patch its UUID, its ecosystem and the mode the project holds it in (`agent`, `hosted`, `vendored`, or `unknown` with an empty ecosystem for a UUID the project does not hold), the reason (`breaks_build`, `breaks_tests`, `breaks_runtime`, `other`), the message when one was given, and the `context` every event carries (CLI version, platform, architecture, install channel, and whether the run is in CI). Never a package name, a path or a file's contents. A patch is named once, however many targets reach it. One report names at most 50 patches and never leaves one out: more is `too_many_patches` (exit 1, nothing sent), and where a full list and a long message together would exceed the event's size, the message is cut further and the list is not. - **Which patch of a package.** Where the project holds patches for one package version in several modes, the report names the one the build consumes: the vendored artifact, else the hosted pin, else the agent manifest's record, each under its own UUID and mode. A patch that is both recorded in the manifest and vendored is reported as vendored, and a manifest record the vendored artifact has replaced is not reported. A vendor ledger entry is matched by its key or its base PURL, with or without an embedded record. A store that cannot be read holds nothing: a UUID is still reported, and a PURL or a name that then matches nothing fails with that store's error (`manifest_invalid`, `manifest_unreadable`, `vendor_state_unreadable`) instead of `patch_not_found`. - **Not telemetry.** A report is something the user asked to send, so the telemetry opt-outs (`--no-telemetry`, `SOCKET_TELEMETRY_DISABLED`, `SOCKET_PATCH_TELEMETRY_DISABLED`, `DO_NOT_TRACK`, `VITEST`) do not stop it. `--offline` / `SOCKET_OFFLINE` does: the run makes no request and fails with `offline_unsupported` (exit 1). - **Delivery.** Unlike a telemetry event, the run waits for the answer (2 s to connect, 5 s in all). Anything but a success is a failed run: `report_not_sent`, exit 1, `Error: The report was not sent: the request returned status 500 Internal Server Error`; a request that got no answer says why (`the request failed: …`, with the cause: a refused connection, a DNS or TLS failure, a timeout). One case is retried, once: a token the org endpoint refuses (401 or 403: expired, revoked, or without access to the org) sends the same report again without the token, on the public route an anonymous run uses, so a stale saved login does not cost the report. Nothing else is retried, and a failed report leaves nothing behind to send later. @@ -501,7 +502,7 @@ Pinned by `tests/scan/scan_proxy_fallback_e2e.rs`, `tests/cli/api_client_errors_ **Throttling: bounded retry, then a reported failure.** Every patch-API JSON call (the batch query, the per-package patch lists, patch views and VEX record fetches, hosted package references) retries an HTTP `429` or `503` answer up to 3 times (`SOCKET_API_MAX_RETRIES=`, `0`-`10`; `0` = no retry). The wait honors `Retry-After` (delta-seconds or HTTP-date); a `Retry-After` over 30 s is not waited out — the answer is final at once — and one under the jittered first backoff step (`0`, a past date) waits that step instead. Without one it backs off 0.5 s / 1 s / 2 s (each step up to 8 s, with jitter in its upper half). All retries in one run share a 60 s wall-clock window that opens with the run's first retry: a retry whose wait would end after it closes is refused and the answer is final. Parallel requests wait in parallel, so each still gets its retries while the run adds at most about 60 s. Nothing else is retried (401/403 still drive the proxy fallback on the first answer; the public proxy's permanent `503 "Patch API is not configured"` is never retried on any path — the batch query still degrades to the per-package path at once, and a per-package lookup or patch view answering it is the same non-throttle failure it always was, which on the legacy per-package path leaves that package unanswered, see above), and a retried answer folds exactly where the first attempt's would have, so output is identical to an unthrottled run's. A request still throttled after that is a failure in the channel its siblings use: a failed batch is the human `Warning: API batch of failed: ` line and, under `--json`, a run-level `warnings[]` entry `{code: "api_batch_failed", detail: "API batch of failed: "}` (additive; `status` stays `success`, exit 0 — the other batches' packages are reported); a failed per-package patch-list query in the agent / hosted / vendored flows is the human `Warning: could not fetch details for : ` line and, under `--json`, `{code: "patch_details_failed", detail: "could not fetch details for : "}`. When every batch (or every patch-list query) fails, the existing all-failed error envelope and exit 1 apply. The error names the exhausted retry: `Rate limit exceeded (HTTP 429, gave up after 3 retries). Please try again later.` / `API request failed with status 503: (gave up after 3 retries)` (or `(Retry-After s exceeds the 30 s retry cap)` / `(the run's 60 s retry window has closed)`); with retries off it is the pre-retry text. On the token-less legacy per-package proxy path (a proxy without `POST /patch/batch`), a package still throttled (429 / over-capacity 503) after its retries is an unanswered package (see "No patches" needs an answer above): the batch's answered packages are used and it is reported as `patch_lookup_failed` (`partialFailure`, exit 1); when it leaves no package of its batch answered, the batch fails through the batch-failure channel above. Only a PURL the service itself refuses (its own `400`) is skipped individually. Pinned by `tests/scan_api_retry_e2e.rs` and the core crate's `tests/api_retry_e2e.rs`. -**Lockfile supplement (v3.4)**: `scan` discovery is no longer limited to installed trees. The project's lockfiles (`package-lock.json`/`npm-shrinkwrap.json`, `pnpm-lock.yaml` v9, `yarn.lock` classic + berry, `bun.lock`, `vlt-lock.json` (registry nodes, Socket-hosted pins included; vendored `file` nodes are left to the vendor ledger), `Cargo.lock`, `go.sum`, `composer.lock`, `Gemfile.lock`, `uv.lock`/`poetry.lock`/pinned `requirements.txt`) are inventoried and dependencies with NO installed copy join discovery — counts, the API lookup, the rows of what a hosted or vendored run patches (an agent or report-only run, which patches installed copies, gets a stderr note that they are not installed), and the prune "scanned" set (a wiped node_modules no longer prunes lockfile-listed entries). JSON gains a top-level `lockfileOnlyPackages` count and an additive `notInstalled: true` on matching `packages[]` entries. Agent mode partitions lockfile-only patches out BEFORE download (calm `skipped`/`package_not_installed` events — never an error exit, never a manifest write); vendored mode passes them through to the vendor engine's server download. Vendored-ledger entries likewise stay discoverable on a fresh clone (the committed artifact is the dependency). The `Gemfile.lock` inventory lists a gem by its ruby-platform entry; a gem the lock resolves ONLY as precompiled platform builds (`nokogiri (1.18.10-arm64-darwin)`, no `nokogiri (1.18.10)`) joins the supplement too, in every mode (`scan`, `get --mode hosted` / `--mode vendored`, and the in-memory hosted engine): a hosted run redirects it to its per-platform prebuilds from the lock, a vendored run vendors it from them, and an agent or report-only run counts it among the packages that are not installed. Before this, only a hosted run named it, and a vendored scan of a checkout with nothing installed never looked it up. Global scans (`--global`) get no supplement. **Rush monorepos** (no root lockfile, `rush.json` present): the npm-lock inventory falls back to the Rush source-of-truth locks — `common/config/rush/pnpm-lock.yaml` plus every `common/config/subspaces/*/pnpm-lock.yaml` (`read_dir`-sorted, repo-relative paths preserved) — so a Rush repo's dependencies still join discovery. **Plug'n'Play layouts are an explicit refusal, not an empty inventory**: a `.pnp.*` loader means the npm packages are structurally unreachable in EVERY mode (under yarn PnP the installed-tree crawl is empty too — no `node_modules/`), so `scan` surfaces an additive top-level `warnings[]` array (`{code, detail}` objects, omitted when empty) carrying `yarn_pnp_unsupported` (same code as apply's refusal; remedy `yarn patch `) or `pnpm_pnp_unsupported` (pnpm's `node-linker=pnp` twin; pnpm remedies), plus a stderr `Warning: …` line on the human path. Exit code and `status` are deliberately unchanged (exit 0 / `success` — the same posture as hosted refusals, which exit 0 with no `applied` event); the warning is the machine-readable signal that nothing was checked. Pinned by `tests/e2e_safety_yarn_pnp.rs`. **A Bundler lock socket-patch cannot read is likewise a warning, not an empty inventory**: when the project holds gem files but bundler loads no `Gemfile.lock` / `gems.locked` socket-patch reads (`BUNDLE_GEMFILE` or bundler 4's `BUNDLE_LOCKFILE` naming another file, or a `Gemfile` + `gems.rb` twin, whose loaded pair depends on the bundler major that runs), `warnings[]` carries the additive `gem_lock_unsupported` (detail names the setting or the twin) and its lockfile-only gems are not discovered. Same exit-0 / `success` posture. **The jars of a pinned rules_jvm_external hub join the supplement of a hosted run at the root of a Bazel workspace (additive)**: **Experimental** (Bazel workspaces). `scan --mode hosted` (the inferred default included) and `get --mode hosted` take, for each hub of the root `MODULE.bazel` that names a lock (`maven_install.json`), the jar without a classifier of each artifact the hub fetches, at the lock's version, as a Maven package of the project: it counts in `scannedPackages`, and in `lockfileOnlyPackages` with `notInstalled: true` unless a crawl found that version installed, and a patch found for it is pinned in the block of `MODULE.bazel` (the `maven_bazel_*` rows below). A jar whose repository has no known name is such a package too (a patch found for it gets `maven_bazel_artifact`). No jar is guessed for a hub that was not read with certainty: `warnings[]` then carries `maven_bazel_hub_not_read` once, and the jars of the hubs that were read are still looked up. A patch of a hub's jar is a patch of the run like any other, so the run writes for it what `get --mode hosted` writes in that checkout: beside a Gradle build the hosted Gradle pin too (`settings.gradle` and the files under `.socket/gradle/`, with that pin's warnings), and beside a `pom.xml` what the pom lane pins or says (`redirect_maven_version_not_selected`, `redirect_maven_selection_undetermined`, which speak of `pom.xml` alone). **A stale entry of the block is taken out by `scan --mode hosted` (additive)**: when every hub was read and none fetches the jar of an entry at its version any more (the lock moved on, so Bazel stops at the entry), the scan restores it before the rewrite as the withdrawn-pin sweep above restores a pin: the entry alone, under the apply lock, `--dry-run` previewing it, one `rolledBack` event (`verified` on a dry run) with `uuid`, `errorCode: "maven_bazel_entry_stale"` and `details.mode: "hosted"`, also on a scan that finds no package; a pin of the same patch in a `pom.xml` or Gradle file stays; a restore that fails is the `redirect_withdrawn_restore_failed` warning. `get` takes no stale entry out, and no scan takes out a stale entry of vendored mode (a `local_repository` over `.socket/vendor/maven//`): its directory and its ledger entry are vendored mode's, so it stays for `rollback `, `remove ` or `vendor --revert`, which take all three out, and `vendor --check` names it. No other mode, no run whose `--ecosystems` leaves Maven out, no `--global` run and no run of a project below the Bazel root takes a package from a hub, gives that warning or takes a stale entry out: its packages are those of the run without the workspace. A run of a project in no Bazel workspace is, byte for byte, the run it was. See docs/ecosystems.md "Bazel workspaces: Maven". +**Lockfile supplement (v3.4)**: `scan` discovery is no longer limited to installed trees. The project's lockfiles (`package-lock.json`/`npm-shrinkwrap.json`, `pnpm-lock.yaml` v9, `yarn.lock` classic + berry, `bun.lock`, `vlt-lock.json` (registry nodes, Socket-hosted pins included; vendored `file` nodes are left to the vendor ledger), `Cargo.lock`, `go.sum`, `composer.lock`, `Gemfile.lock`, `uv.lock`/`poetry.lock`/pinned `requirements.txt`) are inventoried and dependencies with NO installed copy join discovery — counts, the API lookup, the rows of what a hosted or vendored run patches (an agent or report-only run, which patches installed copies, gets a stderr note that they are not installed), and the prune "scanned" set (a wiped node_modules no longer prunes lockfile-listed entries). JSON gains a top-level `lockfileOnlyPackages` count and an additive `notInstalled: true` on matching `packages[]` entries. Agent mode partitions lockfile-only patches out BEFORE download (calm `skipped`/`package_not_installed` events — never an error exit, never a manifest write); vendored mode passes them through to the vendor engine's server download. Vendored-ledger entries likewise stay discoverable on a fresh clone (the committed artifact is the dependency). The `Gemfile.lock` inventory lists a gem by its ruby-platform entry; a gem the lock resolves ONLY as precompiled platform builds (`nokogiri (1.18.10-arm64-darwin)`, no `nokogiri (1.18.10)`) joins the supplement too, in every mode (`scan`, `get --mode hosted` / `--mode vendored`, and the in-memory hosted engine): a hosted run redirects it to the patches of the platform builds the lock names, a vendored run vendors it from them (each only where one fix has a patch for every locked build; otherwise the gem is skipped, exit 0: `redirect_gem_platform_unsupported`, `vendor_prebuilt_platform_pending`), and an agent or report-only run counts it among the packages that are not installed. Before this, only a hosted run named it, and a vendored scan of a checkout with nothing installed never looked it up. Global scans (`--global`) get no supplement. **Rush monorepos** (no root lockfile, `rush.json` present): the npm-lock inventory falls back to the Rush source-of-truth locks — `common/config/rush/pnpm-lock.yaml` plus every `common/config/subspaces/*/pnpm-lock.yaml` (`read_dir`-sorted, repo-relative paths preserved) — so a Rush repo's dependencies still join discovery. **Plug'n'Play layouts are an explicit refusal, not an empty inventory**: a `.pnp.*` loader means the npm packages are structurally unreachable in EVERY mode (under yarn PnP the installed-tree crawl is empty too — no `node_modules/`), so `scan` surfaces an additive top-level `warnings[]` array (`{code, detail}` objects, omitted when empty) carrying `yarn_pnp_unsupported` (same code as apply's refusal; remedy `yarn patch `) or `pnpm_pnp_unsupported` (pnpm's `node-linker=pnp` twin; pnpm remedies), plus a stderr `Warning: …` line on the human path. Exit code and `status` are deliberately unchanged (exit 0 / `success` — the same posture as hosted refusals, which exit 0 with no `applied` event); the warning is the machine-readable signal that nothing was checked. Pinned by `tests/e2e_safety_yarn_pnp.rs`. **A Bundler lock socket-patch cannot read is likewise a warning, not an empty inventory**: when the project holds gem files but bundler loads no `Gemfile.lock` / `gems.locked` socket-patch reads (`BUNDLE_GEMFILE` or bundler 4's `BUNDLE_LOCKFILE` naming another file, or a `Gemfile` + `gems.rb` twin, whose loaded pair depends on the bundler major that runs), `warnings[]` carries the additive `gem_lock_unsupported` (detail names the setting or the twin) and its lockfile-only gems are not discovered. Same exit-0 / `success` posture. **The jars of a pinned rules_jvm_external hub join the supplement of a hosted run at the root of a Bazel workspace (additive)**: **Experimental** (Bazel workspaces). `scan --mode hosted` (the inferred default included) and `get --mode hosted` take, for each hub of the root `MODULE.bazel` that names a lock (`maven_install.json`), the jar without a classifier of each artifact the hub fetches, at the lock's version, as a Maven package of the project: it counts in `scannedPackages`, and in `lockfileOnlyPackages` with `notInstalled: true` unless a crawl found that version installed, and a patch found for it is pinned in the block of `MODULE.bazel` (the `maven_bazel_*` rows below). A jar whose repository has no known name is such a package too (a patch found for it gets `maven_bazel_artifact`). No jar is guessed for a hub that was not read with certainty: `warnings[]` then carries `maven_bazel_hub_not_read` once, and the jars of the hubs that were read are still looked up. A patch of a hub's jar is a patch of the run like any other, so the run writes for it what `get --mode hosted` writes in that checkout: beside a Gradle build the hosted Gradle pin too (`settings.gradle` and the files under `.socket/gradle/`, with that pin's warnings), and beside a `pom.xml` what the pom lane pins or says (`redirect_maven_version_not_selected`, `redirect_maven_selection_undetermined`, which speak of `pom.xml` alone). **A stale entry of the block is taken out by `scan --mode hosted` (additive)**: when every hub was read and none fetches the jar of an entry at its version any more (the lock moved on, so Bazel stops at the entry), the scan restores it before the rewrite as the withdrawn-pin sweep above restores a pin: the entry alone, under the apply lock, `--dry-run` previewing it, one `rolledBack` event (`verified` on a dry run) with `uuid`, `errorCode: "maven_bazel_entry_stale"` and `details.mode: "hosted"`, also on a scan that finds no package; a pin of the same patch in a `pom.xml` or Gradle file stays; a restore that fails is the `redirect_withdrawn_restore_failed` warning. `get` takes no stale entry out, and no scan takes out a stale entry of vendored mode (a `local_repository` over `.socket/vendor/maven//`): its directory and its ledger entry are vendored mode's, so it stays for `rollback `, `remove ` or `vendor --revert`, which take all three out, and `vendor --check` names it. No other mode, no run whose `--ecosystems` leaves Maven out, no `--global` run and no run of a project below the Bazel root takes a package from a hub, gives that warning or takes a stale entry out: its packages are those of the run without the workspace. A run of a project in no Bazel workspace is, byte for byte, the run it was. See docs/ecosystems.md "Bazel workspaces: Maven". **Server artifact acquisition (v5.0)**: vendoring downloads the patched artifact for the selected UUID, including on a fresh checkout with no installed package. The CLI no longer downloads pristine packages, stages patch blobs, applies patches to vendor copies, or constructs archives. Backend lock and package-identity checks still run before acquisition; git and custom-registry Cargo sources are refused with `vendor_source_unsupported`. Healthy committed artifacts are reused offline. A changed UUID downloads a fresh server artifact; an unhealthy artifact at the recorded UUID uses the exact redownload procedure below, except that a directory copy whose ledger entry has no file inventory (vendored before v5.0) is rebuilt by its backend from a fresh verified download, and a missing or stale Bun workspace mirror over a healthy canonical tarball is rewritten from that tarball by the backend; those cases report the backend's own failure codes. @@ -545,7 +546,7 @@ The rewriter reads a fixed set of candidate files from the project root: the npm **Non-UTF-8 candidate files (#721)**: the rewriters edit UTF-8 text only. A candidate file that exists but is not UTF-8 (for example a UTF-16 `requirements.txt`, which is what Windows PowerShell 5.1's `pip freeze >` writes and which pip installs from) is never read as absent. When a candidate of its ecosystem could rewrite it, the run is refused with `candidate_file_unreadable` (exit 1, `--dry-run` included), the message names the file, and nothing is written; the remedy is to re-save the file as UTF-8. Two exceptions keep their own refusals. A Gradle build file the Gradle planner reaches gets that planner's per-build refusal (`redirect_gradle_build_file_unreadable`, exit 0) and the rest of the run goes ahead, and with no readable Gradle build a stray Gradle file (a lock, a nested script) is never rewritten, so it does not refuse the run, while a non-UTF-8 root `settings.gradle(.kts)` or `build.gradle(.kts)` still refuses it (it may be the build itself). An unreadable `socket-patch.sbt` is refused with `redirect_sbt_owned_file_unreadable`. A vendored→hosted takeover checks this before it reverts anything, so a refused run leaves the vendored wiring, ledger entry and artifact byte-identical. Vendored mode likewise refuses a non-UTF-8 `requirements.txt` or `-r` include by name (`pypi_no_requirements`) instead of wiring around it. Lock-only discovery reads `requirements.txt` and its in-root `-r` includes the way pip decodes them (a UTF-16 or UTF-32 byte-order mark selects that encoding), so such a project's pins are still found instead of reporting "No packages found". -**Gem hosted wiring**: for a gem the manifest (`Gemfile` / `gems.rb`) declares, hosted mode appends ONE option to the user's own declaration, `, source: ""`, after its last argument, and changes nothing else of it: version requirement(s), quote style, other options, trailing comment, position, enclosing `group` / `platforms` / `install_if` block and indentation stay byte for byte. This covers a parenthesized call (the option goes inside the parentheses), a declaration continued over several lines (after the last argument, on its line), several version requirements, `%w` / symbol option values, a trailing `if` / `unless` / `while` / `until` / `rescue` modifier (the option goes before the modifier) and a declaration followed by another statement after a `;`. For a gem the manifest does not declare (a transitive dependency: the lock's `DEPENDENCIES` does not list it) hosted mode adds exactly one line at the end of the manifest, `gem "", "", source: "", require: false # added by socket-patch (transitive dependency)`, after one blank line, in the file's own line ending and keeping whether the file ends on one. `require: false` keeps `Bundler.require` from loading a gem it did not load before the line existed; the marker comment is what tells the unwind the whole line is socket-patch's. **The lock always follows** (the pair is what the Bundler that wrote the lock writes for that manifest, so frozen / deployment installs accept it as committed): on a lock written by Bundler ≥ 2.2 the gem's spec moves to a `GEM` section of its own whose `remote:` is the index URL (sections ordered as Bundler orders them); on a lock written by Bundler 1.17–2.1 the index URL joins the `remote:` lines of the one merged `GEM` section, in the order Bundler derives from the manifest's sources; the `DEPENDENCIES` entry keeps the requirement the manifest declares and gains `!` (a transitive gem gets ` (= )!`); and where the lock has a `CHECKSUMS` section the gem's entry is set to the patched artifact's sha256. A lock with no `CHECKSUMS` section (Bundler < 2.6) is converged the same way and pins the gem by source alone; the run reports that ONCE, naming the gems, as `redirect_gem_no_checksums_section`. **Precompiled platform gems**: a gem Bundler locks as platform builds has one lock entry per platform (`nokogiri (1.18.10-arm64-darwin)`, `nokogiri (1.18.10-x86_64-linux-gnu)`) and usually no ruby-platform `nokogiri (1.18.10)`. A fix for such a gem is one patch per gem: the patch of the ruby gem (the fix's **source patch**) and one patch per platform gem that was built from it, each with its own uuid, its own record under the gem's purl with a `platform` qualifier (`pkg:gem/nokogiri@1.18.10?platform=arm64-darwin`; the ruby gem's is `?platform=ruby`) and a package reference like any gem patch's (a `tarball`, a `registryOverride` with its own index URL and `identifiers.gemChecksumSha256`). A platform patch's reference names its source in `rebuiltFromUuid` (absent or null on a source patch); the fix a patch belongs to is `rebuiltFromUuid ?? uuid`. A platform gem's patch is the upstream platform gem's name, gemspec and file list with the fix's files replaced, and the registry of any patch of a fix lists and serves every gem of that fix. The scan takes one patch per build the lock names, by the build's qualified purl, and all of them from ONE fix (the one the project is already on unless the first-ranked fix supersedes it, else the fix the ruby gem's selection ranks first, else the first that covers every locked build); patches of platforms the lock does not name are not selected. When EVERY entry of the gem at the patched version has a usable patch of that fix, the gem is wired like any other: the manifest edit is the same, with the index URL of the **source patch's** registry (the same URL whichever platforms the lock names, so adding a platform never changes the manifest line; when the lock has no ruby-platform entry the source patch's reference is asked for too, and that patch is reported in no event). Which registry is the anchor, in order: the one the lock already takes the gem from, when it is the source patch's or that of a build the lock still names (a pair that works is never rewritten for another URL of the same fix); the source patch's, where the run has it; and where the source patch is not available to the run (not offered to the organisation, not granted), the registry of the first locked build's own patch, platforms in the lock's sorted order. That last choice moves the gem all the same and adds the warning `redirect_gem_member_registry`: ``Gemfile.lock takes from the patch registry of its `` gem's patch (): the patch its builds were built from () is not available to this run, and every patch registry of a fix serves every build of it. The `source:` in Gemfile names that registry, so the line changes if `` leaves Gemfile.lock``. A gem moved that way stays on that registry once the source patch turns up (no rewrite, no warning), and is re-anchored by the same order when that platform leaves the lock, every entry of that version (each spec line with its dependency sub-lines, verbatim and in the lock's order, plus a ruby-platform entry when one sits beside them) moves to that registry's `GEM` section, `DEPENDENCIES` is pinned the same way, and each `CHECKSUMS` entry of the gem is set to the sha256 its own patch's reference states; a lock with no `CHECKSUMS` section gets none. Before anything is written the run reads `/info/` of that registry (one request per platform-locked gem) and requires it to list every locked build with the sha256 about to be pinned. A frozen `bundle install` of that pair fetches the one platform gem of the machine from the patch registry, compiles nothing and leaves the lock byte-identical (verified on Bundler 4.0.15), and `bundle lock --add-platform ` on that pair adds the new platform's patched gem from the same registry without touching the manifest. Each locked build is reported under its own patch: one `applied` event per build (`purl` with its `platform` qualifier, `uuid` of that build's patch, each counted in `summary.applied`), those uuids in the package's `selectedUuids` (beside the source patch's), and each build attested by its own patch uuid in the run's `--vex` (a later standalone `vex` reads the lock, which holds the one registry, and names the patch that registry belongs to); the human summary counts the gem as one package. A patch of the gem that the lock has no entry for (another platform's, or the ruby gem's where the lock has no ruby-platform entry) has nothing to pin and gets no event. The gem is skipped with `redirect_gem_platform_unsupported`, with neither file changed, when a locked build has no usable patch (none on offer, a reference that is `pending_build`, `withdrawn` or otherwise not granted: that patch gets its own `skipped` event with the reference's status), when its builds are patched only by different fixes, when the registry does not list what the lock would pin or could not be read, or for a platform build in the merged layout of Bundler < 2.2; the detail names the builds the lock holds and which case it is, and for a lock that already takes the gem from a patch registry it adds the way back (`socket-patch rollback pkg:gem/@`). A reference that still carries the retired `gemPlatforms` list or `gem-platform` artifacts is read as the ruby gem's patch alone. `get --mode hosted|vendored` for one patch of a platform-locked gem selects the whole fix: that patch plus the fix's patch of every other locked build and its source patch (one search and one reference request). A lock does not record which Bundler installs it, only which one wrote it (`BUNDLED WITH`), so the pair is converged for that one; when it is the merged layout of Bundler < 2.2, which later Bundlers deprecate and from 2.5 on refuse under frozen / deployment mode, the run that writes the lock adds `redirect_gem_merged_lock_layout` naming the Bundler the pair is for. A rollout that defers a build of such a gem (`--max-new-patches`) defers the fix whole, its source patch included: nothing of it is written and no platform warning is given. **Never a half-applied pair**: each gem is planned on a copy of the pair and committed only when the planned manifest and lock agree about it (the manifest gives it the index URL as its one source; the lock resolves it from a `GEM` section naming that remote, with a source-pinned `DEPENDENCIES` entry). A gem whose declaration cannot take the option, or whose lock cannot follow, is refused with neither file changed for it, and the warning's detail gives the reason and the way out: `redirect_gem_unrecognized_declaration` (the declaration cannot be edited in place — a heredoc or `do` block among its arguments, code before it on its line, a string spanning lines, a last argument that is not a literal and may be an options hash: it is taken for a version requirement only when the lock shows one requirement per positional argument, every other positional is a single quoted string, and the manifest has no `gemspec` directive, whose own requirement for the gem bundler folds into the lock entry, …), `redirect_gem_source_option` (it already selects a source: a `source:` / `git:` / `github:` / `path:` option or one a `**opts` splat may hold, a declaration inside a `source` / `git` / `github` / `path` block, a `DEPENDENCIES` entry that is already source-pinned, or a lock that resolves the gem from a `GIT` / `PATH` section), `redirect_gem_declared_more_than_once`, `redirect_gem_declaration_not_visible` (a direct dependency declared in an `eval_gemfile`d file, a loop or a gemspec; vendored mode refuses it for the same reason, so the way out is a literal `gem` line or `--mode agent`), `redirect_gem_dependency_not_locked` (declared, but the lock's `DEPENDENCIES` does not list it), `redirect_gem_lock_unconvergeable` (no `BUNDLED WITH` section to say which layout the lock's Bundler accepts, a merged Bundler < 2.2 section whose remotes the manifest's sources do not explain, or the one multi-remote `GEM` section Bundler 2.2 to 2.7 write for a manifest with more than one top-level `source` line, where the detail names that cause and the remedy: move each extra source into a `source "" do … end` block, then `bundle lock`), `redirect_gem_platform_unsupported` (a locked platform build the patch has no prebuild for, above) and `redirect_gem_inconsistent_plan` (the self-check above failed; a bug guard, never expected). A re-scan recognizes its own option (the grant-token and patch-uuid path levels of the URL rotate, so they are matched as wildcards) and refreshes the URL in place, in the manifest and the lock together; a re-scan of an unchanged project writes nothing. A lock reverted or regenerated without its manifest (the option still there, the lock back on the registry) is converged again by the next hosted scan. **Pins written by socket-patch 5.0 / 5.1** used a `source "" do … end` block in the declaration's place and, on a lock with no `CHECKSUMS` section, left the lock alone. That form is never written any more but stays recognized everywhere (re-scan, `list`, `vex`, `rollback` / `remove`, the takeovers): a re-scan keeps the block as it is, refreshes its URL like the option's, and converges a lock that never followed it; only where that lock cannot be converged does the run still warn `redirect_gem_frozen_install`. Human mode prints one line after the summary naming the declarations changed, e.g. ``Added `source:` to 3 gem declarations in Gemfile (puma, rack, and rexml); added 1 line for the transitive dependency nokogiri.`` **Update hold**: a gem wired this way has the patch registry as its only source, and that source serves the one patched version, so `bundle outdated` no longer lists the gem and `bundle update` cannot move it (a range requirement included) until its pin is rolled back. When a run newly wires at least one gem (an option appended or a line added, not a refreshed URL), human mode prints one more stdout line under that one, naming those gems once each: ``Bundler now takes rack from its Socket patch source only, which serves the patched version and no other: `bundle outdated` no longer lists it and `bundle update` cannot move it. To move it to a newer release, run `socket-patch rollback pkg:gem/rack@3.1.8`, then `bundle update rack`, then `socket-patch scan` again.`` The rollback step always names a purl (the gem's own for one gem, as `rollback` selects its pin: without the patch record's qualifiers such as `?platform=ruby`, so a shell passes it on whole; the shape `pkg:gem/@` for several), never a bare `rollback`, which would unwind every patch; after `get` the last step reads "then patch the new version the same way"; `--dry-run` words the first sentence as what the run would hold and prints no steps. `--json` and `--silent` output are unchanged (no warning code). Pinned against real Bundler by `tests/e2e_redirect_gem_build.rs`. See `docs/ecosystems.md` ("Ruby gems: hosted mode") for the user-facing description. +**Gem hosted wiring**: for a gem the manifest (`Gemfile` / `gems.rb`) declares, hosted mode appends ONE option to the user's own declaration, `, source: ""`, after its last argument, and changes nothing else of it: version requirement(s), quote style, other options, trailing comment, position, enclosing `group` / `platforms` / `install_if` block and indentation stay byte for byte. This covers a parenthesized call (the option goes inside the parentheses), a declaration continued over several lines (after the last argument, on its line), several version requirements, `%w` / symbol option values, a trailing `if` / `unless` / `while` / `until` / `rescue` modifier (the option goes before the modifier) and a declaration followed by another statement after a `;`. For a gem the manifest does not declare (a transitive dependency: the lock's `DEPENDENCIES` does not list it) hosted mode adds exactly one line at the end of the manifest, `gem "", "", source: "", require: false # added by socket-patch (transitive dependency)`, after one blank line, in the file's own line ending and keeping whether the file ends on one. `require: false` keeps `Bundler.require` from loading a gem it did not load before the line existed; the marker comment is what tells the unwind the whole line is socket-patch's. **The lock always follows** (the pair is what the Bundler that wrote the lock writes for that manifest, so frozen / deployment installs accept it as committed): on a lock written by Bundler ≥ 2.2 the gem's spec moves to a `GEM` section of its own whose `remote:` is the index URL (sections ordered as Bundler orders them); on a lock written by Bundler 1.17–2.1 the index URL joins the `remote:` lines of the one merged `GEM` section, in the order Bundler derives from the manifest's sources; the `DEPENDENCIES` entry keeps the requirement the manifest declares and gains `!` (a transitive gem gets ` (= )!`); and where the lock has a `CHECKSUMS` section the gem's entry is set to the patched artifact's sha256. A lock with no `CHECKSUMS` section (Bundler < 2.6) is converged the same way and pins the gem by source alone; the run reports that ONCE, naming the gems, as `redirect_gem_no_checksums_section`. **Precompiled platform gems**: a gem Bundler locks as platform builds has one lock entry per platform (`nokogiri (1.18.10-arm64-darwin)`, `nokogiri (1.18.10-x86_64-linux-gnu)`) and usually no ruby-platform `nokogiri (1.18.10)`. A fix for such a gem is one patch per gem: the patch of the ruby gem (the fix's **source patch**) and one patch per platform gem that was built from it, each with its own uuid, its own record under the gem's purl with a `platform` qualifier (`pkg:gem/nokogiri@1.18.10?platform=arm64-darwin`; the ruby gem's is `?platform=ruby`) and a package reference like any gem patch's (a `tarball`, a `registryOverride` with its own index URL and `identifiers.gemChecksumSha256`). A platform patch's reference names its source in `rebuiltFromUuid` (absent or null on a source patch); the fix a patch belongs to is `rebuiltFromUuid ?? uuid`. A platform gem's patch is the upstream platform gem's name, gemspec and file list with the fix's files replaced, and the registry of any patch of a fix lists and serves every gem of that fix. The scan takes one patch per build the lock names, by the build's qualified purl, and all of them from ONE fix (the one the project is already on unless the first-ranked fix supersedes it, else the fix the ruby gem's selection ranks first, else the first that covers every locked build); patches of platforms the lock does not name are not selected. When EVERY entry of the gem at the patched version has a usable patch of that fix, the gem is wired like any other: the manifest edit is the same, with the index URL of the **source patch's** registry (the same URL whichever platforms the lock names, so adding a platform never changes the manifest line; when the lock has no ruby-platform entry the source patch's reference is asked for too, and that patch is reported in no event). Which registry is the anchor, in order: the one the lock already takes the gem from, when it is the source patch's or that of a build the lock still names (a pair that works is never rewritten for another URL of the same fix); the source patch's, where the run has it; and where the source patch is not available to the run (not offered to the organisation, not granted), the registry of the first locked build's own patch, platforms in the lock's sorted order. That last choice moves the gem all the same and adds the warning `redirect_gem_member_registry`: ``Gemfile.lock takes from the patch registry of its `` gem's patch (): the patch its builds were built from () is not available to this run, and every patch registry of a fix serves every build of it. The `source:` in Gemfile names that registry, so the line changes if `` leaves Gemfile.lock``. A gem moved that way stays on that registry once the source patch turns up (no rewrite, no warning), and is re-anchored by the same order when that platform leaves the lock, every entry of that version (each spec line with its dependency sub-lines, verbatim and in the lock's order, plus a ruby-platform entry when one sits beside them) moves to that registry's `GEM` section, `DEPENDENCIES` is pinned the same way, and each `CHECKSUMS` entry of the gem is set to the sha256 its own patch's reference states; a lock with no `CHECKSUMS` section gets none. Before anything is written the run reads `/info/` of that registry (one request per platform-locked gem) and requires it to list every locked build with the sha256 about to be pinned. A frozen `bundle install` of that pair fetches the one platform gem of the machine from the patch registry, compiles nothing and leaves the lock byte-identical (verified on Bundler 4.0.15), and `bundle lock --add-platform ` on that pair adds the new platform's patched gem from the same registry without touching the manifest. Each locked build is reported under its own patch: one `applied` event per build (`purl` with its `platform` qualifier, `uuid` of that build's patch, each counted in `summary.applied`), those uuids in the package's `selectedUuids` (beside the source patch's), and each build attested by its own patch uuid in the run's `--vex` (a later standalone `vex` reads the lock, which holds the one registry, and names the patch that registry belongs to); the human summary counts the gem as one package. A patch of the gem that the lock has no entry for (another platform's, or the ruby gem's where the lock has no ruby-platform entry) has nothing to pin and gets no event. The gem is skipped with `redirect_gem_platform_unsupported`, with neither file changed, when a locked build has no usable patch (none on offer, a reference that is `pending_build`, `withdrawn` or otherwise not granted: that patch gets its own `skipped` event with the reference's status), when its builds are patched only by different fixes, when the registry does not list what the lock would pin or could not be read, or for a platform build in the merged layout of Bundler < 2.2; the detail names the builds the lock holds and which case it is, and for a lock that already takes the gem from a patch registry it adds the way back (`socket-patch rollback pkg:gem/@`). A reference that still carries the retired `gemPlatforms` list or `gem-platform` artifacts is read as the ruby gem's patch alone. `get --mode hosted|vendored` for one patch of a platform-locked gem selects the whole fix: that patch plus the fix's patch of every other locked build and its source patch (one search and one reference request). A lock does not record which Bundler installs it, only which one wrote it (`BUNDLED WITH`), so the pair is converged for that one; when it is the merged layout of Bundler < 2.2, which later Bundlers deprecate and from 2.5 on refuse under frozen / deployment mode, the run that writes the lock adds `redirect_gem_merged_lock_layout` naming the Bundler the pair is for. A rollout that defers a build of such a gem (`--max-new-patches`) defers the fix whole, its source patch included: nothing of it is written and no platform warning is given. **Never a half-applied pair**: each gem is planned on a copy of the pair and committed only when the planned manifest and lock agree about it (the manifest gives it the index URL as its one source; the lock resolves it from a `GEM` section naming that remote, with a source-pinned `DEPENDENCIES` entry). A gem whose declaration cannot take the option, or whose lock cannot follow, is refused with neither file changed for it, and the warning's detail gives the reason and the way out: `redirect_gem_unrecognized_declaration` (the declaration cannot be edited in place — a heredoc or `do` block among its arguments, code before it on its line, a string spanning lines, a last argument that is not a literal and may be an options hash: it is taken for a version requirement only when the lock shows one requirement per positional argument, every other positional is a single quoted string, and the manifest has no `gemspec` directive, whose own requirement for the gem bundler folds into the lock entry, …), `redirect_gem_source_option` (it already selects a source: a `source:` / `git:` / `github:` / `path:` option or one a `**opts` splat may hold, a declaration inside a `source` / `git` / `github` / `path` block, a `DEPENDENCIES` entry that is already source-pinned, or a lock that resolves the gem from a `GIT` / `PATH` section), `redirect_gem_declared_more_than_once`, `redirect_gem_declaration_not_visible` (a direct dependency declared in an `eval_gemfile`d file, a loop or a gemspec; vendored mode refuses it for the same reason, so the way out is a literal `gem` line or `--mode agent`), `redirect_gem_dependency_not_locked` (declared, but the lock's `DEPENDENCIES` does not list it), `redirect_gem_lock_unconvergeable` (no `BUNDLED WITH` section to say which layout the lock's Bundler accepts, a merged Bundler < 2.2 section whose remotes the manifest's sources do not explain, or the one multi-remote `GEM` section Bundler 2.2 to 2.7 write for a manifest with more than one top-level `source` line, where the detail names that cause and the remedy: move each extra source into a `source "" do … end` block, then `bundle lock`), `redirect_gem_platform_unsupported` (a gem locked as platform builds with no one fix that has a usable patch for every locked build, above) and `redirect_gem_inconsistent_plan` (the self-check above failed; a bug guard, never expected). A re-scan recognizes its own option (the grant-token and patch-uuid path levels of the URL rotate, so they are matched as wildcards) and refreshes the URL in place, in the manifest and the lock together; a re-scan of an unchanged project writes nothing. A lock reverted or regenerated without its manifest (the option still there, the lock back on the registry) is converged again by the next hosted scan. **Pins written by socket-patch 5.0 / 5.1** used a `source "" do … end` block in the declaration's place and, on a lock with no `CHECKSUMS` section, left the lock alone. That form is never written any more but stays recognized everywhere (re-scan, `list`, `vex`, `rollback` / `remove`, the takeovers): a re-scan keeps the block as it is, refreshes its URL like the option's, and converges a lock that never followed it; only where that lock cannot be converged does the run still warn `redirect_gem_frozen_install`. Human mode prints one line after the summary naming the declarations changed, e.g. ``Added `source:` to 3 gem declarations in Gemfile (puma, rack, and rexml); added 1 line for the transitive dependency nokogiri.`` **Update hold**: a gem wired this way has the patch registry as its only source, and that source serves the one patched version, so `bundle outdated` no longer lists the gem and `bundle update` cannot move it (a range requirement included) until its pin is rolled back. When a run newly wires at least one gem (an option appended or a line added, not a refreshed URL), human mode prints one more stdout line under that one, naming those gems once each: ``Bundler now takes rack from its Socket patch source only, which serves the patched version and no other: `bundle outdated` no longer lists it and `bundle update` cannot move it. To move it to a newer release, run `socket-patch rollback pkg:gem/rack@3.1.8`, then `bundle update rack`, then `socket-patch scan` again.`` The rollback step always names a purl (the gem's own for one gem, as `rollback` selects its pin: without the patch record's qualifiers such as `?platform=ruby`, so a shell passes it on whole; the shape `pkg:gem/@` for several), never a bare `rollback`, which would unwind every patch; after `get` the last step reads "then patch the new version the same way"; `--dry-run` words the first sentence as what the run would hold and prints no steps. `--json` and `--silent` output are unchanged (no warning code). Pinned against real Bundler by `tests/e2e_redirect_gem_build.rs`. See `docs/ecosystems.md` ("Ruby gems: hosted mode") for the user-facing description. **Gem stale-install guard (the canonical narrative; other mentions point here)**: the gem hosted rewrite is pure Gemfile/lock text, and Bundler keeps a gem it already holds whatever source the lock names. So after the rewrite a hosted run looks for the gems the project already has on disk, replaces the project's own stale copies with the patched gem itself, and warns about the rest. The unwind (`rollback`, `remove`, a withdrawn-patch restore) does the same in the other direction. Exit code and `status` never change: a refresh that cannot be done leaves everything as it was and falls back to the warning. @@ -1932,7 +1933,7 @@ path. Without hosted pins the no-manifest no-op below is unchanged. **Prebuilt vendor artifacts (`--vendor-source`)**: `service` is the default and `auto` is a compatibility alias. `build` is rejected at argument parsing. There is no local construction or fallback. Package-reference POSTs on the configured API/proxy (`--vendor-url` overrides it) return the download URL and integrity; `--patch-server-url` can override the download origin. The CLI verifies transfer integrity and patched-member afterHashes before writing. Pending builds, missing artifacts, service failures, wrong layouts and integrity mismatches fail closed. Fresh acquisition requires the network; healthy committed artifacts remain reusable offline. -Coverage includes npm (all lock flavors), Python wheels and source distributions, Cargo crates, Go module zips, Composer dist zips, RubyGems, NuGet packages and JVM jars. Directory artifacts are extracted and receive only the existing package-manager layout transformations. RubyGems requires the server's separately verified `gem-stub-gemspec`; a missing or invalid stub is a failure. A gem whose `Gemfile.lock` holds platform-suffixed entries (`nokogiri (1.18.10-x86_64-linux-gnu)`) is taken as the patch's prebuilt platform gems instead: for each locked platform the server's `gem-platform` artifact and its `gem-platform-stub-gemspec` (each carries its `platform`), both verified like the ruby gem and its stub. Which prebuilds exist is read from the package reference alone, and the ruby gem it also names is not downloaded. While the server lists no prebuild for a locked platform nothing is downloaded and the gem is skipped (`vendor_prebuilt_platform_pending`). A prebuild need not ship any of the patch's files (a patch of `patches/**` or `dependencies.yml` lives entirely in the rebuilt binaries): its integrity check against the digest the server states for that platform is mandatory and is what vouches for it, while a patched file it does ship that is not the patched one is a `vendor_prebuilt_required` failure. Yarn Berry checksums come from server metadata. Hosted Berry rollback retrieves upstream checksum metadata from `/upstream/npm/.json` and checks its package identity and upstream integrity against the registry; the CLI does not recreate the Berry zip. +Coverage includes npm (all lock flavors), Python wheels and source distributions, Cargo crates, Go module zips, Composer dist zips, RubyGems, NuGet packages and JVM jars. Directory artifacts are extracted and receive only the existing package-manager layout transformations. RubyGems requires the server's separately verified `gem-stub-gemspec`; a missing or invalid stub is a failure. A gem whose `Gemfile.lock` holds platform-suffixed entries (`nokogiri (1.18.10-x86_64-linux-gnu)`) is taken as the fix's patched platform gems instead: each locked platform's gem has a patch of its own (`pkg:gem/@?platform=`, built from the ruby gem's patch, the fix's source patch), and that patch's `tarball` and `gem-stub-gemspec` are downloaded, both verified like the ruby gem and its stub. The ruby gem is not downloaded. While a locked platform has no usable patch of that fix nothing is downloaded and the gem is skipped (`vendor_prebuilt_platform_pending`, exit 0). A platform gem need not ship any of its patch's files (a patch of `patches/**` or `dependencies.yml` lives entirely in the rebuilt binaries): its integrity check against the digest the server states for that platform's patch is mandatory and is what vouches for it, while a patched file it does ship that is not the patched one is a `vendor_prebuilt_required` failure. Yarn Berry checksums come from server metadata. Hosted Berry rollback retrieves upstream checksum metadata from `/upstream/npm/.json` and checks its package identity and upstream integrity against the registry; the CLI does not recreate the Berry zip. **Archive limits.** An npm tarball, a Python wheel or source distribution and a `.nupkg` are decoded in memory within fixed limits, counted on the bytes actually inflated and on the archive's own entry count (a size an archive declares only refuses it sooner): 200,000 entries, and per read of one archive 1 GiB unpacked and at most 100 times the archive's own size (an archive smaller than 655 KiB may still unpack to 64 MiB). For a tarball the bytes are those of the tar stream, each entry's 512-byte header and padding included. One file may be as large as what is left of its archive's allowance. What is unpacked is held in memory, so 1 GiB plus the archive itself is what checking one archive may take: an npm tarball of 17 MiB that unpacks to 1,000 MiB was measured at 1,079 MiB resident for `vendor`, 1,055 MiB for `vendor --check` and 1,059 MiB for `vex`. These are the limits wherever a package is read, unpacked or downloaded, so that one path does not refuse for its size what another takes: the registry extractors, which write to disk, unpack 200,000 entries and 1 GiB with no smaller limit on one entry (they were 60,000 entries, 512 MiB and 128 MiB for one entry: `@next/swc-linux-x64-gnu` holds a file of 136 MiB); a download is at most 256 MiB from the patch service and from a registry (a registry's was 128 MiB); the inventory of a committed directory covers 200,000 files (it was 10,000: the wheel of `ansible` 11.1.0 holds 21,105); a patched file recovered from a committed zip may be as large as that zip may unpack to (it was 64 MiB); and a jar has the same 200,000 entries, 1 GiB and 100 times its own size. @@ -2449,9 +2450,9 @@ State lives at `$XDG_CACHE_HOME`|`~/.cache` (Unix/macOS) or `%LOCALAPPDATA%` (Wi Telemetry is **on by default**. Each command reports its outcome as one JSON event per row of the table below (a `scan` or `get` that also downloads and applies sends up to three; a `scan` over several project directories reports each). -**What is sent.** `{event_sender_created_at, event_type, context: {version, platform, arch, command, channel?}, session_id, metadata?, error?: {type, message}}`; no `event_kind`, so the backend stores it as a required event. `context` is the client version, `std::env::consts::OS` / `ARCH`, the subcommand, and `channel`: the install channel of the running binary (`npm`, `cargo`, `homebrew`, `pypi`, `launcher_cache`, or `standalone` for any location none of those owns; the same detection `--update` uses, from the binary's canonical path, read from environment variables alone and resolved before `--update` swaps the binary), omitted when that path cannot be read. `session_id` is a random UUID generated per process and never stored, so it links the events of one run and nothing else. `metadata` holds only the per-event fields in the table. `error.message` (failure events) has every URL redacted (userinfo, grant tokens, signed query values), the home directory replaced by `~`, and is cut to 1,000 characters; it can otherwise quote a package name or a path. The request carries `User-Agent: SocketPatchCLI/` and, on the org route, `Authorization: Bearer `. Nothing else is sent: no package name, no file contents, no machine identifier. The patches an event names are named by patch UUID (see below), which identifies a patched package version to Socket. +**What is sent.** `{event_sender_created_at, event_type, context: {version, platform, arch, command, ci, channel?}, session_id, metadata?, error?: {type, message}}`; no `event_kind`, so the backend stores it as a required event. `context` is the client version, `std::env::consts::OS` / `ARCH`, the subcommand, `ci` (a boolean: `CI` is set to anything but empty, `0` or `false`, or `GITHUB_ACTIONS` is set; never which provider, repository or job), and `channel`: the install channel of the running binary (`npm`, `cargo`, `homebrew`, `pypi`, `launcher_cache`, or `standalone` for any location none of those owns; the same detection `--update` uses, from the binary's canonical path, read from environment variables alone and resolved before `--update` swaps the binary), omitted when that path cannot be read. `session_id` is a random UUID generated per process and never stored, so it links the events of one run and nothing else. `metadata` holds only the per-event fields in the table. `error.message` (failure events) has every URL redacted (userinfo, grant tokens, signed query values), the home directory replaced by `~`, and is cut to 1,000 characters; it can otherwise quote a package name or a path. The request carries `User-Agent: SocketPatchCLI/` and, on the org route, `Authorization: Bearer `. Nothing else is sent: no package name, no file contents, no machine identifier. The patches an event names are named by patch UUID (see below), which identifies a patched package version to Socket. -**Patches.** An event about specific patches (the rows marked *patches*) adds to `metadata`: `patches`, at most 50 `{uuid, ecosystem, mode, outcome, code?}` entries, one per patch and mode, failed ones first (`mode`: `agent` / `hosted` / `vendored`; `outcome`: `applied`, `downloaded`, `rolled_back`, `removed`, `rebuilt`, `verified` (a dry run), `skipped`, `failed`; `code` is the event's `errorCode`, on `skipped` and `failed` only); `patches_truncated: true` when the cap dropped entries; `outcomes`, the count of patches per outcome over the whole run; and `ecosystems` / `modes`, their distinct values. They are derived from the run's `--json` events, so the two cannot disagree: several events for one patch (one per installed copy) fold into the one that says most (a failure over a change, a change over a preview, a preview over a skip). A run that named no patch adds none of these. The event body stays under 9,000 bytes (the server's dashboards cannot read one past 10,000 characters): an event that would not fit gives up the tail of its error message, down to 200 characters, and then entries off the end of its patch list. +**Patches.** An event about specific patches (the rows marked *patches*) adds to `metadata`: `patches`, at most 50 `{uuid, ecosystem, mode, outcome, code?}` entries, one per patch and mode, failed ones first (`mode`: `agent` / `hosted` / `vendored`; `outcome`: `applied`, `downloaded`, `rolled_back`, `removed`, `rebuilt`, `verified` (a dry run), `skipped`, `failed`; `code` is the event's `errorCode`, on `skipped` and `failed` only, and the event's `cause` where a failed apply event has one); `patches_truncated: true` when the cap dropped entries; `outcomes`, the count of patches per outcome over the whole run; `failure_codes`, the count of failed patches per `code` (`none` for one without) over the whole run, left out when none failed; and `ecosystems` / `modes`, their distinct values. They are derived from the run's `--json` events, so the two cannot disagree: several events for one patch (one per installed copy) fold into the one that says most (a failure over a change, a change over a preview, a preview over a skip). A run that named no patch adds none of these. The event body stays under 9,000 bytes (the server's dashboards cannot read one past 10,000 characters): an event that would not fit gives up the tail of its error message, down to 200 characters, and then entries off the end of its patch list. **Failures.** Every failure event carries `error_code`: the code the run's `--json` envelope reports as its `error.code` (`patch_not_found`, `rollback_failed`, `vendor_revert_kept`, …), so a mistyped target is distinguishable from a patch that failed. It is the same with and without `--json`. A run whose envelope has failed events and no top-level error reports `apply_failed`, `vendor_failed`, `hosted_failed` or `repair_failed`. Two kinds of run report nothing, in every command: one that exits 2 on a usage error, and one that could not take the apply lock. @@ -2527,9 +2528,10 @@ Empty string means unset at every layer: exported-but-empty flag-bound vars are | `SOCKET_NO_TRUST_LOCKFILE_CONFIG` | `--no-trust-lockfile-config` | `false` | Hosted mode: skip the `pnpm-workspace.yaml` write (the registry route's `namedRegistries` entries and `overrides`, or `trustLockfile: true`). | | `SOCKET_NO_NPM_ALLOW_REMOTE_CONFIG` | `--no-npm-allow-remote-config` | `false` | Hosted mode: skip the `allow-remote=all` write to the project `.npmrc`. | | `SOCKET_NO_VLT_INSTALL_CLEANUP` | `--no-vlt-install-cleanup` | `false` | Hosted mode, `rollback`, `remove`: keep stale vlt installed copies. | +| `SOCKET_NO_GEM_NATIVE_REBUILD` | `--no-gem-native-rebuild` | `false` | Agent mode: write a gem patch's native-extension sources without rebuilding the extension. | | `SOCKET_NO_GEM_INSTALL_REFRESH` | `--no-gem-install-refresh` | `false` | Hosted mode, `rollback`, `remove`: leave the project's stale installed gems and cached archives alone. | | `SOCKET_GEM_REFRESH_SHARED` | `--gem-refresh-shared` | `false` | Hosted mode, `rollback`, `remove`: also refresh stale gems in gem homes outside the project. | -| `SOCKET_ALLOW_VENDORED_IN_BAZEL` | `--allow-vendored-in-bazel` | `false` | **Experimental** (Bazel workspaces). Vendored mode: write for a package although the project is in a Bazel workspace, where the build may not find the vendored copy (`vendor_composer_bazel_workspace`, `vendor_nuget_bazel_workspace`). | +| `SOCKET_ALLOW_VENDORED_IN_BAZEL` | `--allow-vendored-in-bazel` | `false` | **Experimental** (Bazel workspaces). Vendored mode: write for a package although the project is in a Bazel workspace, where the build may not find the vendored copy (`vendor_composer_bazel_workspace`, `vendor_pypi_bazel_hub`, `vendor_gem_bazel_hub`, `vendor_nuget_bazel_workspace`). | | `SOCKET_PATCH_VERSION` | `--update ` | (latest) | Local to `--update`; the same pin `install.sh` honors. | | `SOCKET_BATCH_SIZE` | `scan --batch-size` | `500` authenticated / `100` proxy | Local to `scan`. | | `SOCKET_MAX_NEW_PATCHES` | `scan --max-new-patches` | (unlimited) | Local to `scan` (v5.0): a count or `none`; empty is unset, malformed exits 2. | @@ -2545,6 +2547,7 @@ Empty string means unset at every layer: exported-but-empty flag-bound vars are | `SOCKET_VENDOR_REVERT` | `vendor --revert` | `false` | Local to `vendor`. | | `SOCKET_VEX` | `apply --vex` / `scan --vex` / `vendor --vex` | (none) | Embedded OpenVEX output path. The `SOCKET_VEX_*` knobs (`_PRODUCT`, `_NO_VERIFY`, `_NO_BAZEL`, `_DOC_ID`, `_COMPACT`) are shared with the standalone `vex` command; on the host commands they bind to `--vex-product` etc. `SOCKET_VEX_NO_BAZEL` is **Experimental** (Bazel workspaces). | | `SOCKET_VEX_OUTPUT` | `vex --output` / `-O` | (none) | Local to the standalone `vex`: document output path (required with `--json`). | +| `SOCKET_VEX_GRYPE_CONFIG` | `vex --grype-config` | (none) | Local to the standalone `vex`: the Grype config to list the document in, or a switch value for `.grype.yaml`; see "Grype config". | ### Config-layer toggles (env-only) @@ -2644,13 +2647,15 @@ The v3.0 legacy names `SOCKET_PATCH_PROXY_URL` and `SOCKET_PATCH_DEBUG` were rem ## JSON output shapes -Every command's `--json` output is a single object using the envelope below. +Every command's `--json` output is a single object using the envelope below, +except `show` and `report`, which print a document of their own (see +[`show`](#show-inspect-a-patch) and [`report`](#report-report-a-broken-patch)). v5 removes the older per-command shapes. Argument-parsing errors and invalid `--cwd`, `--global-prefix`, or `--manifest-path` values still exit 2 with stderr output and no JSON. `src/json_envelope.rs` defines the serialized names; each command's integration tests check its output. -**One error shape (v5.0, MAJOR).** On every command, every `--json` failure is a full envelope (`command`, `status: "error"`, `dryRun`, `events`, `summary`) whose top-level `error` is a `{code, message}` object — the envelope's `EnvelopeError`. `code` is a stable snake_case tag (see [Top-level `EnvelopeError` codes](#top-level-envelopeerror-codes)); `message` is for humans. No command prints a top-level `errorCode` any more (it moved into `error.code`). Per-event keys are unchanged: `events[*].error` / `events[*].errorCode` stay strings. +**One error shape (v5.0, MAJOR).** On every envelope command (all but `show` and `report`, whose failure is `{command, status: "error", error}` with the same `error` object), every `--json` failure is a full envelope (`command`, `status: "error"`, `dryRun`, `events`, `summary`) whose top-level `error` is a `{code, message}` object — the envelope's `EnvelopeError`. `code` is a stable snake_case tag (see [Top-level `EnvelopeError` codes](#top-level-envelopeerror-codes)); `message` is for humans. No command prints a top-level `errorCode` any more (it moved into `error.code`). Per-event keys are unchanged: `events[*].error` / `events[*].errorCode` stay strings. ### Envelope shape @@ -2724,6 +2729,8 @@ command's integration tests check its output. `files[].path` is the manifest file key (`package/index.js`). A pnpm or vlt package installed as more than one peer-variant store copy is patched (and rolled back) in every copy; a file of a copy other than the one the package resolved to is listed under that copy's on-disk path (`…/.pnpm/foo@1.0.0_react@18.3.1/node_modules/foo/index.js`). So a run that wrote only such a copy reports `applied` with that file, not `already_patched`, and rollback's `rolledBack` event lists the same paths in `files` (not `already_original`). Copies are counted by real location: a pnpm / Bun workspace member's `packages/a/node_modules/foo` link into the root store is the same copy as the store entry, so `apply` / `rollback` visit it once (one event, no phantom `already_patched` / `already_original`), while path targets still match it through the member's link (#633). +**`cause` (additive).** A `failed` event with `errorCode: "apply_failed"` (`apply`, and the nested apply of agent-mode `get` / `scan`) also carries `cause`, a stable snake_case tag for why the patch did not apply: `hash_mismatch`, `file_not_found`, `unsafe_path`, `shared_store`, `conda_build`, `blob_missing`, `blob_corrupt`, `write_failed`, `sidecar_failed`, `no_matching_variant`, the code of a refusal or failed rebuild that has one of its own (`unreadable_file_mode`, `gradle_transform_copy_stale`, …), or `unclassified` for a failure whose path names none. The `errorCode` stays `apply_failed`, new causes may be added, and no other event carries the key. + `details` is intentionally schemaless — different subcommands attach different keys. Consumers MUST treat unknown keys as best-effort metadata and must not break on absence. ### `PatchAction` vocabulary @@ -2912,6 +2919,7 @@ command's integration tests check its output. | `redirect_yarn_classic_dep_manifest_rewritten` | `warnings[]` (warning) | scan/get `--mode hosted` (yarn classic): the served tarball's own `package.json` declares other dependencies than the pinned block's sub-maps, every descriptor already locked; the block's `dependencies:` / `optionalDependencies:` sub-maps are rewritten to match, in the shape yarn 1 writes for that manifest (#591, #1558). | | `vendor_artifact_gitignored` | `failed` | vendor (vlt, the npm-family tarball flavors — npm, pnpm, bun, yarn classic, yarn berry — NuGet, every PyPI flavor, gems, and the JVM trees of Maven, Gradle, sbt and scala-cli): inside a git work tree, `git check-ignore --no-index` reports the new artifact's uuid directory (JVM: its tree root, such as `.socket/vendor/maven2`) as ignored by a rule its own `.gitignore` cannot override (such as a root `.socket/` or `vendor/` rule; the detail names the rule). Remedy: drop that rule for `.socket/vendor/`. Refused before any write, dry run included. A file rule such as `*.tgz`, `*.nupkg`, `*.whl` or `*.jar` is overridden by the `!*` `.gitignore` vendoring writes into the uuid dir or tree root (PyPI's uuid dir also gets the `.gitattributes` that unsets a `*.whl filter=lfs` rule); if a written tarball, directory payload, nupkg or wheel, or a file of a gem's copy, still reads as ignored, the run refuses and removes the uuid dir it created. | | `vendor_gem_copy_gitignored` | warning | vendor (a gem vendored as its own directory by 5.1 or earlier): the in-sync run that writes the missing `/.gitignore` and `.gitattributes` asks git about every file of the copy, and a `.gitignore` the gem ships, which that release kept as shipped, still keeps a file out of the commit (the detail names the rule and the file), so a fresh clone would fail `vendor --check` with `vendor_inventory_mismatch`. The copy and the ledger are left as they are. Remedy: `git add -f ` and commit. Said once, by the run that writes the pair. | +| `vendor_gem_gitignore_neutralized` | warning | vendor / scan / get `--mode vendored` (gem): the patched gem ships a `.gitignore` inside its own tree whose rules would keep git from committing files of the vendored copy, so the run emptied it in the copy: every one in a platform gem's tree, and in a gem's own tree each one whose rules match a file of the copy. The detail names the gem and the emptied files (three, then a count of the rest). The gem is vendored; commit the copy. | | `vendor_artifact_gitignore_unchecked` | warning | vendor (vlt, the npm-family tarball flavors, NuGet, every PyPI flavor and gems): git is installed but could not answer the ignore check for the written vendored directory (it failed to start, ran past 30 s, or `rev-parse` / `check-ignore` exited with an error); the package is vendored and the detail names what failed. Remedy: make sure no ignore rule covers `.socket/` before committing. Git absent, or a project outside any work tree, raises nothing. | | `vendor_ledger_gitignored` | top-level error (exit 1) | vendor / scan / get `--mode vendored` (every backend) and the hosted→vendored eject: inside a git work tree, `git check-ignore` reports the vendor ledger `.socket/vendor/state.json` as ignored by a file rule (such as `state.json`, `*.json` or `**/state.json`; the message names it), so the commit the run asks for would leave it out and no other checkout could `rollback`, `list` or `vendor --revert` the patches (#1638). A ledger git already tracks is never refused. Refused before any write, dry run included. Remedy: drop the rule or add `!.socket/vendor/state.json`. A rule that ignores `.socket/` or `.socket/vendor/` as a directory is `vendor_artifact_gitignored`: per package from the backends that check it themselves (the npm family, NuGet, PyPI, the JVM trees), and as this same run-level refusal when the run includes any other ecosystem. | | `vendor_ledger_entry_missing` | `failed` | vendor (vlt): the only installed copy is vlt's link to a committed vendored directory, but the vendor ledger has no entry for the package; restore `.socket/vendor/state.json` from version control (v5.0: `repair` no longer re-synthesizes it). Replaces the `package_not_installed` skip. | @@ -2926,7 +2934,7 @@ command's integration tests check its output. | `vendor_uuid_mismatch` | `skipped` | repair: the manifest's patch uuid moved past the vendored artifact — a re-vendor (`vendor` / `scan --mode vendored`) is pending; repair does not cross patch generations. | | `content_mismatch_overwritten` | `skipped` (warning) | apply (explicit `--allow-patch-conflicts` / `--force`): a file matched NEITHER beforeHash nor afterHash and was overwritten with the full verified patched content. This includes a file the patch adds (empty beforeHash) that already exists with other content. `--strict` turns this case into a `failed` event instead. Agent-mode `get` / `scan --json` carry it as a `(content_mismatch_overwritten) …` `warnings[]` entry (#1004). | | `vendor_lock_checksums_unsupported` / `vendor_stale_lock_checksum` | `failed` | vendor (gem): an ambiguous/platform CHECKSUMS entry, or a v1-wired lock whose stale token blocks the hot path (run `vendor --revert` + re-vendor). | -| `platform_gem_unsupported` | `failed` | vendor / scan / get `--mode vendored` (gem): a precompiled platform gem that cannot be vendored. `Gemfile.lock` pins the gem as platform gems (`nokogiri (1.18.10-x86_64-linux-gnu)`) and also holds the plain ` ()` entry of the `ruby` platform, which no platform tree serves (the detail names it; `bundle lock --remove-platform ruby` drops it); or it pins the gem as platform gems and its `BUNDLED WITH` is absent or names a Bundler older than 2.3, the oldest the vendored layout is verified on (the detail names the version needed; `bundle update --bundler` re-locks); or the installed copy is a platform gem and the lock names no platform for the gem; or the patch record is for one platform's gem (`?platform=`) and is not vendored as part of its fix: the lock does not pin the gem as platform gems. Nothing is written. A locked platform with no patch of the fix is not this failure: see `vendor_prebuilt_platform_pending`. | +| `platform_gem_unsupported` | `failed` | vendor / scan / get `--mode vendored` (gem): a precompiled platform gem that cannot be vendored. `Gemfile.lock` pins the gem as platform gems (`nokogiri (1.18.10-x86_64-linux-gnu)`) and also holds the plain ` ()` entry of the `ruby` platform, which no platform tree serves (the detail names it and each locked platform that keeps it, `ruby` or one that none of the gem's platform gems serves, with the `bundle lock --remove-platform ` command that drops them); or it pins the gem as platform gems and its `BUNDLED WITH` is absent or names a Bundler older than 2.3, the oldest the vendored layout is verified on (the detail names the version needed; `bundle update --bundler` re-locks); or the installed copy is a platform gem and the lock names no platform for the gem; or the patch record is for one platform's gem (`?platform=`) and is not vendored as part of its fix: the lock does not pin the gem as platform gems. Nothing is written. A locked platform with no patch of the fix is not this failure: see `vendor_prebuilt_platform_pending`. | | `redirect_unattributable` | `skipped` (hosted event) | scan/get `--mode hosted`: the rewriters would pin the patch, but lockfile discovery over the result reads that pin as contested (another lock or requirements file resolves the same version elsewhere, or the pin is not one the package manager consumes), so `vex`, `rollback`, `remove` and `vendor` would refuse it. The candidate is left out of the rewrite, so nothing is written for it; the detail carries discovery's findings. Exit code unchanged. | | `redirect_mirror_unsupported` / `redirect_mirror_url_refused` | `skipped` (hosted event) + `warnings[]` | **Experimental** (patch mirror). scan/get `--mode hosted` with `--patch-mirror-url`: the patch's ecosystem cannot be served through a mirror (`redirect_mirror_unsupported`: Cargo, NuGet; use `--mode vendored`), or its reference could not be moved onto the mirror (`redirect_mirror_url_refused`). Nothing is written for it. See "Patch mirror (experimental)". | | `redirect_mirror_unavailable` | `skipped` (hosted event) + `warnings[]` | **Experimental** (patch mirror). scan/get `--mode hosted` with `--patch-mirror-url`: the mirror did not serve the reference the run asked it for, or could not be reached. That reference is skipped and nothing is written for it. One warning per package, or a single warning about the mirror when it served none of the references it was asked about. | @@ -2969,7 +2977,7 @@ command's integration tests check its output. | `redirect_gem_lock_unconvergeable` | `warnings[]` (warning) | scan/get `--mode hosted` (gem): the lock cannot be edited into the one Bundler writes for the redirected manifest (no `BUNDLED WITH` section, or a merged Bundler < 2.2 `GEM` section whose remotes the manifest's sources do not explain), and Bundler refuses a manifest whose sources its lock does not record under frozen / deployment mode. The gem is refused whole: neither file changes for it. The detail names the lock shape and the way out (`bundle lock` with the current Bundler, then re-run; or `--mode vendored` / `--mode agent`). For a manifest with more than one top-level `source` line, which Bundler 2.2 to 2.7 lock into one `GEM` section naming every source and `bundle lock` does not change, the detail names that cause instead, and the way out is to keep the source that serves the gem as the one top-level `source`, move each other one into a `source "" do … end` block, run `bundle lock` (with Bundler 2.2.25 or later, which the detail says when the lock was written by an earlier 2.2 release, since those keep the one section) and re-run, or `--mode agent`; it does not print the source URLs. The gate counts block-less `source` calls outside every other construct, a computed URL included; a `source` inside a conditional is not counted and keeps the generic detail. | | `redirect_gem_member_registry` | `warnings[]` (warning) | scan/get `--mode hosted` (gem): a gem locked as platform builds was moved, with every build pinned to its own patch, through the registry of one locked build's patch, because the patch its builds were built from is not available to the run. The detail names the gem, the platform and both patches, and says the manifest's `source:` changes if that platform leaves the lock. Not given for a gem that merely stays on such a registry while the source patch is available. | | `gem_fix_unsettled` | `warnings[]` (warning) | scan/get `--mode hosted` and `--mode vendored` (gem): the request that says which fix each platform patch belongs to failed, so the gems the lock names as platform builds were left out of this run's selection (a selection ranked purl by purl could take one build's patch from each fix). The detail names the gems and the failure; nothing is written for them, and a re-run settles them. | -| `redirect_gem_platform_unsupported` | `warnings[]` (warning) | scan/get `--mode hosted` (gem): the lock holds precompiled platform builds of the gem (`nokogiri (1.18.10-x86_64-linux-gnu)`) and no one fix has a usable patch for every one of them (each platform gem has a patch of its own): a locked build has no patch, the builds are patched only by different fixes, the fix's source patch is not available, or its registry does not list what the lock would pin, could not be read, or was not read by the run (a gem is never pinned to a registry the run did not look at); or the lock is the merged layout of Bundler < 2.2. The detail names the locked builds and the case (the builds with no patch and the ones that have one; which fix patches which; what the registry lists), and, for a lock that already takes the gem from a patch registry, the `rollback` command that puts it back upstream. The gem is skipped and the manifest and lock stay byte-identical for it. With a patch of one fix for every locked build the gem is redirected and no warning is given. | +| `redirect_gem_platform_unsupported` | `warnings[]` (warning) | scan/get `--mode hosted` (gem): the lock holds precompiled platform builds of the gem (`nokogiri (1.18.10-x86_64-linux-gnu)`) and no one fix has a usable patch for every one of them (each platform gem has a patch of its own): a locked build has no patch, the builds are patched only by different fixes, or the fix's registry does not list what the lock would pin, could not be read, or was not read by the run (a gem is never pinned to a registry the run did not look at); or the lock is the merged layout of Bundler < 2.2. The detail names the locked builds and the case (the builds with no patch and the ones that have one; which fix patches which; what the registry lists), and, for a lock that already takes the gem from a patch registry, the `rollback` command that puts it back upstream. The gem is skipped and the manifest and lock stay byte-identical for it. With a patch of one fix for every locked build the gem is redirected and this warning is not given. A fix whose source patch is not available to the run is not this skip: the gem is redirected through the registry of a locked build's patch, see `redirect_gem_member_registry`. | | `redirect_gem_inconsistent_plan` | `warnings[]` (warning) | scan/get `--mode hosted` (gem): the rewriter's self-check found the planned manifest and lock disagreeing about the gem, a pair Bundler refuses frozen. Nothing is written for it. Not expected; report it. | | `redirect_gem_frozen_install` | `warnings[]` (warning) | scan/get `--mode hosted` (gem): a pin socket-patch 5.0 / 5.1 wrote as a `source … do` block sits beside a lock that still records the upstream source and that this run changed but could not converge; Bundler rejects the pair under frozen / deployment mode until an unfrozen `bundle install` records the source. Never raised for the `source:` option form, whose lock always follows. | | `redirect_gem_no_lockfile` | `warnings[]` (warning) | scan `--mode hosted` (gem): the project has a `Gemfile` / `gems.rb` but no lock, so the version it resolves is unknown (#1125). Every gem is skipped and the Gemfile stays byte-identical; run `bundle lock` (or `bundle install`), commit the lock, and re-run. | @@ -3108,7 +3116,7 @@ outcome for a selected record, rather than inferring a write from exit 0. | `apply_failed` | apply | apply pipeline error before any patch ran (never a manifest load failure — see `manifest_invalid` / `manifest_unreadable`), or the run-level code of a run whose patches failed. | | `yarn_pnp_unsupported` | apply | A yarn-berry Plug'n'Play layout with an npm patch in scope: refused, nothing written (exit 1). | | `npm_lock_invalid` | scan run-level `warnings[]` | scan (additive): `package-lock.json` / `npm-shrinkwrap.json` is there but is not JSON (truncated, a merge conflict), so the packages it lists were not read. ` is not valid JSON (), so the packages it lists were NOT scanned. Fix or regenerate it (\`npm install --package-lock-only\`) and run again.` Human: one `Warning:` line on stderr, and a scan that then finds no package at all ends `No packages found (see the warning).` instead of advising an install (the same line follows any other unreadable-lockfile or layout warning: `bun_lockb_invalid`, `gem_lock_unsupported`, the Plug'n'Play refusals). Status and exit are unchanged (0): before, the lockfile was not mentioned at all. The hosted in-memory engine reports the same code among its warnings. | -| `repair_failed` | repair | repair pipeline error (an invalid `--download-mode`); never a manifest load failure. | +| `repair_failed` | repair | No longer a `--json` `error.code`: its one source, an invalid `--download-mode`, went with that flag in v5.0. It remains the telemetry `error_code` of a repair with failed events and no top-level error (see [Telemetry](#telemetry)); never a manifest load failure. | | `remove_failed` | remove | Could not write the modified manifest. | | `not_found` | remove | `status: "notFound"`: no manifest entry, vendor-ledger entry or hosted pin matches the identifier (exit 1). Never with the vendor ledger unreadable: that is `vendor_state_unreadable`. | | `rollback_failed` / `vendor_revert_failed` / `hosted_revert_failed` | remove | The in-place rollback, the vendored revert or the hosted upstream restore failed before the manifest was touched (exit 1). | diff --git a/docs/configuration.md b/docs/configuration.md index c0b4c2206b..cb0ce2a9c0 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -124,6 +124,7 @@ Every event has these fields: | `context.version` | The Socket Patch version | | `context.platform`, `context.arch` | Operating system and CPU architecture (for example `linux`, `x86_64`) | | `context.command` | The subcommand (`scan`, `apply`, …) | +| `context.ci` | `true` when the run is in CI: `CI` is set to anything but empty, `0` or `false`, or `GITHUB_ACTIONS` is set. It does not say which provider, repository or job | | `context.channel` | How this copy of Socket Patch was installed: `npm`, `cargo`, `homebrew`, `pypi` or `launcher_cache` when the binary sits where that tool puts it, and `standalone` for anywhere else (the install script, a downloaded binary, a container image). It names the channel only, never the path, and is left out when the binary cannot read its own location | | `metadata` | The per-event fields in the table below, and nothing else | | `error.type`, `error.message` | Failure events only. URLs in the message are redacted (credentials, grant tokens, signed query values), your home directory is replaced by `~`, and a message longer than 1,000 characters is cut. The message can still quote a package name or a path in the project | @@ -157,9 +158,10 @@ patch fails to apply, or is rolled back, far more often than the others: | Field | Value | | --- | --- | -| `patches` | Up to 50 entries, failed ones first. Each is `{uuid, ecosystem, mode, outcome}`: the patch UUID, the ecosystem name (`npm`, `pypi`, …), the mode it was patched in (`agent`, `hosted`, `vendored`), and what the run did (`applied`, `downloaded`, `rolled_back`, `removed`, `verified` on a dry run, `skipped`, `failed`). A `skipped` or `failed` entry adds `code`, the reason code `--json` reports (for example `already_patched`) | +| `patches` | Up to 50 entries, failed ones first. Each is `{uuid, ecosystem, mode, outcome}`: the patch UUID, the ecosystem name (`npm`, `pypi`, …), the mode it was patched in (`agent`, `hosted`, `vendored`), and what the run did (`applied`, `downloaded`, `rolled_back`, `removed`, `rebuilt`, `verified` on a dry run, `skipped`, `failed`). A `skipped` or `failed` entry adds `code`, the reason code `--json` reports (for example `already_patched`) | | `patches_truncated` | `true` when the run acted on more than 50 patches | | `outcomes` | How many patches ended each way, over the whole run | +| `failure_codes` | How many failed patches had each `code`, over the whole run; left out when none failed | | `ecosystems`, `modes` | The distinct ecosystems and modes of those patches | A patch UUID is Socket's identifier for one patch, and each patch is for one diff --git a/docs/ecosystems.md b/docs/ecosystems.md index 9021ae459e..1425438fab 100644 --- a/docs/ecosystems.md +++ b/docs/ecosystems.md @@ -18,11 +18,11 @@ below is about what a package manager installs and builds. | Ecosystem | agent (`--mode agent`) | vendored (`--mode vendored`) | hosted (`--mode hosted`) | |-----------|------------------------|------------------------------|--------------------------| -| npm (`npm`) — pnpm / yarn / berry / bun / vlt | ✅ any install layout, vlt's `node_modules/.vlt` store included (every store copy, copy-on-write) | ✅ seven lockfile flavors: package-lock, yarn classic, yarn berry (node-modules linker; PnP refused), pnpm v9, pnpm legacy v5.4/v6.0 (`pnpm 7/8` — frozen installs are path-bound because those majors absolutize `file:` override specifiers; moved checkouts run one `pnpm install --offline --no-frozen-lockfile`, surfaced as `vendor_pnpm_legacy_absolute_specifier`), bun text `bun.lock` lockfileVersion 0/1/2/3 and native binary `bun.lockb` revisions 1/2/3 (binary locks stay binary; text workspace vendoring requires lockfileVersion 2 — see [Bun compatibility](testing/bun-compatibility.md)), vlt `vlt-lock.json` lockfileVersion 0/1 (patched package directories for direct dependencies of the root or a workspace member; transitive targets refused — see [vlt notes](#npm-vlt-notes)). Rush monorepos on pnpm 9 and newer are wired through `pnpm-config.json` and each directly-depending project's `package.json` — see [Rush notes](#npm-rush-monorepos) | ✅ package-lock / npm-shrinkwrap, pnpm-lock.yaml and legacy shrinkwrap.yaml (pnpm majors 1–12; block and flow resolutions), yarn classic, yarn berry, bun, vlt (`vlt-lock.json` without `lockfileVersion`, 0 or 1) — pnpm, berry, bun and vlt carry constraints, see [npm hosted-mode notes](#npm-hosted-mode-notes) and [vlt notes](#npm-vlt-notes) | -| PyPI (`pypi`) — uv / poetry / pdm / pipenv / pip | ✅ in place + `.dist-info/RECORD` rows rewritten (see [PyPI: `RECORD` after an agent-mode patch](#pypi-record-after-an-agent-mode-patch)) | ✅ uv project/script locks, PEP 751 `pylock.toml` / `pylock..toml`, poetry, pdm, pipenv (Pipenv 2018 or later — every `Pipfile.lock` category is rewired, lock-only checkouts included; Pipenv 2023+ does not hash-check local wheels — `vendor_integrity_unverified`; Pipenv 2023.7.9+ exports the vendored wheel without a hash, so `pipenv requirements --hash` output fails pip's hash-checking mode — `pypi_pipenv_hash_export_unsupported`; a venv still holding the upstream release is reported as `pypi_pipenv_stale_install`; see [Pipenv compatibility](testing/pipenv-compatibility.md)), and requirements.txt. Native uv vendoring requires uv ≥ 0.2.35 (the `[[package]]` lock grammar); hosted mode covers native `uv.lock` from uv 0.1.45 (the first release whose `uv lock` writes one) and requirements from uv 0.0.5; see [uv compatibility](testing/uv-compatibility.md). Declined where a rules_python hub of a Bazel workspace reads the file, see [Bazel workspaces: PyPI and RubyGems vendored mode](#bazel-workspaces-pypi-and-rubygems-vendored-mode) | ✅ requirements.txt including hash continuations, uv project/script locks, and PEP 751 locks. Version/source ambiguity is refused; see [uv compatibility](testing/uv-compatibility.md). Poetry 1.x and 2.x locks are supported; Poetry 0.x ignores URL sources and is refused. See [Poetry compatibility](testing/poetry-compatibility.md). Pipenv `Pipfile.lock` (pipfile-spec 6 — Pipenv 7 and later; `path` references for 7–11, `file` from 2018; lock-only checkouts and Pipenv's out-of-tree venv are discovered; a warm venv that Pipenv will not reinstall over warns `redirect_pypi_stale_install`; see [Pipenv compatibility](testing/pipenv-compatibility.md)). `pdm.lock` is supported for the lock formats PDM 0.12–1.4 and 2.8.1+ write (`lock_version` 2 / 4.3–4.5.1); the identity-losing 3.1 / 4.0–4.2 formats (PDM 1.8–2.7) are refused. PDM 2.8.0 writes an indistinguishable `4.3` lock but shares that identity-loss bug, so a rewritten 2.8.0 lock crashes `pdm sync` — upgrade to ≥ 2.8.1. See [PDM compatibility](testing/pdm-compatibility.md). | +| npm (`npm`) — pnpm / yarn / berry / bun / vlt | ✅ any `node_modules` install layout, vlt's `node_modules/.vlt` store included (every store copy, copy-on-write); Yarn Plug'n'Play is not supported in any mode (`yarn_pnp_unsupported`, see yarn berry in the [npm hosted-mode notes](#npm-hosted-mode-notes)) | ✅ seven lockfile flavors: package-lock, yarn classic, yarn berry (node-modules linker; PnP refused), pnpm v9, pnpm legacy v5.4/v6.0 (`pnpm 7/8` — frozen installs are path-bound because those majors absolutize `file:` override specifiers; moved checkouts run one `pnpm install --offline --no-frozen-lockfile`, surfaced as `vendor_pnpm_legacy_absolute_specifier`), bun text `bun.lock` lockfileVersion 0/1/2/3 and native binary `bun.lockb` revisions 1/2/3 (binary locks stay binary; text workspace vendoring requires lockfileVersion 2 — see [Bun compatibility](testing/bun-compatibility.md)), vlt `vlt-lock.json` lockfileVersion 0/1 (patched package directories for direct dependencies of the root or a workspace member; transitive targets refused — see [vlt notes](#npm-vlt-notes)). Rush monorepos on pnpm 9 and newer are wired through `pnpm-config.json` and each directly-depending project's `package.json` — see [Rush notes](#npm-rush-monorepos) | ✅ package-lock / npm-shrinkwrap, pnpm-lock.yaml and legacy shrinkwrap.yaml (pnpm majors 1–12; block and flow resolutions), yarn classic, yarn berry, bun, vlt (`vlt-lock.json` without `lockfileVersion`, 0 or 1) — pnpm, berry, bun and vlt carry constraints, see [npm hosted-mode notes](#npm-hosted-mode-notes) and [vlt notes](#npm-vlt-notes) | +| PyPI (`pypi`) — uv / poetry / pdm / pipenv / pip | ✅ in place + `.dist-info/RECORD` rows rewritten (see [PyPI: `RECORD` after an agent-mode patch](#pypi-record-after-an-agent-mode-patch)) | ✅ uv project/script locks, PEP 751 `pylock.toml` / `pylock..toml`, poetry, pdm (the `lock_version`s hosted mode accepts; the `4.6.0` lock of PDM 2.29.8 and later is refused), pipenv (Pipenv 2018 or later — every `Pipfile.lock` category is rewired, lock-only checkouts included; Pipenv 2023+ does not hash-check local wheels — `vendor_integrity_unverified`; Pipenv 2023.7.9+ exports the vendored wheel without a hash, so `pipenv requirements --hash` output fails pip's hash-checking mode — `pypi_pipenv_hash_export_unsupported`; a venv still holding the upstream release is reported as `pypi_pipenv_stale_install`; see [Pipenv compatibility](testing/pipenv-compatibility.md)), and requirements.txt. Native uv vendoring requires uv ≥ 0.2.35 (the `[[package]]` lock grammar); hosted mode covers native `uv.lock` from uv 0.1.45 (the first release whose `uv lock` writes one) and requirements from uv 0.0.5; see [uv compatibility](testing/uv-compatibility.md). Declined where a rules_python hub of a Bazel workspace reads the file, see [Bazel workspaces: PyPI and RubyGems vendored mode](#bazel-workspaces-pypi-and-rubygems-vendored-mode) | ✅ requirements.txt including hash continuations, uv project/script locks, and PEP 751 locks. An environment that already holds the upstream release is left as it is and reported as `redirect_pypi_stale_install` (the same run's `--vex` leaves the package out): install into a fresh virtualenv, or uninstall the package before installing again. Version/source ambiguity is refused; see [uv compatibility](testing/uv-compatibility.md). Poetry 1.x and 2.x locks are supported; Poetry 0.x ignores URL sources and is refused. See [Poetry compatibility](testing/poetry-compatibility.md). Pipenv `Pipfile.lock` (pipfile-spec 6 — Pipenv 7 and later; `path` references for 7–11, `file` from 2018; lock-only checkouts and Pipenv's out-of-tree venv are discovered; a warm venv that Pipenv will not reinstall over warns `redirect_pypi_stale_install`; see [Pipenv compatibility](testing/pipenv-compatibility.md)). `pdm.lock` is supported for the lock formats PDM 0.12–1.4 and 2.8.1–2.29.7 write (`lock_version` 2 / 4.3–4.5.1); the identity-losing 3.1 / 4.0–4.2 formats (PDM 1.8–2.7) are refused, and so is the `4.6.0` format PDM 2.29.8 and later write (`redirect_pdm_refused`; vendored mode refuses it with `pypi_pdm_lock_version_unsupported`), which is why both modes are Experimental for PDM, see [v5 support tiers](#v5-support-tiers). PDM 2.8.0 writes an indistinguishable `4.3` lock but shares that identity-loss bug, so a rewritten 2.8.0 lock crashes `pdm sync` — upgrade to ≥ 2.8.1. See [PDM compatibility](testing/pdm-compatibility.md). | | pixi (`pypi`) — the Python packages of a pixi project, from conda channels or PyPI | ✅ in place, in every environment under `.pixi/envs`: PyPI wheels and pure-Python conda packages (compiled conda packages are not supported yet and are skipped) — see [PyPI: pixi projects](#pypi-pixi-projects) | ❌ refused (`pypi_no_requirements` / `pypi_pyproject_only`, which name agent mode) | ❌ nothing rewritten (`redirect_pypi_pixi_project` names agent mode) | | Cargo (`cargo`) | ✅ in-place + `.cargo-checksum.json` rewrite (shared registry-cache caveat — see [Cargo: shared registry cache](#cargo-shared-registry-cache)) | ✅ `[patch.crates-io]` path entry in the root `Cargo.toml` (v5; per-version Socket keys; pre-v5 `.cargo/config*` wiring migrates on re-run) | ✅ per-patch sparse registry (`[registries.socket-patch-]` + Cargo.lock source/checksum); needs cargo 1.68+ (sparse registries) — a project whose `rust-version` or `rust-toolchain[.toml]` declares an older cargo is refused (`redirect_cargo_old_cargo`), use `--mode vendored`; direct dependencies only — a crate another dependency also pulls in is refused, use `--mode vendored`; a crate the user overrides with `[patch]` (path, git or another registry) is refused too, the override is left alone; a `cargo vendor` or `cargo local-registry` project (crates.io replaced by an on-disk source in the project's, a parent directory's or `$CARGO_HOME`'s `.cargo/config*`) is refused, use agent mode; with no `Cargo.lock` the graph is unknown, so only a project whose sole dependency is the patched crate is redirected; in a Bazel workspace a crate is not pinned while a rules_rust hub reads the project's Cargo files without its cargo config (`redirect_cargo_bazel_config_unread`), see [Bazel workspaces: Cargo](#bazel-workspaces-cargo) | -| RubyGems (`gem`) | ✅ in place | ✅ Gemfile + Gemfile.lock path pair (a CRLF `Gemfile.lock`, as a `core.autocrlf` checkout leaves it, is edited and reverted in its own line ending, and a lock mixing CRLF and LF fails closed; a gem locked as precompiled platform gems is vendored from the patched platform gems of its fix, one patch per platform, see [Ruby gems: native extensions](#ruby-gems-native-extensions); `Gemfile` spelling only — a `gems.rb` twin, which bundler ≥ 2 loads instead, or a `BUNDLE_GEMFILE`-configured manifest makes vendoring refuse with `gemfile_not_loaded` before any write); declined where a rules_ruby hub of a Bazel workspace reads the pair, see [Bazel workspaces: PyPI and RubyGems vendored mode](#bazel-workspaces-pypi-and-rubygems-vendored-mode) | ✅ a `source:` option on the gem's own declaration, the lock converged to match (see [Ruby gems: hosted mode](#ruby-gems-hosted-mode)) — edits `gems.rb` + `gems.locked` or `Gemfile` + `Gemfile.lock`, whichever the project holds (a `Gemfile` + `gems.rb` twin is refused with `redirect_gem_twin_manifest_ambiguous`: bundler 1.x loads the `Gemfile`, bundler ≥ 2 loads `gems.rb`, and nothing in the project says which bundler installs it; bundler 4's `BUNDLE_LOCKFILE` (environment, app config or global config) naming any other lock is refused with `redirect_gem_bundle_lockfile_unsupported`, as is vendoring with `gemfile_not_loaded`; spellings that diverge beyond Socket's own edits fail closed with `redirect_gem_gemfile_spellings_diverge`; `BUNDLE_GEMFILE` from `.bundle/config` (which outranks the environment, as in bundler), the environment, or the global `~/.bundle/config` / `$BUNDLE_USER_CONFIG` (lowest, as in bundler) is followed when it names the project's `Gemfile` / `gems.rb`, and any other configured manifest is refused with `redirect_gem_bundle_gemfile_unsupported`); a Bundler all-source, exact-source or hostname mirror in app config or the scan environment can capture the patch registry, so the redirect is refused with `redirect_gem_mirror_overrides_source` without printing mirror URLs (scope mirrors to `mirror.https://rubygems.org`; user-global config and mirrors set only in a later install environment are not inspected); the `CHECKSUMS` pin needs bundler ≥ 2.6 (an older lock is still pinned by source and installs frozen; the run says once, with `redirect_gem_no_checksums_section`, that it cannot record the checksums); a stale pre-redirect materialization that `bundle install` would reuse instead of refetching is replaced with the verified patched gem when it is the project's own, else flagged `redirect_gem_stale_install` with the remedy (see "Ruby gems: gems already installed" below and CLI_CONTRACT.md's "Gem stale-install guard"). In a Bazel workspace whose rules_ruby call holds the gem to another sha256 in `gem_checksums`, or has a `gem_checksums` that is not written out in the call, nothing is written for it (`redirect_bazel_gem_checksums_pinned`); see [Bazel workspaces: RubyGems](#bazel-workspaces-rubygems) | +| RubyGems (`gem`) | ✅ in place | ✅ Gemfile + Gemfile.lock path pair (a CRLF `Gemfile.lock`, as a `core.autocrlf` checkout leaves it, is edited and reverted in its own line ending, and a lock mixing CRLF and LF fails closed; a gem locked as precompiled platform gems is vendored from the patched platform gems of its fix, one patch per platform, when that fix has a patch for every platform the lock names, and is skipped with `vendor_prebuilt_platform_pending` otherwise, see [Ruby gems: native extensions](#ruby-gems-native-extensions); `Gemfile` spelling only — a `gems.rb` twin, which bundler ≥ 2 loads instead, or a `BUNDLE_GEMFILE`-configured manifest makes vendoring refuse with `gemfile_not_loaded` before any write); declined where a rules_ruby hub of a Bazel workspace reads the pair, see [Bazel workspaces: PyPI and RubyGems vendored mode](#bazel-workspaces-pypi-and-rubygems-vendored-mode) | ✅ a `source:` option on the gem's own declaration, the lock converged to match (see [Ruby gems: hosted mode](#ruby-gems-hosted-mode)) — edits `gems.rb` + `gems.locked` or `Gemfile` + `Gemfile.lock`, whichever the project holds (a `Gemfile` + `gems.rb` twin is refused with `redirect_gem_twin_manifest_ambiguous`: bundler 1.x loads the `Gemfile`, bundler ≥ 2 loads `gems.rb`, and nothing in the project says which bundler installs it; bundler 4's `BUNDLE_LOCKFILE` (environment, app config or global config) naming any other lock is refused with `redirect_gem_bundle_lockfile_unsupported`, as is vendoring with `gemfile_not_loaded`; spellings that diverge beyond Socket's own edits fail closed with `redirect_gem_gemfile_spellings_diverge`; `BUNDLE_GEMFILE` from `.bundle/config` (which outranks the environment, as in bundler), the environment, or the global `~/.bundle/config` / `$BUNDLE_USER_CONFIG` (lowest, as in bundler) is followed when it names the project's `Gemfile` / `gems.rb`, and any other configured manifest is refused with `redirect_gem_bundle_gemfile_unsupported`); a Bundler all-source, exact-source or hostname mirror in app config or the scan environment can capture the patch registry, so the redirect is refused with `redirect_gem_mirror_overrides_source` without printing mirror URLs (scope mirrors to `mirror.https://rubygems.org`; user-global config and mirrors set only in a later install environment are not inspected); the `CHECKSUMS` pin needs bundler ≥ 2.6 (an older lock is still pinned by source and installs frozen; the run says once, with `redirect_gem_no_checksums_section`, that it cannot record the checksums); a stale pre-redirect materialization that `bundle install` would reuse instead of refetching is replaced with the verified patched gem when it is the project's own, else flagged `redirect_gem_stale_install` with the remedy (see "Ruby gems: gems already installed" below and CLI_CONTRACT.md's "Gem stale-install guard"). In a Bazel workspace whose rules_ruby call holds the gem to another sha256 in `gem_checksums`, or has a `gem_checksums` that is not written out in the call, nothing is written for it (`redirect_bazel_gem_checksums_pinned`); see [Bazel workspaces: RubyGems](#bazel-workspaces-rubygems) | | Go (`golang`) | ✅ `go.mod` `replace` → `.socket/go-patches/` — see [Go: directory replaces and go.sum](#go-directory-replaces-and-gosum) | ✅ `replace` → the committed vendor tree | ✅ (free tier) fork-style `replace` → `patch.socket.dev/gopatch/` + committed `go.sum` pin; see [Go notes](#go-directory-replaces-and-gosum). Paid hosted patches are unsupported; `redirect_golang_unsupported` names the vendored remedy | | Maven (`maven`) — Maven and Gradle | ✅ in place in every copy the build consumes: each `~/.m2` copy it reads and each Gradle `files-2.1` copy; `~/.m2` `.sha1`/`.md5` sidecars are rewritten, Gradle copies get advisories; jar-member records swap in the patch service's whole jar — prefer vendored / hosted, see [Maven & NuGet caveats](#maven--nuget-caveats) and [Gradle](#gradle) | ✅ suffixed Maven repository (`-socket.` pin + `.mvn/maven.config` + fallback file repository) for every pom root, single-module or reactor, or Gradle 6.8+ same-GAV repository with settings wiring and SHA-256 checks (a root with both `pom.xml` and a Gradle build wires both); see [JVM vendoring](design/maven-vendoring.md) and [Gradle](#gradle) | ✅ fail-closed by a Socket-only `-socket.` suffix: pom projects get a pinned `` (`${property}` versions are refused); Gradle 6.8+ builds get an owned settings script, lock-entry rewrites and a resolution tripwire — see [Maven & NuGet caveats](#maven--nuget-caveats) and [Gradle](#gradle) | | sbt / Mill / scala-cli (`maven`) | ✅ Coursier caches (sbt 1.3+, sbt 2, Mill, scala-cli) and Ivy caches (sbt 0.13–1.2, `useCoursier := false`) patched in place, Coursier checksum sidecars resynced — see [Scala build tools](#scala-build-tools-sbt-mill-scala-cli) | ✅ sbt 0.13.18+: generated `socket-patch-vendor.sbt` over the committed suffixed `.socket/vendor/maven2` tree; scala-cli directory builds: owned `socket-patch.scala` + same-GAV `.socket/vendor/coursier` tree (Linux / macOS); Mill: not wired (agent or hosted guidance) | ✅ sbt 0.13.18+: one generated `socket-patch.sbt`, gated on sbt's own `sbt update` records; Mill / scala-cli: paste-able snippets only (`redirect_mill_manual_snippet`, `redirect_scala_cli_manual_snippet`) | @@ -47,24 +47,26 @@ below is about what a package manager installs and builds. The matrix above lists what each mode handles. This table says how much that support is worth for v5.x. v5 removes no format or mode: everything in the matrix works in v5.0 and keeps working through v5.x. The Experimental tier is the exception: what it covers is -new in v5.x and can change. +new in v5.x, or was moved down to it (see the PDM note under the table), and can change. | Tier | Meaning | |---|---| | **Supported** | The default. Covered by CI. A regression is a release blocker. | | **Beta** | Works for the build shapes documented on this page and is tested in CI. Some shapes outside them are refused, and the open issues for that ecosystem describe shapes that are patched incompletely. Preview with `--dry-run` and confirm with a real build before you commit the result. | | **Legacy** | A format that the package manager itself has retired. socket-patch keeps reading and writing it in v5 and still fixes its bugs, but adds no new features for it. Prefer the upgrade path in the table below. | -| **Experimental** | New, and tested in CI only on the build shapes its section lists. What a command does, what it writes and how it words a refusal can change in any v5.x release, and a regression is not a release blocker. Preview with `--dry-run` and confirm with a real build before you commit the result. | +| **Experimental** | New, or moved down from a higher tier, and tested in CI only on the build shapes its section lists. What a command does, what it writes and how it words a refusal can change in any v5.x release, and a regression is not a release blocker. Preview with `--dry-run` and confirm with a real build before you commit the result. | | **Not supported** | Refused with an error code that names the remedy. | | Ecosystem / format | agent | vendored | hosted | |---|---|---|---| -| npm: package-lock / npm-shrinkwrap, yarn classic, yarn berry, pnpm lock v9, text `bun.lock`, vlt lock eras C–F | Supported | Supported | Supported | +| npm: package-lock / npm-shrinkwrap, yarn classic, yarn berry (Plug'n'Play is the next row), pnpm lock v9, text `bun.lock`, vlt lock eras C–F | Supported | Supported | Supported | +| npm: Yarn Plug'n'Play (use `nodeLinker: node-modules`, or `yarn patch `) | Not supported | Not supported | Not supported (a checkout with no PnP loader on disk is not refused: its lock is rewritten, see yarn berry in the [npm hosted-mode notes](#npm-hosted-mode-notes)) | | npm: binary `bun.lockb` | Supported (agent mode patches `node_modules`, not the lock) | Legacy | Legacy | | npm: pnpm 7/8 locks (lockfileVersion 5.4 / 6.0) | Supported | Legacy | Supported | | npm: older pnpm locks (pnpm 1–6, `shrinkwrap.yaml`) | Supported | Not supported | Supported (see [npm hosted-mode notes](#npm-hosted-mode-notes) for the version floors) | | npm: vlt lock eras A0–B (before 1.0.0-rc.15) | Supported | Legacy (A0 is refused) | Legacy | -| PyPI, Cargo, RubyGems, Go, NuGet, Composer | Supported | Supported | Supported, with the per-ecosystem limits in the matrix | +| PyPI (PDM is the next row), Cargo, RubyGems, Go, NuGet, Composer | Supported | Supported | Supported, with the per-ecosystem limits in the matrix | +| PyPI: PDM (`pdm.lock`) | Supported | Experimental: the lock of PDM 2.29.8 and later is refused | Experimental, the same | | Maven (`pom.xml` builds) | Supported, with the [sidecar caveats](#maven--nuget-caveats) | Beta | Beta | | Gradle | Supported, with the [`files-2.1` advisories](#gradle) | Beta (Gradle 6.8+) | Beta (Gradle 6.8+) | | sbt / Mill / scala-cli | Beta | Beta (sbt and scala-cli directory builds; Mill is not wired) | Beta (Mill and scala-cli get manual snippets only) | @@ -83,6 +85,14 @@ and [`pm:gradle`](https://github.com/SocketDev/socket-patch/issues?q=is%3Aissue+ issues track them. Before you rely on a JVM `--vex` attestation, run the build and check that it resolves the patched artifact of each patched dependency. +**Hosted and vendored PDM are Experimental from v5.2.0**, a move down from Supported. +PDM 2.29.8 and later write `pdm.lock` with `lock_version = "4.6.0"`, which both modes +refuse and leave unchanged (`redirect_pdm_refused` in hosted mode, +`pypi_pdm_lock_version_unsupported` in vendored mode), so neither patches a lock the +current PDM writes. The locks of PDM 0.12–1.4 and 2.8.1–2.29.7 (`lock_version` 2 and +4.3–4.5.1) are rewritten as before, and agent mode does not depend on the lock format. +See [PDM compatibility](testing/pdm-compatibility.md). + ### Legacy formats: upgrade and undo Each Legacy format has an upgrade path and an undo path. Both work in v5: @@ -99,7 +109,8 @@ Each Legacy format has an upgrade path and an undo path. Both work in v5: and do not make a format refuse that v5.0 accepts. Bug fixes can still refuse a specific input that would otherwise produce a wrong result. Each refusal has an error code and a remedy. -- **The Experimental tier is outside that rule.** What it covers was not in v5.0. A v5.x +- **The Experimental tier is outside that rule.** What it covers was not in v5.0, or was + moved down to the tier. A v5.x release can change what its commands do, write, refuse and report there, and says so in the release notes. - **A tier can move up** (Experimental to Beta, Beta to Supported) in any release. A move down, or a new @@ -182,7 +193,9 @@ Each Legacy format has an upgrade path and an undo path. Both work in v5: node with no `resolved` but the patched `integrity` (what npm 7–12 `npm install` leaves on a vendored v2 lock, since npm never writes a `file:` `resolved` there) still counts as wired for `vex` and - `vendor --check`: npm 6 fails closed on that pin. Vendoring + `vendor --check`: npm 6 fails closed on that pin. After a vendored scan + on a machine that already has `node_modules`, run `npm ci`: `npm install` + can report `up to date` and keep the upstream package. Vendoring needs a lockfileVersion 2/3 lock (npm 6 still installs a vendored v2 lock from its legacy mirror, alias nodes included) and rewires both locks in npm 12's dual-lock state. Majors 6–12 are measured in @@ -328,7 +341,14 @@ Each Legacy format has an upgrade path and an undo path. Both work in v5: patched tarball. pnpm writes an overridden release under its own key (`picomatch@socket-58f14d5a:2.3.1`) and records the overrides in the lock, so the CLI rewrites `pnpm-lock.yaml` to exactly that shape; a real pnpm - re-locks it without changing a byte. Commit both files. + re-locks it without changing a byte. Commit both files. pnpm installs that + lock only while the workspace file declares both entries: with the override + gone a frozen install fails (`ERR_PNPM_LOCKFILE_CONFIG_MISMATCH`) and a plain + install takes the upstream release back, and with the registry gone nothing + installs (`ERR_PNPM_MISSING_NAMED_REGISTRY`). `vex` then reports the pin as + `patched_ref_invalid`, naming what the file lacks, and attests the package + only from an installed tree whose every copy verifies; a hosted re-scan + declares the route again. A registry is named after its patch: `socket-` and the first eight hex digits of the patch UUID. If two patches of the project start with the same @@ -483,7 +503,9 @@ Each Legacy format has an upgrade path and an undo path. Both work in v5: packages that have no address (one is enough), pnpm pins that do not prove 11.20, a Bazel hub that reads the lock in a shape that is not routed ([Bazel workspaces: npm](#bazel-workspaces-npm)), an override of yours for a - patched package, a workspace file or a lock entry the edit cannot follow. A project with no pnpm pin is told that + patched package, a workspace file or a lock entry the edit cannot follow (an importer + that takes the patched release through `catalog:`, for one). + A project with no pnpm pin is told that pinning pnpm 11.20 or later (for example with `packageManager`) and re-running the scan switches it to the registry route (not under `--no-trust-lockfile-config`, which writes neither setting). The key goes in @@ -496,7 +518,9 @@ Each Legacy format has an upgrade path and an undo path. Both work in v5: not); any other value (empty, `null`, `undefined`, `0`) is ignored for the file, so the CLI ignores it too and writes the key. This skips registry re-verification for the whole lock; tarball integrity - remains enforced. pnpm <=10 needs neither setting. For both, an existing + remains enforced. pnpm <=10 needs neither setting. On pnpm 9 and 10, + `pnpm update` and `pnpm dedupe` resolve a hosted entry from the registry + again and drop the pin; re-run the scan afterwards. For both, an existing `pnpm-workspace.yaml` with no keys (empty or only comments) gets the root-only `packages:` list with the key, because pnpm 8–10.4 refuse a workspace file that has keys but no `packages`. When the lock lists @@ -602,9 +626,17 @@ Each Legacy format has an upgrade path and an undo path. Both work in v5: the restored registry entry into such an entry (or into an `npm:` alias entry of the package), as yarn writes two entries with one resolution, so `--immutable` installs keep passing; `vendor --revert` does the same for a - vendored package. The node-modules linker - is e2e-covered; PnP is untested for hosted — the lock rewrite fires, but PnP's - `.yarn/cache` resolution isn't exercised. CRLF locks — what yarn writes on Windows, + vendored package. The node-modules linker (`nodeLinker: node-modules` in + `.yarnrc.yml`) is e2e-covered. Yarn Plug'n'Play is not supported in any + mode: switch to the node-modules linker, or keep Plug'n'Play and patch + with `yarn patch `, as the warning says. In a project that holds a PnP loader (`.pnp.cjs`, + `.pnp.js`, `.pnp.loader.mjs`) while `nodeLinker` is `pnp` or unset, `scan` in + every mode reads no npm dependency, patches none, warns + `yarn_pnp_unsupported` and exits 0; `apply` exits 1 with the same code; and + `vendor` refuses with `vendor_yarn_berry_unsupported`, as it does on a PnP + checkout with no loader yet. A hosted scan of such a loader-less checkout + still rewrites the lock, and that state is not supported either. + CRLF locks — what yarn writes on Windows, and what a `core.autocrlf` checkout produces anywhere — are rewritten in their own line ending (a BOM is kept); a lock or root `package.json` mixing CRLF and LF is refused (`redirect_yarn_berry_mixed_line_endings`, the same decision vendored mode @@ -5328,6 +5360,14 @@ real Bazel, written by hand and written by the command. `scan --mode hosted` makes Bundler install a patched gem from that patch's own gem source on the patch registry. It edits the `Gemfile` (or `gems.rb`) and its lock, and nothing else. +Hosted mode is the recommended mode for a Ruby project. One limit to know, which vendored +mode shares: a gem the lock pins only as precompiled platform gems (nokogiri under a +default Bundler lock) is patched only when one fix has a published patch for every platform +the lock names. Otherwise the run changes nothing for that gem, warns and still exits 0 (see +"Precompiled platform gems" below); `--mode agent` patches such a gem where it is installed, +rebuilding its extension from source (see +[Ruby gems: native extensions](#ruby-gems-native-extensions)). + **The Gemfile.** The gem's declaration gains one option, `source:`, after its last argument. The rest of the declaration stays byte for byte: the version requirement, the other options, the quoting, the comment, the indentation and the `group` block around it. @@ -5766,14 +5806,14 @@ it names commits the whole copy. Vendored mode rewrites one top-level `gem` line to a `path:` source, and Bundler builds nothing for a path-sourced gem. It refuses a gem that doesn't fit and changes nothing for it; the other gems of the run are still vendored, and the run exits 1. These four refusals name another mode -that can patch the gem: +that can patch the gem, or the change that lets vendored mode take it: | Code | The gem | What the error offers | |---|---|---| | `gemfile_declaration_not_editable` ("is indented") | is declared inside a block: `group :test do`, `platforms … do`, a conditional. Every Rails Gemfile declares its development and test gems this way. | Move the declaration to the top level (for a plain `group` block the error spells the option that replaces it, `group: :test`), or patch the gem with `--mode hosted`, which edits a declaration where it is. Inside a `source`, `git`, `github` or `path` block hosted mode refuses the gem too, and the error names `--mode agent`. | | `gemfile_declaration_not_editable` ("as a direct dependency") | is a direct dependency the Gemfile declares out of sight: in a gemspec (a gem library's development dependency), an `eval_gemfile`d file, a loop. | Declare it with one literal `gem ""` line in the Gemfile (above `gemspec`, where the Gemfile has that directive), in place of any other `gem` call that declares it, or patch the gem with `--mode agent`. Hosted mode refuses a gem declared in those places too. | | `native_extensions_unsupported` | builds a native extension (puma, bootsnap). | `--mode hosted` or `--mode agent`. Both build the extension. Only `--mode agent` when the declaration picks the gem's source (a `source`, `git`, `github` or `path` block or option), which hosted mode refuses. | -| `platform_gem_unsupported` | is installed as a precompiled platform build (`nokogiri-1.18.3-x86_64-linux-gnu`). | `--mode agent`. Hosted mode refuses a precompiled build too. | +| `platform_gem_unsupported` | is locked for the `ruby` platform alone while the installed copy is a precompiled platform build (`nokogiri-1.18.3-x86_64-linux-gnu`); or is locked as precompiled platform gems in a lock that also holds the gem's plain `nokogiri (1.18.10)` entry, or that a Bundler older than 2.3 wrote. | For the installed build, `--mode agent`. For the plain entry, the `bundle lock --remove-platform ` that drops it; for the old lock, a re-lock with Bundler 2.3 or later (`bundle update --bundler`). A gem the lock pins only as platform gems is not refused: it is vendored when one fix has a patch for every platform the lock names, and skipped otherwise (`vendor_prebuilt_platform_pending`, the run does not fail), see [Ruby gems: native extensions](#ruby-gems-native-extensions). | To patch one gem in another mode, name it: `socket-patch get --mode hosted`. A whole-project `scan --mode hosted` leaves vendored gems as they are, but it moves the vendored patches of the diff --git a/docs/migrating-to-v5.md b/docs/migrating-to-v5.md index b2481ab5b4..1300a600dd 100644 --- a/docs/migrating-to-v5.md +++ b/docs/migrating-to-v5.md @@ -182,6 +182,8 @@ mature each one is. - **Experimental:** what socket-patch does for a project in a Bazel workspace. It is new in v5.x and can change in any v5.x release; see [Bazel workspaces: what is supported](ecosystems.md#bazel-workspaces-what-is-supported). + Hosted and vendored mode for PDM (`pdm.lock`) are in this tier from v5.2.0: both + refuse the lock that PDM 2.29.8 and later write. Agent mode for PDM is unaffected. - **Beta:** Maven and Gradle in hosted and vendored mode, and sbt / Mill / scala-cli. They work for the documented build shapes. Run the build before you rely on the result or on a `--vex` document. diff --git a/docs/testing/pdm-compatibility.md b/docs/testing/pdm-compatibility.md index dbe04e9130..1d9c103b98 100644 --- a/docs/testing/pdm-compatibility.md +++ b/docs/testing/pdm-compatibility.md @@ -1,9 +1,13 @@ # PDM compatibility and production backtests `socket-patch` supports hosted and vendored Python patches in the `pdm.lock` -generations PDM has written since the lock gained per-file hashes, plus agent +generations PDM has written since the lock gained per-file hashes, up to +PDM 2.29.7, plus agent mode (in-place patching of the project's environment) on every release that -records a supported lock. The tests use real PDM releases bootstrapped with uv, +records a supported lock. The `4.6.0` lock that PDM 2.29.8 and later write is +refused by both modes, which are Experimental for PDM from socket-patch 5.2.0 +(see the [v5 support tiers](../ecosystems.md#v5-support-tiers)). +The tests use real PDM releases bootstrapped with uv, real PyPI artifacts, and the public Socket patch service. Successful rewriting alone is not an installation result: the backtest reinstalls from the rewritten lock and compares the installed bytes with the published patch. diff --git a/docs/testing/yarn-berry-compatibility.md b/docs/testing/yarn-berry-compatibility.md index 6abac68f66..b7d160772a 100644 --- a/docs/testing/yarn-berry-compatibility.md +++ b/docs/testing/yarn-berry-compatibility.md @@ -8,11 +8,16 @@ re-keys the lock entry `@https://…/-.tgz`, see below) and vendored (`vendor` wires the root `package.json` `resolutions` plus the lock's `file:` entry). yarn 2 and 3 (cacheKeys `7` / `8`) are refused by both modes. The node-modules and pnpm -linkers are covered end to end; Plug'n'Play keeps packages inside -`.yarn/cache` zips, so `vendor` refuses it (`vendor_yarn_berry_unsupported`) -and so does `apply` (`yarn_pnp_unsupported`), while standalone `vex` still +linkers are covered end to end. Plug'n'Play is not supported: no mode scans +or patches it (set `nodeLinker: node-modules`, or use `yarn patch `). It keeps +packages inside +`.yarn/cache` zips, so `scan`, in every mode, reads no npm dependency of a +project with a PnP loader and patches none (`yarn_pnp_unsupported`, exit 0), +`vendor` refuses it (`vendor_yarn_berry_unsupported`) +and so does `apply` (`yarn_pnp_unsupported`). Standalone `vex` still attests a hosted lock's `checksum:` pin once the PnP loader (`.pnp.cjs`) -resolves the package through the hosted url. A loader written before the lock +resolves the package through the hosted url, a state socket-patch does not +otherwise support. A loader written before the lock was rewired still runs the registry copy, so `vex` omits the package (`package_not_found`) until `yarn install` rewrites it (#519). Plug'n'Play is decided by the configured linker (`YARN_NODE_LINKER`, else the nearest rc file diff --git a/docs/usage.md b/docs/usage.md index 1f2fbead3e..c55d97c8e0 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -74,7 +74,8 @@ names several packages (`core` for `@angular/core` and `@babel/core`) is refused use the full name or a purl. Near names are only suggestions, and `--ecosystems` scopes both `get` searches and UUID selection. See the [v5 targeting changes](migrating-to-v5.md#package-targeting) for target forms, -ambiguity rules, and no-match statuses. `get` defaults to hosted mode; `--save-only` +ambiguity rules, and no-match statuses. `get` defaults to the project's existing +mode, hosted for a project with no patches yet; `--save-only` and global targeting default to agent mode instead. Hosted and vendored `get` do not prompt. Agent-mode searches can offer an interactive choice. diff --git a/npm/socket-patch-android-arm64/package.json b/npm/socket-patch-android-arm64/package.json index 673e1b678a..07f0067989 100644 --- a/npm/socket-patch-android-arm64/package.json +++ b/npm/socket-patch-android-arm64/package.json @@ -1,6 +1,6 @@ { "name": "@socketsecurity/socket-patch-android-arm64", - "version": "5.1.0", + "version": "5.2.0", "description": "socket-patch binary for Android ARM64", "os": [ "android" diff --git a/npm/socket-patch-darwin-arm64/package.json b/npm/socket-patch-darwin-arm64/package.json index acd8a90762..77c8940e5d 100644 --- a/npm/socket-patch-darwin-arm64/package.json +++ b/npm/socket-patch-darwin-arm64/package.json @@ -1,6 +1,6 @@ { "name": "@socketsecurity/socket-patch-darwin-arm64", - "version": "5.1.0", + "version": "5.2.0", "description": "socket-patch binary for macOS ARM64", "os": [ "darwin" diff --git a/npm/socket-patch-darwin-x64/package.json b/npm/socket-patch-darwin-x64/package.json index 0c3536f30e..2166c7996d 100644 --- a/npm/socket-patch-darwin-x64/package.json +++ b/npm/socket-patch-darwin-x64/package.json @@ -1,6 +1,6 @@ { "name": "@socketsecurity/socket-patch-darwin-x64", - "version": "5.1.0", + "version": "5.2.0", "description": "socket-patch binary for macOS x64", "os": [ "darwin" diff --git a/npm/socket-patch-linux-arm-gnu/package.json b/npm/socket-patch-linux-arm-gnu/package.json index d89e96788b..86d35e6339 100644 --- a/npm/socket-patch-linux-arm-gnu/package.json +++ b/npm/socket-patch-linux-arm-gnu/package.json @@ -1,6 +1,6 @@ { "name": "@socketsecurity/socket-patch-linux-arm-gnu", - "version": "5.1.0", + "version": "5.2.0", "description": "socket-patch binary for Linux ARM (glibc)", "os": [ "linux" diff --git a/npm/socket-patch-linux-arm-musl/package.json b/npm/socket-patch-linux-arm-musl/package.json index e797a27d2d..99cbedf874 100644 --- a/npm/socket-patch-linux-arm-musl/package.json +++ b/npm/socket-patch-linux-arm-musl/package.json @@ -1,6 +1,6 @@ { "name": "@socketsecurity/socket-patch-linux-arm-musl", - "version": "5.1.0", + "version": "5.2.0", "description": "socket-patch binary for Linux ARM (musl)", "os": [ "linux" diff --git a/npm/socket-patch-linux-arm64-gnu/package.json b/npm/socket-patch-linux-arm64-gnu/package.json index a343d13318..e1012677ed 100644 --- a/npm/socket-patch-linux-arm64-gnu/package.json +++ b/npm/socket-patch-linux-arm64-gnu/package.json @@ -1,6 +1,6 @@ { "name": "@socketsecurity/socket-patch-linux-arm64-gnu", - "version": "5.1.0", + "version": "5.2.0", "description": "socket-patch binary for Linux ARM64 (glibc)", "os": [ "linux" diff --git a/npm/socket-patch-linux-arm64-musl/package.json b/npm/socket-patch-linux-arm64-musl/package.json index 1a431d315c..c24dbc725f 100644 --- a/npm/socket-patch-linux-arm64-musl/package.json +++ b/npm/socket-patch-linux-arm64-musl/package.json @@ -1,6 +1,6 @@ { "name": "@socketsecurity/socket-patch-linux-arm64-musl", - "version": "5.1.0", + "version": "5.2.0", "description": "socket-patch binary for Linux ARM64 (musl)", "os": [ "linux" diff --git a/npm/socket-patch-linux-ia32-gnu/package.json b/npm/socket-patch-linux-ia32-gnu/package.json index 6d21e39aad..fe583b9a65 100644 --- a/npm/socket-patch-linux-ia32-gnu/package.json +++ b/npm/socket-patch-linux-ia32-gnu/package.json @@ -1,6 +1,6 @@ { "name": "@socketsecurity/socket-patch-linux-ia32-gnu", - "version": "5.1.0", + "version": "5.2.0", "description": "socket-patch binary for Linux ia32 (glibc)", "os": [ "linux" diff --git a/npm/socket-patch-linux-ia32-musl/package.json b/npm/socket-patch-linux-ia32-musl/package.json index dcc47f9530..1cd9586360 100644 --- a/npm/socket-patch-linux-ia32-musl/package.json +++ b/npm/socket-patch-linux-ia32-musl/package.json @@ -1,6 +1,6 @@ { "name": "@socketsecurity/socket-patch-linux-ia32-musl", - "version": "5.1.0", + "version": "5.2.0", "description": "socket-patch binary for Linux ia32 (musl)", "os": [ "linux" diff --git a/npm/socket-patch-linux-x64-gnu/package.json b/npm/socket-patch-linux-x64-gnu/package.json index e47b7ef67c..bc0e00a7c5 100644 --- a/npm/socket-patch-linux-x64-gnu/package.json +++ b/npm/socket-patch-linux-x64-gnu/package.json @@ -1,6 +1,6 @@ { "name": "@socketsecurity/socket-patch-linux-x64-gnu", - "version": "5.1.0", + "version": "5.2.0", "description": "socket-patch binary for Linux x64 (glibc)", "os": [ "linux" diff --git a/npm/socket-patch-linux-x64-musl/package.json b/npm/socket-patch-linux-x64-musl/package.json index 42c08c1bbc..23429e3945 100644 --- a/npm/socket-patch-linux-x64-musl/package.json +++ b/npm/socket-patch-linux-x64-musl/package.json @@ -1,6 +1,6 @@ { "name": "@socketsecurity/socket-patch-linux-x64-musl", - "version": "5.1.0", + "version": "5.2.0", "description": "socket-patch binary for Linux x64 (musl)", "os": [ "linux" diff --git a/npm/socket-patch-win32-arm64/package.json b/npm/socket-patch-win32-arm64/package.json index 891fa3e213..370ccf5979 100644 --- a/npm/socket-patch-win32-arm64/package.json +++ b/npm/socket-patch-win32-arm64/package.json @@ -1,6 +1,6 @@ { "name": "@socketsecurity/socket-patch-win32-arm64", - "version": "5.1.0", + "version": "5.2.0", "description": "socket-patch binary for Windows ARM64", "os": [ "win32" diff --git a/npm/socket-patch-win32-ia32/package.json b/npm/socket-patch-win32-ia32/package.json index 19cc2341e5..da5ca57348 100644 --- a/npm/socket-patch-win32-ia32/package.json +++ b/npm/socket-patch-win32-ia32/package.json @@ -1,6 +1,6 @@ { "name": "@socketsecurity/socket-patch-win32-ia32", - "version": "5.1.0", + "version": "5.2.0", "description": "socket-patch binary for Windows ia32", "os": [ "win32" diff --git a/npm/socket-patch-win32-x64/package.json b/npm/socket-patch-win32-x64/package.json index 2e2854a360..0c05d06452 100644 --- a/npm/socket-patch-win32-x64/package.json +++ b/npm/socket-patch-win32-x64/package.json @@ -1,6 +1,6 @@ { "name": "@socketsecurity/socket-patch-win32-x64", - "version": "5.1.0", + "version": "5.2.0", "description": "socket-patch binary for Windows x64", "os": [ "win32" diff --git a/npm/socket-patch/package-lock.json b/npm/socket-patch/package-lock.json index b570c872ed..e2ab5c8e2e 100644 --- a/npm/socket-patch/package-lock.json +++ b/npm/socket-patch/package-lock.json @@ -1,12 +1,12 @@ { "name": "@socketsecurity/socket-patch", - "version": "5.1.0", + "version": "5.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@socketsecurity/socket-patch", - "version": "5.1.0", + "version": "5.2.0", "license": "MIT", "dependencies": { "zod": "4.6.6" @@ -22,20 +22,20 @@ "node": ">=18.0.0" }, "optionalDependencies": { - "@socketsecurity/socket-patch-android-arm64": "5.1.0", - "@socketsecurity/socket-patch-darwin-arm64": "5.1.0", - "@socketsecurity/socket-patch-darwin-x64": "5.1.0", - "@socketsecurity/socket-patch-linux-arm-gnu": "5.1.0", - "@socketsecurity/socket-patch-linux-arm-musl": "5.1.0", - "@socketsecurity/socket-patch-linux-arm64-gnu": "5.1.0", - "@socketsecurity/socket-patch-linux-arm64-musl": "5.1.0", - "@socketsecurity/socket-patch-linux-ia32-gnu": "5.1.0", - "@socketsecurity/socket-patch-linux-ia32-musl": "5.1.0", - "@socketsecurity/socket-patch-linux-x64-gnu": "5.1.0", - "@socketsecurity/socket-patch-linux-x64-musl": "5.1.0", - "@socketsecurity/socket-patch-win32-arm64": "5.1.0", - "@socketsecurity/socket-patch-win32-ia32": "5.1.0", - "@socketsecurity/socket-patch-win32-x64": "5.1.0" + "@socketsecurity/socket-patch-android-arm64": "5.2.0", + "@socketsecurity/socket-patch-darwin-arm64": "5.2.0", + "@socketsecurity/socket-patch-darwin-x64": "5.2.0", + "@socketsecurity/socket-patch-linux-arm-gnu": "5.2.0", + "@socketsecurity/socket-patch-linux-arm-musl": "5.2.0", + "@socketsecurity/socket-patch-linux-arm64-gnu": "5.2.0", + "@socketsecurity/socket-patch-linux-arm64-musl": "5.2.0", + "@socketsecurity/socket-patch-linux-ia32-gnu": "5.2.0", + "@socketsecurity/socket-patch-linux-ia32-musl": "5.2.0", + "@socketsecurity/socket-patch-linux-x64-gnu": "5.2.0", + "@socketsecurity/socket-patch-linux-x64-musl": "5.2.0", + "@socketsecurity/socket-patch-win32-arm64": "5.2.0", + "@socketsecurity/socket-patch-win32-ia32": "5.2.0", + "@socketsecurity/socket-patch-win32-x64": "5.2.0" } }, "node_modules/@types/node": { diff --git a/npm/socket-patch/package.json b/npm/socket-patch/package.json index a269a25ef8..ef790e171f 100644 --- a/npm/socket-patch/package.json +++ b/npm/socket-patch/package.json @@ -1,6 +1,6 @@ { "name": "@socketsecurity/socket-patch", - "version": "5.1.0", + "version": "5.2.0", "description": "CLI tool and schema library for applying security patches to dependencies", "bin": { "socket-patch": "bin/socket-patch" @@ -49,19 +49,19 @@ "@types/node": "20.19.41" }, "optionalDependencies": { - "@socketsecurity/socket-patch-android-arm64": "5.1.0", - "@socketsecurity/socket-patch-darwin-arm64": "5.1.0", - "@socketsecurity/socket-patch-darwin-x64": "5.1.0", - "@socketsecurity/socket-patch-linux-arm-gnu": "5.1.0", - "@socketsecurity/socket-patch-linux-arm-musl": "5.1.0", - "@socketsecurity/socket-patch-linux-arm64-gnu": "5.1.0", - "@socketsecurity/socket-patch-linux-arm64-musl": "5.1.0", - "@socketsecurity/socket-patch-linux-ia32-gnu": "5.1.0", - "@socketsecurity/socket-patch-linux-ia32-musl": "5.1.0", - "@socketsecurity/socket-patch-linux-x64-gnu": "5.1.0", - "@socketsecurity/socket-patch-linux-x64-musl": "5.1.0", - "@socketsecurity/socket-patch-win32-arm64": "5.1.0", - "@socketsecurity/socket-patch-win32-ia32": "5.1.0", - "@socketsecurity/socket-patch-win32-x64": "5.1.0" + "@socketsecurity/socket-patch-android-arm64": "5.2.0", + "@socketsecurity/socket-patch-darwin-arm64": "5.2.0", + "@socketsecurity/socket-patch-darwin-x64": "5.2.0", + "@socketsecurity/socket-patch-linux-arm-gnu": "5.2.0", + "@socketsecurity/socket-patch-linux-arm-musl": "5.2.0", + "@socketsecurity/socket-patch-linux-arm64-gnu": "5.2.0", + "@socketsecurity/socket-patch-linux-arm64-musl": "5.2.0", + "@socketsecurity/socket-patch-linux-ia32-gnu": "5.2.0", + "@socketsecurity/socket-patch-linux-ia32-musl": "5.2.0", + "@socketsecurity/socket-patch-linux-x64-gnu": "5.2.0", + "@socketsecurity/socket-patch-linux-x64-musl": "5.2.0", + "@socketsecurity/socket-patch-win32-arm64": "5.2.0", + "@socketsecurity/socket-patch-win32-ia32": "5.2.0", + "@socketsecurity/socket-patch-win32-x64": "5.2.0" } }