Generate a CycloneDX or SPDX SBOM
generate_sbomGiven the same inputs batch_query_vulnerabilities accepts — either a flat {packages:[...]} list, or raw package.json / lockfile / CycloneDX JSON / SPDX JSON content via content — emits a spec-valid CycloneDX 1.6 or SPDX 2.3 JSON document (pick with format, default 'cyclonedx') with npmscan's own OSV.dev vulnerability findings and registry license data embedded in each spec's native fields: CycloneDX gets a top-level vulnerabilities[] array (VEX analysis.state: 'in_triage' — an unreviewed automated finding, not a claim of exploitability) and per-component licenses[]; SPDX (which has no vulnerabilities array in 2.3) gets one externalRefs SECURITY/advisory entry per finding and licenseDeclared/licenseConcluded. Only a flat package inventory is known here, so the CycloneDX dependencies[] transitive graph and any SPDX package hierarchy are intentionally omitted rather than fabricated. Set includeVulnerabilities/includeLicenses to false to skip either enrichment pass (faster, no registry/OSV calls for that pass); pass policy (same shape as check_license_compliance) to also get per-package compliance context; componentName/componentVersion name the SBOM's own root component/document if known.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| format | No | SBOM format to emit. Default 'cyclonedx'. | |
| policy | No | License allow/deny policy, same shape as check_license_compliance. Omit for the default policy. | |
| content | No | Raw dependency inventory content: package.json, package-lock.json, yarn.lock, pnpm-lock.yaml, CycloneDX JSON, or SPDX JSON. Use this OR `packages`, not both. | |
| packages | No | Explicit package list (1-1000 items, capped to 100 when includeLicenses is on). Use this OR `content`, not both. | |
| componentName | No | Name of the SBOM's own root component/document, if known. | |
| includeLicenses | No | Resolve registry license data and embed it natively. Default true. | |
| componentVersion | No | ||
| includeDevDependencies | No | Ignored when using `packages`; only applies when `content` is a manifest/lockfile format that distinguishes dev dependencies. | |
| includeVulnerabilities | No | Query OSV.dev and embed findings natively. Default true. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sbom | Yes | ||
| format | Yes | ||
| policy | No | ||
| warnings | No | ||
| inputFormat | No | ||
| ignoredCount | No | ||
| enrichmentNote | No | ||
| parsedPackageCount | Yes | ||
| totalVulnerabilities | Yes | ||
| licenseViolationCount | No | ||
| packagesWithVulnerabilities | Yes |