Skip to main content
Menu
Advisories

Registry and API tokens are used for requests that scanned or remote content chooses

GHSA-W9PW-R782-3752Published Updated GitHub

Description

cdxgen attaches the operator's credentials to outgoing requests based on the host name, while scanned content or a remote service chooses what is requested. A scanned repository can have cdxgen read a GitHub document with the operator's GITHUB_TOKEN and copy part of it into the BOM; a public Hugging Face model card can have cdxgen read the operator's private repositories with HF_TOKEN; and a registry login can be sent over plain HTTP.

Details

  • GitHub token and lock file URLs. For a scoped npm package, npmLookupRegistry() takes the registry from the lock file's resolved URL, or from a project .npmrc line, and does not require a registry root, so a URL on api.github.com turns into a request for an arbitrary GitHub API path. resolveAuthHeader() and buildAgentOptions() in lib/inventory/fetchBatch.js add the token for GitHub hosts on both transports, including the cdxrs fetch helper, without checking the scheme, and getNpmMetadata() copies the response's description into the component without checking that it is a packument. The token itself only goes to GitHub hosts, but an http:// URL sends it unencrypted. This needs FETCH_LICENSE=true (or CDXGEN_FETCH_PKG_METADATA=true), secure mode off, and a token that can see more than the scanned repository; it works with --no-install-deps.
  • Hugging Face lineage. resolvePedigreeComponent() in lib/ecosystems/remote/huggingface.js fetches every repository listed under base_model or base_models in a model card, up to 20 per card and two levels deep, with the caller's options, and resolveHuggingFaceAccessToken() falls back to HF_TOKEN for any target. The publisher of a public model can thereby get base-model names, relations, quantization values and variant labels of private repositories they name into the operator's BOM. This only runs when the operator resolves a Hugging Face reference directly (a pkg:huggingface/... purl or a huggingface.co URL).
  • Registry login over HTTP. isSameRegistryHost() in lib/managers/oci.js decides whether the stored Docker login may go to the token realm a registry names in its 401 response. It compares host name and port but not the scheme, so an HTTPS registry whose realm is an http:// URL on the same host name receives the login over plain HTTP. This needs a registry configured that way, for example behind a TLS-terminating proxy; secure mode blocks the http: request. In the 12.x line, getOciToken() has no realm check at all and sends the login to whatever realm the registry names.

Impact

Disclosure of private repository metadata to authors of scanned content, when they can read the BOM, and exposure of registry credentials to network observers on misconfigured registries.

Patches

Fixed in @cdxgen/cdxgen 13.8.0. Versions 13.0.0 through 13.7.0 of @cdxgen/cdxgen are affected. The 12.x line, published as @cyclonedx/cdxgen, is also affected by some of the issues above from 12.5.1 through 12.9.1, and no 12.x release contains the fix. Users of 12.x should move to @cdxgen/cdxgen 13.8.0 or apply the workarounds below. File paths in this advisory refer to the 13.x source tree; in 12.x most of the same functions are under lib/helpers/ or in lib/cli/index.js.

cdxgen-plugins-bin 4.4.0 (cdxgen/cdxgen-plugins-bin#193) also hardens the cdxrs helper, which no longer reads GITHUB_TOKEN from its environment and sends a GitHub token only with a request that carries one. cdxgen 13.8.0 is fixed with any plugins-bin release; the plugins-bin change adds a second layer.

First affected release of each issue:

  • GitHub token and lock file URLs: 13.0.0 (not in 12.x)
  • Hugging Face lineage: 12.5.1
  • registry login over HTTP: 12.7.0

Workarounds

  • Give cdxgen tokens that can read only what the scan needs, and leave FETCH_LICENSE off for untrusted projects.
  • Unset HF_TOKEN when resolving models published by others.
  • Use secure mode, which refuses plain HTTP.

Credit

These issues were found by Anthropic's OSS Scanner (scan cdxgen-20261108-009) and reported as ANT-2026-88PHIUTQ, ANT-2026-R72FX1VR, ANT-2026-WYTKRJ7X.

References

Affected versions

References

GitHub · cdxgen/cdxgen