pnpm audit

설치된 패키지의 알려진 보안 문제를 확인합니다.

보안 문제가 발견되면 pnpm update를 통해 종속성을 업데이트해 보세요. 단순 업데이트로 모든 문제가 해결되지 않으면, overrides를 사용하여 취약하지 않은 버전을 강제하세요. 예를 들어, lodash@<2.1.0이 취약한 경우, 다음 overrides를 사용하여 lodash@^2.1.0을 강제하세요:

pnpm-workspace.yaml
overrides:
  "lodash@<2.1.0": "^2.1.0"

또는 pnpm audit --fix를 실행하세요.

프로젝트에 영향을 주지 않는 일부 취약점을 허용하려면 audit.ignore 설정을 사용할 수 있습니다.

pnpm audit queries the registry's /-/npm/v1/security/advisories/bulk endpoint. The response does not include CVE identifiers, so advisories are identified by the GitHub advisory ID (GHSA) in their URL.

The command exits with code 1 when an advisory at or above the audit level remains after ignored advisories are removed. This also applies to --ignore and --ignore-unfixable, which save the IDs first.

Commands#

signatures#

pnpm audit signatures

Verifies the ECDSA registry signatures of installed registry packages against the public keys each registry publishes at /-/npm/v1/keys. pnpm respects scoped and prefix-routed registries configured via registries, and skips registries that do not publish signing keys as well as tarball, git, and directory dependencies.

Signatures are verified against the package integrity recorded in the lockfile. A package without recorded integrity cannot pass verification.

A registry signs the integrity of a package's .tgz. When the lockfile pins tars with lockfile.integrityTarget: tar, the signature is verified against the .tgz integrity the registry publishes, once pnpm has tied it to the tar hash in the lockfile. The store answers for a package it holds. Any other package is downloaded and checked. A package that cannot be tied is reported as invalid, with the reason.

이 명령은 유효하지 않은 서명을 가진 패키지가 있거나, 레지스트리가 서명 키를 제공하지만 패키지가 서명 없이 게시된 경우 코드 1로 종료됩니다. 기계가 읽을 수 있는 출력을 얻으려면 --json과 함께 사용하세요.

deprecations#

pnpm audit deprecations

Lists the installed packages that their registry marks as deprecated, with the message the publisher left. Each package shows the projects that depend on it directly, or a chain of packages that brings it in. When the package has a version that is not deprecated, the newest one is named.

pnpm reads registry metadata from its cache when that metadata is less than 5 minutes old, so right after an install no requests are needed. Older metadata is checked against the registry, so a package deprecated since then is reported. Tarball, git, and directory dependencies are skipped.

The command exits with code 1 if any installed package is deprecated. --prod, --dev, --no-optional, --json, --ignore-registry-errors, and workspace filters apply to it.

engines#

pnpm audit engines

Lists the installed packages that don't support the current Node.js version or platform, with what each one wants. Each package shows the projects that depend on it directly, or a chain of packages that brings it in. These are the packages an install warns about.

pnpm checks the packages against the Node.js version an install uses: the nodeVersion setting, the Node.js version the lockfile pins for the root project, or the system Node.js. The platform includes supportedArchitectures. An optional dependency that an install skips is not listed. The command reads the lockfile and makes no registry requests.

The command exits with code 1 if any installed package is incompatible. --prod, --dev, --no-optional, --json, and workspace filters apply to it.

옵션#

--audit-level <severity>#

  • Type: info, low, moderate, high, critical
  • 기본값: low

심각도가 <severity> 이상인 권고만 출력합니다. Advisories below this level also do not fail the command.

pnpm-workspace.yaml의 audit.level로도 설정할 수 있습니다.

--fix#

Add overrides to the pnpm-workspace.yaml file to force non-vulnerable versions of the dependencies.

Use --fix=update to fix vulnerabilities by updating the vulnerable packages in the lockfile instead of adding overrides.

When minimumReleaseAge would block the minimum patched version, --fix adds it to minimumReleaseAgeExclude in pnpm-workspace.yaml so it can be installed.

--no-add-release-age-exclusions#

Skip automatic additions to minimumReleaseAgeExclude for both fix methods and interactive fixes. The release age policy can still block recently published patches unless an existing exclusion allows them. If the resolver selects a patch that the age policy blocks, --fix=update can exit with ERR_PNPM_NO_MATURE_MATCHING_VERSION. With --fix=update, the update still follows minimumReleaseAgeExcludePrune.

--interactive, -i#

--fix로 선택된 권고를 검토하고 적용할 항목을 고릅니다. Implies --fix=override when --fix is not given.

--json#

JSON 형식으로 검사 보고서를 출력합니다.

patched_versions is null for an advisory with no published fix, so tooling can tell "no fix available" from "fix available at version X".

--dev, -D#

개발 의존성만 검사합니다.

--prod, --production, -P#

Only audit dependencies and optionalDependencies.

--optional#

Audit optionalDependencies. This is the default.

--no-optional#

optionalDependencies를 감사하지 않습니다.

--ignore-registry-errors#

레지스트리가 200이 아닌 상태 코드로 응답하면 프로세스가 0으로 종료되어야 합니다. 따라서 레지스트리가 실제로 발견된 취약점에 성공적으로 응답하는 경우에만 프로세스가 실패합니다.

--ignore-unfixable#

해결책이 없는 모든 권고를 무시합니다. An unfixable advisory without a GHSA ID cannot be ignored and fails the command with ERR_PNPM_AUDIT_MISSING_GHSA.

Their GHSA IDs are saved in pnpm-workspace.yaml the same way as with --ignore.

--ignore <vulnerability>#

GitHub 권고 ID(GHSA)로 취약점을 무시합니다.

The ID is saved in pnpm-workspace.yaml, which is created if missing, and no audit report is printed. It is added to audit.ignore if that list is already set, otherwise to the deprecated auditConfig.ignoreGhsas, which pnpm still reads. To have a new project write to audit.ignore, create the list first (audit: { ignore: [] }).

환경설정#

pnpm audit is configured in the audit section of pnpm-workspace.yaml:

pnpm-workspace.yaml
audit:
  level: high
  ignore:
    - GHSA-42xw-2xvc-qx8m

audit.level#

  • 기본값: low
  • Type: info, low, moderate, high, critical

이 수준 이상의 심각도를 가진 권고만 출력합니다. --audit-level 플래그와 동일합니다.

audit.ignore#

pnpm audit 명령에서 무시할 GHSA 코드 목록입니다.

pnpm-workspace.yaml
audit:
  ignore:
    - GHSA-42xw-2xvc-qx8m
    - GHSA-4w2v-q235-vp99
    - GHSA-cph5-m8f7-6c5x
    - GHSA-vh95-rmgr-6w4m

Since v12.4.0, ignored advisories are left out of the vulnerability total and the per-severity counts, and reported separately. When every advisory found is ignored, the summary says so rather than reporting a clean audit.

audit.ignorePrune#

Added in: v12.0.0

  • 기본값: false
  • 유형: Boolean

When true, pnpm audit --fix removes the audit.ignore entries whose GHSA no longer appears in the audit report, so a list of tolerated advisories doesn't accumulate entries for dependencies that are long gone.

pnpm-workspace.yaml
audit:
  ignorePrune: true

정보

auditLevel and auditConfig.ignoreGhsas are deprecated names for audit.level and audit.ignore, and pnpm still reads them. When both spellings are set, the audit section takes precedence and a warning is printed.

auditConfig.ignoreCves is not recognized. Replace each CVE with the matching GHSA-xxxx-xxxx-xxxx ID, shown in the More info column of pnpm audit output, under audit.ignore.