Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,027 changes: 1,027 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
36 changes: 22 additions & 14 deletions crates/socket-patch-cli/CLI_CONTRACT.md

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down Expand Up @@ -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
Expand Down
74 changes: 57 additions & 17 deletions docs/ecosystems.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/migrating-to-v5.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 6 additions & 2 deletions docs/testing/pdm-compatibility.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
13 changes: 9 additions & 4 deletions docs/testing/yarn-berry-compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ re-keys the lock entry `<name>@https://…/<name>-<v>.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 <pkg>`). 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
Expand Down
3 changes: 2 additions & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion npm/socket-patch-android-arm64/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion npm/socket-patch-darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion npm/socket-patch-darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion npm/socket-patch-linux-arm-gnu/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion npm/socket-patch-linux-arm-musl/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion npm/socket-patch-linux-arm64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion npm/socket-patch-linux-arm64-musl/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion npm/socket-patch-linux-ia32-gnu/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion npm/socket-patch-linux-ia32-musl/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion npm/socket-patch-linux-x64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion npm/socket-patch-linux-x64-musl/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion npm/socket-patch-win32-arm64/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion npm/socket-patch-win32-ia32/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion npm/socket-patch-win32-x64/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
32 changes: 16 additions & 16 deletions npm/socket-patch/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions npm/socket-patch/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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"
}
}
Loading