List of allowed hosts and commands

May 26, 2026 ยท View on GitHub

cdxgen supports allowlisting for external commands and remote hosts. Use the environment variables CDXGEN_ALLOWED_COMMANDS and CDXGEN_ALLOWED_HOSTS to set these values. To allow commands and hosts correctly, make sure to add Operating System-specific commands along with common commands if there are any!

Examples:-

add "ldd" command only when the testing system is linux. Check commands for more details.

CDXGEN_ALLOWED_COMMANDS="foo" (other systems)
CDXGEN_ALLOWED_COMMANDS="foo,ldd" (linux systems)
  • Nodejs
CDXGEN_ALLOWED_HOSTS="localhost,registry.npmjs.org"
CDXGEN_ALLOWED_COMMANDS="npm,pnpm,yarn,rush"
  • Golang
CDXGEN_ALLOWED_HOSTS="localhost,proxy.golang.org,pkg.go.dev"
CDXGEN_ALLOWED_COMMANDS="go"
  • Rust
CDXGEN_ALLOWED_HOSTS="localhost,crates.io"
CDXGEN_ALLOWED_COMMANDS="cargo"

These env variables should provided like this:

CDXGEN_ALLOWED_HOSTS=<hosts>
CDXGEN_ALLOWED_COMMANDS=<commands>
CDXGEN_TRACE_ID=<foo>
node bin/cdxgen.js -t <type of projects> --json-pretty -o bom.json $(pwd)

Try to avoid using broader shell and runtime commands such as bash, zsh, java, node, etc. If this is unavoidable, carefully evaluate the arguments and the underlying scripts and configuration that might get used for execution.

HBOM secure-mode review

HBOM is special because the optional @cdxgen/cdx-hbom collector can declare its planned commands and local file reads during hbom --dry-run.

  • Review hbom --dry-run first.
  • In secure mode, cdxgen aborts live HBOM collection when those declared commands fall outside CDXGEN_ALLOWED_COMMANDS or the declared local paths fall outside CDXGEN_ALLOWED_PATHS.
  • On Linux hosts, CDXGEN_ALLOWED_PATHS often needs explicit inventory roots such as /proc, /sys, and /etc in addition to the command allowlist.
  • On Linux hbom --privileged runs with @cdxgen/cdx-hbom, also allowlist sudo when you want the collector's explicit sudo -n retry path for permission-sensitive commands.
  • On Apple Silicon macOS, command allowlists are usually the main control unless plist-backed enrichment is enabled.

Common Commands (All Platforms)

Language / PlatformProject TypesExternal CommandsRemote Hosts
Node.jsnpm, pnpm, nodejs, js, javascript, typescript, ts, tsx, yarn, rushnpm, pnpm, yarn, rushregistry.npmjs.org
Node.js (Specific version)node* (Example: node10, node12, node18, node20)npm, pnpm, yarn, rushregistry.npmjs.org
Java (Default)java, groovy, kotlin, scala, jvm, gradle, mvn, maven, sbt, quarkus, millmvn, gradle, sbt*.maven.org
Java (Specific version)java* (Example: java11, java17, java25, java26)mvn, gradle, sbt*.maven.org
Androidandroid, apk, aabUsually noneUsually none
JARjarUsually noneUsually none
JAR (Gradle Cache)gradle-index, gradle-cacheUsually noneUsually none
JAR (SBT Cache)sbt-index, sbt-cacheUsually noneUsually none
JAR (Maven Cache)maven-index, maven-cache, maven-repoUsually noneUsually none
Python (Default)python, py, pypi, uv, pip, poetry, pdm, hatchpip, poetry, uvpypi.org
Python (Specific version)python* (Example: python38, python39, python311)pip, poetry, uvpypi.org
Golanggo, golanggopkg.go.dev, proxy.golang.org, pkg.go.dev
Rustrust, rust-lang, cargocargocrates.io
Rubyruby, gems, rubygems, bundler, rb, gemspecbundlerubygems.org
Ruby (Specific version)ruby* (Example: ruby2.5.4, ruby3.4.0)bundlerubygems.org
PHPphp, composercomposerUsually none (add api.github.com if using packages that fetch from GitHub)
.NET (C#)csharp, netcore, dotnet, vb, dotnet-frameworkdotnetapi.nuget.org (add api.github.com if using packages that fetch from GitHub)
Dartdart, flutter, pubpubpub.dev
Haskellhaskell, hackage, cabalcabalUsually none
Elixirelixir, hex, mixmixUsually none
C++c, cpp, c++, conanconan, cmakeUsually none
Clojureclojure, edn, clj, leiningenclj, leinUsually none
GitHub Actionsgithub, actionsUsually noneUsually none
Jenkins PluginsjenkinsUsually noneUsually none
Helmhelm, chartshelmUsually none
Helm (Cache)helm-index, helm-repohelmUsually none
Containeroci, docker, podman, container, rootfs, oci-dirdocker, podman (not required for local rootfs / oci-dir directory inputs)docker.io, api.nuget.org, *.maven.org (not required for local rootfs / oci-dir directory inputs)
Container Fileuniversal, containerfile, docker-compose, dockerfile, swarm, tekton, kustomize, operator, skaffold, kubernetes, openshift, yaml-manifestUsually noneUsually none
Google Cloud BuildcloudbuildUsually noneUsually none
Swift (iOS)swiftswiftUsually none (add api.github.com if using packages that fetch from GitHub)
Binarybinary, blintblint, cargo, jarUsually none
Nix Flakesnix, nixos, flakeUsually noneUsually none (add api.github.com, github.com if flakes fetch from GitHub)
Open APIyaml-manifestUsually noneUsually none
Operating Systemos, osquery, windows, linux, mac, macos, darwinosqueryUsually none

Platform-Specific Commands

These external commands are only invoked in certain platforms.

Linux Only

Language / PlatformExternal CommandsPurpose
All LanguageslddList dynamic dependencies
Operating Systemdpkg, rpm, apkPackage managers
Containerdpkg, rpm, apkContainer package inspection

macOS Only

Language / PlatformAdditional CommandsPurpose
cocoapodspodCocoaPods dependency manager
Operating SystembrewHomebrew package manager

Windows Only

Language / PlatformAdditional CommandsPurpose
.NET (C#)nugetNuGet package manager
Operating SystemchocoChocolatey package manager
Operating SystemwingetWinget package manager