You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+77-27Lines changed: 77 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,14 @@
7
7
8
8
`rules_sbom` provides Bazel rules for generating Software Bill of Materials (SBOM) artifacts from Bazel targets using best-in-class external tooling.
9
9
10
-
> ⚠️ This repository is under active development. The public APIs and toolchain integrations are not yet stable.
10
+
The rules are production-ready and currently power SBOM generation in real workloads. They ship reproducible CycloneDX documents that track the dependencies that actually ship with your services as well as full workspace inventories.
11
+
12
+
## Capabilities
13
+
14
+
- Service-level SBOMs: point `sbom_artifact` at a single Bazel target (for example a binary, image, or library bundle) to enumerate only the artifacts that deploy with that unit.
15
+
- Workspace-level SBOMs: aggregate manifests and lockfiles across the repository to emit a global view of every resolved dependency.
16
+
- JavaScript and pnpm monorepos: the Syft wrapper synthesizes scoped `package.json` and lockfiles for each target, disables noisy catalogers, and can also ingest workspace-level node modules so you can switch between per-service and whole-repo reports.
17
+
- Bundled Syft toolchain: pre-built binaries for macOS, Linux, and Windows ensure consistent output in CI and on developer machines.
11
18
12
19
## Getting started
13
20
@@ -48,6 +55,73 @@
48
55
49
56
The [`docs/`](docs/overview.md) directory contains more detailed usage and toolchain notes (including [Windows testing via Parallels CLI](docs/windows_parallels.md)).
50
57
58
+
## Generating SBOMs
59
+
60
+
### Service-level SBOMs
61
+
62
+
The simplest configuration points `sbom_artifact` at the Bazel target you ship. The rule stages that target's runfiles, injects any language-specific metadata (for example `package.json`, `go.mod`, or `requirements.txt`), and hands the curated bundle to Syft:
To capture a global view, wrap the manifests, lockfiles, and other workspace inputs you care about in a `filegroup`, then ask `sbom_artifact` to process that group:
This pattern works for any combination of languages—add whatever manifests make sense for your repository.
97
+
98
+
### JavaScript and pnpm workspaces
99
+
100
+
JavaScript targets receive additional handling so you can switch between service and workspace scopes without manual staging:
101
+
102
+
-**Service SBOMs**: point `sbom_artifact` at the Bazel binary (for example a `js_binary`). The wrapper reduces the runfiles to the service's published assets, synthesizes a scoped `package.json`/`package-lock.json`, and disables unrelated catalogers so the SBOM contains only the dependencies that ship with that service.
103
+
-**Workspace SBOMs**: collect the node workspace inputs and hand them to `sbom_artifact` for a holistic view:
- Node.js (express app with transitive deps): [`examples/node_complex`](examples/node_complex/BUILD.bazel)
59
-
- JavaScript / pnpm monorepo scenarios:
60
-
- Service/package SBOM: point `sbom_artifact` at the Bazel binary target (for example a `js_binary`). The Syft wrapper stages only that target's runfiles, synthesises a scoped `package.json`/`package-lock.json`, and disables GitHub Action catalogers, so the SBOM lists just the dependencies that ship with the service.
61
-
- Whole-repo SBOM: collect the workspace-level pnpm state into a `filegroup` and wrap it with `sbom_artifact`:
Building this target produces a CycloneDX SBOM that aggregates every dependency resolved across the pnpm workspace.
82
-
- Go services:
83
-
- Service-level SBOMs can include the compiled binary together with module metadata. One approach is to create a `filegroup` that contains the service binary plus `go.mod`/`go.sum`, then pass that group to `sbom_artifact` so Syft enumerates the transitive Go modules.
84
-
- Workspace-level SBOMs can reuse the same `filegroup` pattern as the pnpm example above: add the repository `go.mod`/`go.sum` (andany additional module manifests) alongside the Node.js inputs before invoking `sbom_artifact`.
133
+
134
+
Each example maps directly onto the service-level recipe above; combine the manifests you need to produce a workspace-level SBOM.
0 commit comments