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

설치된 패키지의 ECDSA 레지스트리 서명을 각 레지스트리가 /-/npm/v1/keys에 게시한 공개 키와 대조하여 검증합니다. registries를 통해 구성된 스코프 레지스트리도 적용되며, 서명 키를 게시하지 않는 레지스트리는 건너뜁니다.

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과 함께 사용하세요.

옵션#

--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.

minimumReleaseAge가 설정된 경우, --fix는 각 권고의 최소 패치 버전을 pnpm-workspace.yaml의 minimumReleaseAgeExclude에도 추가하여, 릴리스 기간을 기다리지 않고 보안 수정 사항을 설치할 수 있게 합니다.

--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.