tracebom

August 13, 2026 · View on GitHub

tracebom is a dedicated, lean standalone binary for dynamic SBOM generation. It executes a command under the @cdxgen/safer-exec sandbox, traces the shared libraries it loads at runtime (dlopen), collects HTTP URLs accessed by the process, and produces a CycloneDX JSON Bill-of-Materials file with both library components and enumerated services.

Synopsis

tracebom --cmd <command> [options]

Flags

FlagTypeDefaultDescription
--cmdstringRequired. Command to execute and trace.
-d, --working-dirstringcwd()Working directory for the traced process.
-o, --outputstringbom.jsonOutput SBOM file path.
--spec-versionnumber1.6CycloneDX spec version.
--project-namestringOverride component name.
--project-versionstringOverride component version.
--read-pathsstringComma-separated extra filesystem read paths for the sandbox.
--write-pathsstringComma-separated sandbox write paths (overrides default of OS tmpdir).
--max-memorynumber512Max memory MB for sandbox.
--max-cpunumberMax CPU cores as fractional number (e.g. 0.5 for half a core).
--max-processesnumber64Max process count for sandbox.
--timeoutnumber60000Trace timeout in milliseconds.
--disable-networkbooleantrueDisable network inside sandbox. Automatically disabled when --trace-http-urls is set.
--trace-http-urlsbooleanfalseEnable eBPF-based HTTP URL tracing (Linux only, kernel >= 5.8). Requires CAP_BPF.
--trace-cryptobooleantrueEnable eBPF-based cryptographic library and cipher suite tracing (Linux only, kernel >= 5.8).
--crypto-probe-modestringtls-onlyCrypto probe mode controlling tracing depth: tls-only (default) or operations (digest, encrypt, sign).
--cbom-outputstringSave a standalone CycloneDX CBOM JSON file at this path.
--trace-periodnumberStop tracing after N seconds. Useful for tracing long-running or persistent commands.
--sanitize-envbooleanfalseStrip sensitive environment variables (TOKEN, SECRET, AUTH, etc.) before sandboxed execution.
--diffbooleanfalseEnable filesystem mutation diffing. Tracks which files are created, modified, or deleted.
--strictbooleanfalseTreat sandbox setup warnings as hard errors. Useful for CI/CD pipelines.
--allow-hoststringComma-separated hostnames to allow network access to (when network is enabled).
--allow-portstringComma-separated TCP ports to allow network access to.
--allow-urlstringComma-separated URL allow rules for fine-grained HTTP access control (Linux only, requires --trace-http-urls).
--allow-envsstring-Comma-separated host environment variables allowed to pass through the sandbox.
--allow-hiddenbooleantrueAllow reading and writing to hidden files and directories.
--allow-listenstring-Comma-separated IP addresses or ip:port strings to allow the sandboxed process to bind/listen to.
--block-forkbooleanfalsePrevent the traced process from forking new processes.
--trace-execbooleanfalseLog every child process spawned by the traced command.
--allow-execstringComma-separated list of executables the traced command is allowed to run.
--block-execstringComma-separated list of executables to block from running.
--printbooleanfalsePrint BOM to stdout.

Examples

# Trace a Node.js script
tracebom --cmd "node app.js" -o bom.json

# Trace with a custom working directory
tracebom --cmd "node app.js" -d /path/to/app -o bom.json

# Trace with sandbox limits
tracebom --cmd "node app.js" --max-memory 256 --timeout 30000 --print

# Collect HTTP URLs as services from a persistent server (stop after 30 seconds)
tracebom --cmd "node server.js" --trace-http-urls --trace-period 30 -o bom.json

# Trace cryptographic library operations and generate CBOM
tracebom --cmd "node app.js" --trace-crypto --cbom-output cbom.json -o bom.json

# Trace with CPU limit and environment sanitization
tracebom --cmd "node app.js" --max-cpu 0.5 --sanitize-env -o bom.json

# Trace with strict mode and filesystem diff (CI/CD use case)
tracebom --cmd "npm install" --strict --diff --write-paths /tmp/npm-cache -o bom.json

# Trace with network allow-lists and fork protection
tracebom --cmd "node server.js" --allow-host registry.npmjs.org,api.github.com --block-fork -o bom.json

# Trace with exec restrictions
tracebom --cmd "npm install" --allow-exec node,npm --block-exec sh,bash -o bom.json

Output

The generated CycloneDX BOM includes:

  • Components: Shared libraries loaded by the traced process at runtime, with SHA-256 hashes and OS package resolution.
  • Services: Enumerated HTTP endpoints accessed by the process, grouped by host. Each service includes full request URLs as endpoints and metadata such as cdx:service:httpMethod properties.

Sandbox model

The sandbox is enforced by @cdxgen/safer-exec using OS-level controls:

  • Linux: seccomp, Landlock network confinement, cgroup v2 resource limits, namespace isolation
  • macOS: Seatbelt sandboxing
  • Windows: No sandbox support — tracebom produces an empty component list

The sandbox blocks network access by default, restricts write paths to the OS temp directory, and caps memory/process/timeout resources. Read paths can be extended with --read-paths. Network access is automatically re-enabled when --trace-http-urls is set.

Limitations

  • @cdxgen/safer-exec must be installed (it is an optional dependency of @cdxgen/cdxgen)
  • Windows has no safer-exec binary; tracebom falls back gracefully with an empty component list
  • The traced command runs in an isolated sandbox — some programs may behave differently under sandbox restrictions
  • HTTP URL tracing (--trace-http-urls) requires Linux kernel >= 5.8 with eBPF support and CAP_BPF / CAP_PERFMON capabilities (effectively root)