pnpm sbom

Generate a Software Bill of Materials (SBOM) for the project.

A lockfile is required, but a package manifest is optional. Without a manifest, the root component uses unknown as its name and 0.0.0 as its version, with no license. The command does not create a package manifest.

Supported formats:

  • CycloneDX 1.7 (JSON)
  • SPDX 2.3 (JSON)

사용#

pnpm sbom --sbom-format cyclonedx
pnpm sbom --sbom-format spdx
pnpm sbom --sbom-format cyclonedx --lockfile-only
pnpm sbom --sbom-format spdx --prod
pnpm sbom --sbom-format cyclonedx --out sbom.cdx.json
pnpm sbom --sbom-format cyclonedx --split
pnpm sbom --sbom-format cyclonedx --exclude-peers

워크스페이스 내에서 pnpm sbom은 필터링을 지원합니다. 단일 워크스페이스 패키지를 선택하면 SBOM의 루트 컴포넌트는 해당 패키지의 메타데이터를 사용합니다.

Dependencies of explicitly selected projects belong to the report root. Dependencies of workspace projects reached only through links belong to those projects' components.

A component resolved from a named registry carries the purl repository_url qualifier (for example pkg:npm/foo@1.0.0?repository_url=https%3A%2F%2Fnpm.work.example.com%2F), so the same name and version served by two registries does not collapse onto one component. Credentials that a namedRegistries URL may embed (userinfo or a query string) are stripped from the qualifier, while the origin and path are kept, since two registries can differ only by path.

CycloneDX 출력은 devDependencies를 통해서만 도달할 수 있는 컴포넌트를 scope: "excluded"와 cdx:npm:package:development 속성으로 표시합니다. 설치된 선택적 의존성을 포함한 런타임 컴포넌트는 기본값인 required 범위를 사용합니다.

옵션#

--sbom-format <cyclonedx|spdx>#

SBOM 출력 형식입니다. 이 옵션은 필수입니다. Supported values: cyclonedx, spdx.

--sbom-type <library|application>#

  • 기본값: library

루트 패키지의 컴포넌트 유형입니다.

--sbom-spec-version <version>#

  • 기본값: 1.7
  • 유형: 1.5, 1.6, 1.7

출력할 CycloneDX 사양 버전입니다. 이 옵션은 --sbom-format cyclonedx와 함께 사용할 때만 유효합니다.

--lockfile-only#

오직 lockfile 데이터만 사용합니다(스토어에서 읽기는 건너뜁니다).

--sbom-authors <names>#

쉼표로 구분된 SBOM 작성자 목록입니다. CycloneDX 출력의 metadata.authors에 기록됩니다.

--sbom-supplier <name>#

SBOM 공급자 이름입니다. CycloneDX 출력의 metadata.supplier에 기록됩니다.

--out <path>#

SBOM을 stdout 대신 파일에 씁니다.

경로에서 %s는 패키지 이름의 자리표시자로, %v는 패키지 버전의 자리표시자로 사용됩니다. 워크스페이스에서 %s가 포함된 경로를 지정하면 선택한 패키지마다 SBOM이 하나씩 기록됩니다:

pnpm sbom --sbom-format cyclonedx --out out/%s.cdx.json
pnpm sbom --sbom-format cyclonedx --out out/%s-%v.cdx.json

--split#

선택한 각 워크스페이스 패키지마다 별도의 SBOM을 생성합니다. SBOM은 --out 없이 실행하면 NDJSON 형식으로, 한 줄에 JSON 문서 하나씩 stdout에 출력됩니다.

출력 경로에는 %s가 포함되어야 하며, 이는 --split을 --out과 함께 사용할 때 필요합니다.

--exclude-peers#

SBOM에서 피어 의존성을 제외합니다. 해당 피어를 통해서만 도달할 수 있는 의존성도 함께 제외됩니다.

This is useful with autoInstallPeers because peer dependencies are resolved into the lockfile and otherwise look the same as regular dependencies.

--prod, -P, --production#

오직 dependencies와 optionalDependencies만 포함합니다.

--dev, -D#

오직 devDependencies만 포함합니다.

--no-optional#

optionalDependencies를 포함하지 않습니다.

--optional#

Include optionalDependencies.

--filter <package_selector>#

필터링에 대해 자세히 알아보세요.