
JSON, XML, Protobuf, CSV 및 SPDX 형식의 CycloneDX SBOM을 생성, 분석, 병합, 비교, 검증, 서명 및 변환하기 위한 CLI입니다.
______ __ ____ _ __ ________ ____
/ ____/_ _______/ /___ ____ ___ / __ \ |/ / / ____/ / / _/
/ / / / / / ___/ / __ \/ __ \/ _ \/ / / / / / / / / / /
/___/ /_/ / /__/ / /_/ / / / / __/ /_/ / | / /___/ /____/ /
\____/\__, /\___/_/\____/_/ /_/\___/_____/_/|_| \____/_____/___/
/____/
Usage:
cyclonedx [command] [options]
Options:
--version Show version information
-?, -h, --help Show help and usage information
Commands:
add Add information to a BOM (currently supports files)
analyze Analyze a BOM file
convert Convert between different BOM formats
diff <from-file> <to-file> Generate a BOM diff
keygen Generates an RSA public/private key pair for BOM signing
merge Merge two or more BOMs
sign Sign a BOM or file
validate Validate a BOM
verify Verify signatures in a BOM
CycloneDX CLI 도구는 현재 BOM 분석, 수정, diff, 병합, 형식 변환, 서명 및 검증을 지원합니다.
CycloneDX XML, JSON, Protobuf, CSV 및 SPDX JSON v2.3 간의 변환이 지원됩니다.
바이너리는 릴리스 페이지에서 다운로드할 수 있습니다.
참고: CycloneDX CLI 도구는 자동화 사용 사례를 위해 제작되었습니다. --input-file 옵션이 있는 모든 명령은 stdin에서 입력을 받는 것도 지원합니다. 마찬가지로 --output-file 옵션이 있는 모든 명령은 stdout으로 출력을 지원합니다. 단, 입력/출력 형식을 지정해야 합니다.
예를 들어:
cat bom.json | cyclonedx-cli convert --input-format json --output-format xml > bom.xml
files
Add files to a BOM
Usage:
cyclonedx add files [options]
Options:
--input-file <input-file> Input BOM filename.
--no-input Use this option to indicate that there is no input BOM.
--output-file <output-file> Output BOM filename, will write to stdout if no value provided.
--input-format <autodetect|json|protobuf|xml> Specify input file format.
--output-format <autodetect|json|protobuf|xml> Specify output file format.
--base-path <base-path> Base path for directory to process (defaults to current working directory if omitted).
--include <include> Apache Ant style path and file patterns to specify what to include (defaults to all files, separate patterns with a space).
--exclude <exclude> Apache Ant style path and file patterns to specify what to exclude (defaults to none, separate patterns with a space).
Git 저장소 디렉터리를 제외한 소스 코드 BOM 생성:
cyclonedx-cli add files --no-input --output-format json --exclude /.git/**
기존 BOM에 bin 디렉터리의 빌드 출력 파일 추가:
cyclonedx-cli add files --input-file bom.json --output-format json --base-path bin
analyze
Analyze a BOM file
Usage:
cyclonedx analyze [options]
Options:
--input-file <input-file> Input BOM filename, will read from stdin if no value provided.
--input-format <autodetect|json|protobuf|xml> Specify input file format.
--output-format <json|text> Specify output format (defaults to text).
--multiple-component-versions Report components that have multiple versions in use.
서로 다른 버전으로 여러 번 포함된 컴포넌트 보고:
cyclonedx-cli analyze --input-file sbom.xml --multiple-component-versions
convert
Convert between different BOM formats
Usage:
cyclonedx convert [options]
Options:
--input-file <input-file> Input BOM filename, will read from stdin if no value provided.
--output-file <output-file> Output BOM filename, will write to stdout if no value provided.
--input-format <autodetect|csv|json|protobuf|spdxjson|xml> Specify input file format.
--output-format <autodetect|csv|json|protobuf|spdxjson|xml> Specify output file format.
--output-version <v1_0|v1_1|v1_2|v1_3|v1_4|v1_5|v1_6|v1_7> Specify output BOM specification version. (ignored for CSV and SPDX formats)
XML에서 JSON 형식으로 변환:
cyclonedx-cli convert --input-file sbom.xml --output-file sbom.json
XML에서 JSON 형식으로 변환하고 출력을 추가 도구로 파이프:
cyclonedx-cli convert --input-file sbom.xml --output-format json | grep "somthing"
CSV 형식은 BOM에 있는 컴포넌트 목록의 제한된 표현입니다.
목적은 사용자가 간단한 사용 사례를 위해 BOM을 손쉽게 생성하고 소비할 수 있는 방법을 제공하는 것입니다. 간단한 데이터 마이그레이션 사용 사례도 포함됩니다.
필수 필드는 컴포넌트 name 및 version 필드뿐입니다. 나머지 필드는 비워 두거나 열을 생략할 수 있습니다.
SPDX와 CycloneDX 형식 간 변환 시 일부 정보가 손실될 수 있습니다. 변환 기능은 CycloneDX .NET 라이브러리 프로젝트의 일부인 CycloneDX.Spdx.Interop 라이브러리에서 제공됩니다.
어떤 정보가 손실되는지에 대한 자세한 내용은 CycloneDX .NET 라이브러리 프로젝트 페이지를 참조하세요.
diff
Generate a BOM diff
Usage:
cyclonedx diff <from-file> <to-file> [options]
Arguments:
<from-file> From BOM filename.
<to-file> To BOM filename.
Options:
--from-format <autodetect|json|protobuf|xml> Specify from file format.
--to-format <autodetect|json|protobuf|xml> Specify to file format.
--output-format <json|text> Specify output format (defaults to text).
--component-versions Report component versions that have been added, removed or modified.
버전 변경이 있는 컴포넌트 보고:
cyclonedx-cli diff sbom-from.xml sbom-to.xml --component-versions
keygen
Generates an RSA public/private key pair for BOM signing
Usage:
cyclonedx keygen [options]
Options:
--private-key-file <private-key-file> Filename for generated private key file (defaults to "private.key")
--public-key-file <public-key-file> Filename for generated public key file (defaults to "public.key")
merge
Merge two or more BOMs
Usage:
cyclonedx merge [options]
Options:
--input-files <input-files> Input BOM filenames (separate filenames with a space).
--output-file <output-file> Output BOM filename, will write to stdout if no value provided.
--input-format <autodetect|json|protobuf|xml> Specify input file format.
--output-format <autodetect|json|protobuf|xml> Specify output file format.
--output-version <v1_0|v1_1|v1_2|v1_3|v1_4|v1_5|v1_6|v1_7> Specify output BOM specification version.
--hierarchical Perform a hierarchical merge.
--group <group> Provide the group of software the merged BOM describes.
--name <name> Provide the name of software the merged BOM describes (required for hierarchical merging).
--version <version> Provide the version of software the merged BOM describes (required for hierarchical merging).
참고: 계층적 병합을 수행하려면 모든 BOM의 metadata component 요소에 BOM의 대상(subject)이 설명되어 있어야 합니다.
두 개의 XML 형식 BOM 병합:
cyclonedx-cli merge --input-files sbom1.xml sbom2.xml --output-file sbom_all.xml
두 BOM을 병합하고 출력을 추가 도구로 파이프:
cyclonedx-cli merge --input-files sbom1.xml sbom2.xml --output-format json | grep "something"
BOM 또는 파일 서명
bom
Sign the entire BOM document
Usage:
cyclonedx sign bom <bom-file> [options]
Arguments:
<bom-file> BOM filename
Options:
--key-file <key-file> Signing key filename (RSA private key in PEM format, defaults to "private.key")
file
Sign arbitrary files and generate a PKCS1 RSA SHA256 signature file
Usage:
cyclonedx sign file <file> [options]
Arguments:
<file> Filename of the file the signature will be created for
Options:
--key-file <key-file> Signing key filename (RSA private key in PEM format, defaults to "private.key")
--signature-file <signature-file> Filename of the generated signature file (defaults to the filename with ".sig" appended)
validate
Validate a BOM
Usage:
cyclonedx validate [options]
Options:
--input-file <input-file> Input BOM filename, will read from stdin if no value provided.
--input-format <autodetect|json|xml> Specify input file format.
--input-version <v1_0|v1_1|v1_2|v1_3|v1_4|v1_5|v1_6|v1_7> Specify input file specification version (defaults to v1.7)
--fail-on-errors Fail on validation errors (return a non-zero exit code)
BOM 검증 및 0이 아닌 종료 코드 반환 (빌드를 자동으로 "중단"시키는 등의 용도로 유용)
cyclonedx-cli validate --input-file sbom.xml --fail-on-errors
BOM 및 파일의 서명 검증
all
Verify all signatures in a BOM
Usage:
cyclonedx verify all <bom-file> [options]
Arguments:
<bom-file> BOM filename
Options:
--key-file <key-file> Public key filename (RSA public key in PEM format, defaults to "public.key")
file
Verifies a PKCS1 RSA SHA256 signature file for an arbitrary file
Usage:
cyclonedx verify file <file> [options]
Arguments:
<file> File the signature file is for
Options:
--key-file <key-file> Public key filename (RSA public key in PEM format, defaults to "public.key")
--signature-file <signature-file> Signature file to be verified (defaults to the filename with ".sig" appended)
CycloneDX CLI 도구는 docker docker run cyclonedx/cyclonedx-cli를 사용하여 실행할 수도 있습니다.
Linux 및 MacOS에서는 CycloneDX Homebrew tap을 통해 CLI를 설치할 수 있습니다:
brew install cyclonedx/cyclonedx/cyclonedx-cli
공식 지원 빌드는 다음 플랫폼에서 사용할 수 있습니다:
커뮤니티 지원 빌드는 다음 플랫폼에서 사용할 수 있습니다:
.NET Core 런타임 종속성이 필요합니다.
Windows의 경우 이러한 종속성은 사전 설치되어 있어야 합니다.
Ubuntu의 경우 libc6 libgcc1 libgssapi-krb5-2 libicu66 libssl1.1 libstdc++6 zlib1g입니다.
gron은 JSON을 개별 할당문으로 변환하여 원하는 항목을 grep으로 더 쉽게 찾고 해당 항목의 절대 '경로(path)'를 확인할 수 있게 해줍니다.
편의를 위해 gron은 CycloneDX CLI Docker 이미지에 포함되어 있습니다.
모든 컴포넌트 이름과 버전을 나열하는 사용 예
$ gron bom-1.2.json | grep -E "(components\[[[:digit:]]*\].name)|(components\[[[:digit:]]*\].version)"
json.components[0].name = "tomcat-catalina";
json.components[0].version = "9.0.14";
json.components[1].name = "mylibrary";
json.components[1].version = "1.0.0";
또는 XML 형식 BOM을 사용한 동일한 예
$ cyclonedx convert --input-file bom.xml --output-format json | gron | grep -E "(components\[[[:digit:]]*\].name)|(components\[[[:digit:]]*\].version)"
json.components[0].name = "tomcat-catalina";
json.components[0].version = "9.0.14";
json.components[1].name = "mylibrary";
json.components[1].version = "1.0.0";
gron 사용에 대한 자세한 내용은 gron 프로젝트 페이지를 참조하세요.
grep 사용에 대한 자세한 내용은 grep 매뉴얼 페이지를 참조하세요.
수정 및 재배포 권한은 Apache 2.0 라이선스 조건에 따라 부여됩니다. 전체 라이선스는 LICENSE 파일을 참조하세요.
풀 리퀘스트를 환영합니다. 하지만 먼저 CycloneDX 기여 가이드라인을 읽어 주세요.
로컬에서 솔루션을 빌드하고 테스트하려면 .NET 8이 설치되어 있어야 합니다. dotnet build 및 dotnet test와 같은 표준 명령이 작동합니다.
일반적으로 풀 리퀘스트에는 관련 테스트가 포함될 것으로 예상됩니다. 모든 풀 리퀘스트에 대해 Windows, MacOS 및 Linux에서 테스트가 자동으로 실행됩니다. 빌드 경고는 빌드를 실패시킵니다.
액세스할 수 없는 플랫폼에서 실패하는 테스트를 디버깅하는 데 문제가 있는 경우 알려주세요.