Skip to main content
Menu
Advisories

Path traversal in the GitHub catalog entity provider allows fetching catalog descriptors from outside the monitored repository

GHSA-FHQ2-7FHR-5X83Published Updated GitHub

Description

The GitHub catalog entity provider in @backstage/plugin-catalog-backend-module-github builds catalog location URLs from the file paths carried in GitHub push events without escaping them. A repository contributor can commit a file whose path contains literal percent-encoded dot segments (%2e%2e), which pass through the URL construction unchanged. When such a URL is later parsed, the encoded segments resolve as parent-directory traversal and change which repository the URL points to, and the provider then fetches a catalog descriptor from that other repository using its GitHub integration credential.

Details

When the GithubEntityProvider handles a github.push event, it matches the paths of files affected by the push against the configured catalogPath using glob matching, and constructs a location URL for each match by concatenating the raw committed file path onto the repository URL without percent-encoding or validation. The same raw path is also used in catalog refresh keys.

File names containing % are accepted by git and GitHub, so a contributor can commit a path such as %2e%2e/%2e%2e/%2e%2e/private/blob/main/catalog-info.yaml. Such a path matches a wildcard catalogPath glob (for example **/catalog-info.yaml), and the constructed URL then carries the encoded dot segments verbatim. When the location is fetched, URL parsing resolves the encoded segments as .. and they walk upward out of the original repository position, changing the owner and repository name that the URL resolves to. The safety check that guards these fetches inspects only the file-path component of the parsed URL; at that point the traversal has already been resolved into the repository components, so it is not detected.

Preconditions

All of the following are required for the described behavior:

  1. The GithubEntityProvider runs with the Backstage events service connected and subscribed to GitHub push events. Deployments that use scheduled scans only do not reach the affected code path.
  2. The provider is configured with a catalogPath that contains a glob pattern, for example **/catalog-info.yaml. The default catalogPath of /catalog-info.yaml matches only files at the repository root and cannot be triggered this way. Deployments that enable validateLocationsExist: true are not affected, because that option cannot be combined with a wildcard catalogPath.
  3. The attacker has push access to a repository covered by the provider's filters (organization and any configured repository, branch, visibility, fork, or topic filters) and pushes the crafted file path to the monitored branch.
  4. The GitHub integration credential for that host can read the repository that the traversal resolves to. With the commonly reachable traversal depth this means other repositories in the same organization.

Impact

An attacker with push access to a single monitored repository can make the provider ingest catalog descriptor files, such as catalog-info.yaml, from repositories outside the configured ingestion scope, including private repositories the attacker cannot read directly. The fetched entities become part of the catalog and are visible to all authenticated catalog users, so any sensitive information retained in such a descriptor becomes readable through the catalog API. In effect, push access to one repository allows a lower-privileged actor to direct the deployment's service credential to read repositories that it was not intended to ingest.

Patches

Affected package: @backstage/plugin-catalog-backend-module-github (npm), versions >= 0.2.2, the release that added GitHub push event handling to the GithubEntityProvider. Patched in 0.13.6 (Backstage release 1.54.13) and 0.14.3 (Backstage release 1.57.4): the provider now percent-encodes the committed file paths and branch names it builds location URLs and refresh keys from, and ignores paths or branches that contain . or .. segments.

Workarounds

  • Configure the provider with a non-wildcard catalogPath; the default /catalog-info.yaml is not affected.
  • Restrict the scope of the GitHub integration credential so that it can only read the repositories the provider is meant to ingest.

References

  • To be added when a fixed release is available.

Affected versions

References

GitHub · backstage/backstage