socket-patch get

Apply the patch for one CVE, GHSA, package or patch UUID

socket-patch get applies the patch for one advisory, package or patch, instead of everything a scan would find.

  • Identifiers. Pass a CVE ID, a GHSA ID, a package URL, an exact package name or a patch UUID. A package URL with a version selects that release; a name or a versionless package URL selects every version the project uses.
  • Names are exact. get yaml never selects yaml-ast-parser. A short name that matches more than one package, such as core, is refused with a list of package URLs to use instead.
  • Only versions you use. A CVE that affects many releases of a package adds a patch only for the versions in your project. --all-releases fetches every release variant of a package (PyPI wheels and sdists, gem platforms, Maven classifiers) and, for a CVE or GHSA, also patches affected versions the project doesn't use.
  • Mode. Like scan: the project's existing mode, or hosted for a new project. Pass --mode to choose.
  • Policy. get is an explicit choice, so it is not limited by the socket.yml policy. It warns when the policy would have excluded the package.
socket-patch get CVE-2021-44906                 # by CVE ID
socket-patch get GHSA-xvch-5gv4-984h            # by GHSA ID
socket-patch get pkg:npm/[email protected]         # one exact version
socket-patch get minimist                       # every version of the package in the project
socket-patch get your-patch-uuid                # one patch
socket-patch get minimist --mode vendored       # vendor it instead of linking to it
socket-patch get minimist --dry-run             # preview

socket-patch get -h

-h prints the common options shown here. socket-patch get --help prints every option.

$ socket-patch get -h

Apply patches for a package, advisory, or patch UUID

Usage: socket-patch get [OPTIONS] <IDENTIFIER>

Arguments:
  <IDENTIFIER>  Patch identifier (UUID, CVE ID, GHSA ID, PURL, or package name)

Options:
      --mode <MODE>  How to consume the patches: the same modes as `scan --mode` [default: the mode
                     the project's patch state already records, else hosted; agent with
                     `--save-only` or `--global`] [possible values: hosted, vendored, agent]
  -h, --help         Print help (see more with '--help')
  -V, --version      Print version

Global options:
      --cwd <CWD>                Working directory [env: SOCKET_CWD=] [default: .]
  -e, --ecosystems <ECOSYSTEMS>  Restrict to these ecosystems (comma-separated): npm, pypi, cargo,
                                 gem, golang, maven, composer, nuget, deno [env: SOCKET_ECOSYSTEMS=]
      --offline                  Disable network access; fail if remote data is needed [env:
                                 SOCKET_OFFLINE=]
  -j, --json                     Emit machine-readable JSON output [env: SOCKET_JSON=]
      --dry-run                  Preview the operation without making any mutations [env:
                                 SOCKET_DRY_RUN=]
  -y, --yes                      Skip interactive prompts [env: SOCKET_YES=]

Did this page help you?