Skip to content

Migrate cloud SBOM collection to asynchronous reports - #66

Open
gubraun wants to merge 6 commits into
mainfrom
gubraun-async-sbom-migration
Open

gubraun wants to merge 6 commits into
mainfrom
gubraun-async-sbom-migration

Conversation

@gubraun

@gubraun gubraun commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Use the asynchronous SBOM generation and report APIs for GitHub.com and data-residency hosts, with bounded polling and credential-free downloads.
  • Preserve the documented synchronous GHES API and existing SBOM cache and search behavior.
  • Add focused regression coverage and document hosting compatibility and the cloud endpoint removal date.

Validation

  • npm run lint
  • npm run build
  • npm test
  • Bounded live GitHub.com fetch observed 201 generation, 202 processing, 302 redirect, and an unauthenticated 200 download containing 251 SPDX packages.

GHES compatibility is based on the published API documentation and mocked coverage; it was not tested against a live GHES instance.

Preserve the documented synchronous GHES API, existing cache and search shape, and repository-level error handling. Bound async generation, polling and download; keep GitHub credentials off download hosts.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@gubraun
gubraun requested a review from a team as a code owner November 6, 2026 10:24
@gubraun
gubraun requested review from adrienpessu and felickz and a balanced review from Copilot November 6, 2026 10:24
Comment thread src/sbomFetch.test.ts Fixed
…ring sanitization'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

SBOM fetching rejects valid URLs with different repository casing and misclassifies cloud repositories such as api/v3 as GHES, selecting the deprecated synchronous endpoint.

2 open issues
What changed in this PR

Migrates cloud SBOM collection to asynchronous reports ahead of the synchronous endpoint’s removal, while retaining synchronous GHES support and the existing cache format.

Changes:

  • Adds report generation, bounded polling, and credential-free downloads.
  • Integrates the new fetch flow without changing cache and search interfaces.
  • Adds regression coverage and documents hosting compatibility.
File Description
src/​types.ts Updates comments to describe both SBOM sources.
src/​sbomFetch.ts Implements asynchronous cloud fetching and synchronous GHES routing.
src/​sbomFetch.test.ts Covers fetching, timeouts, redirects, validation, and cache integration.
src/​sbomCollector.ts Delegates fetching to the new helper while preserving result metadata.
README.md Documents hosting support, deadlines, and cloud endpoint removal.
package.json Adds SBOM fetch regression tests to the test command.

Review effort: Balanced

Comment thread src/sbomFetch.ts Resolved
Comment thread src/sbomFetch.ts Resolved
Copilot AI balanced review requested due to automatic review settings November 6, 2026 10:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Collection can fail for valid repositories because report URL validation rejects casing differences and the cloud repository api/v3 is incorrectly classified as GHES.

2 open issues

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 6, 2026 10:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Case-sensitive report URL checks reject valid repositories, an unanchored GHES regex can misroute cloud requests, and non-abortable rate-limit waits can keep the CLI running beyond its deadline.

3 open issues

Review effort: Balanced

Comment thread src/sbomFetch.ts
throw timeoutError;
};
try {
return await Promise.race([run(), deadline]);
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 6, 2026 11:01
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The URL regex misclassifies the GitHub.com repository api/v3 as GHES, routing SBOM requests to a deprecated synchronous endpoint that will fail after removal.

1 open issue
2 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 6, 2026 11:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

GHES API URLs with path prefixes are incorrectly routed to the cloud-only report flow instead of the synchronous endpoint, breaking support for existing custom base URLs.

2 open issues

Review effort: Balanced

Comment thread src/sbomFetch.ts Resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 6, 2026 13:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human assessment is needed because API redirects after repository transfers can break SBOM generation even when metadata resolution succeeds.

1 open issue
1 resolved since last review

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants