Skip to content

feat: TEA (Transparency Exchange API) integration#186

Open
aurangzaib048 wants to merge 40 commits into
sbomify:masterfrom
aurangzaib048:feature/tea-cli
Open

feat: TEA (Transparency Exchange API) integration#186
aurangzaib048 wants to merge 40 commits into
sbomify:masterfrom
aurangzaib048:feature/tea-cli

Conversation

@aurangzaib048
Copy link
Copy Markdown
Contributor

@aurangzaib048 aurangzaib048 commented Mar 6, 2026

Summary

  • Add libtea>=0.4.0,<1 dependency for TEA client support
  • Add sbomify-action tea CLI subcommand group (re-exports libtea's 15+ commands)
  • Add sbomify-action tea fetch convenience command (discovery → collection → download in one step)
  • Add TEA enrichment source with PURL-to-domain auto-discovery (pypipypi.sbomify.com)
  • Fetches CLE lifecycle data (release date, end-of-support, end-of-life) and licenses from TEA servers
  • TEA_BASE_URL env var overrides auto-discovery for any PURL type
  • Registered at priority 43 (Tier 2 aggregator) in the enrichment registry
  • SSRF validation for TEA_BASE_URL (rejects private, loopback, link-local, unspecified, and reserved IPs)

Test plan

  • 18 CLI tests (help output, fetch by TEI/UUID, format selection, error cases)
  • 25 enrichment tests (auto-discovery, base URL override, CLE extraction, caching, client reuse, token passthrough, SSRF)
  • Full suite: all passed
  • Lint and format clean

@aurangzaib048 aurangzaib048 marked this pull request as ready for review March 9, 2026 13:49
Copilot AI review requested due to automatic review settings March 9, 2026 13:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR integrates the Transparency Exchange API (TEA) into sbomify-action by adding libtea>=0.4.0 as a dependency, exposing libtea's CLI commands under sbomify-action tea, and adding a TeaSource enrichment plugin that auto-discovers TEA servers from PURL type mappings to fetch CLE lifecycle data (release date, end-of-support, end-of-life) and license information.

Changes:

  • New libtea>=0.4.0 dependency (with transitive deps: pydantic, pydantic-core, semver, annotated-types, typing-inspection), plus bumps of conan, identify, and sentry-sdk
  • New sbomify_action/cli/tea.py CLI group re-exporting libtea's commands plus a custom fetch convenience command
  • New sbomify_action/_enrichment/sources/tea.py enrichment source with PURL-to-domain auto-discovery and SSRF validation; registry early-exit logic updated to continue through CLE-capable sources even when NTIA fields are satisfied

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pyproject.toml Adds libtea>=0.4.0,<1 as a direct dependency
uv.lock Resolves libtea==0.4.0 and its transitive dependencies; bumps conan, identify, sentry-sdk
sbomify_action/cli/tea.py New CLI subcommand group registering libtea's commands plus a custom fetch command
sbomify_action/cli/main.py Registers tea_group into the CLI; refactors PRODUCT_RELEASE validation to strip whitespace and collect cleaned entries
sbomify_action/_enrichment/sources/tea.py New enrichment source with SSRF-safe TEA_BASE_URL override, client caching, CLE event extraction
sbomify_action/_enrichment/sources/__init__.py Exports TeaSource
sbomify_action/_enrichment/registry.py Adds _CLE_PROVIDERS set and updates early-exit logic to continue querying CLE-capable sources even when NTIA fields are complete
sbomify_action/_enrichment/metadata.py Adds cle_release_date to has_data() check
sbomify_action/_enrichment/enricher.py Registers TeaSource at priority 43 and adds clear_tea() to clear_all_caches()
tests/test_tea_enrichment.py 22 new enrichment tests covering discovery, caching, CLE extraction, SSRF, token pass-through
tests/test_tea_cli.py 17 new CLI tests covering fetch flow, error handling, and _select_best_format

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sbomify_action/cli/tea.py
Comment thread sbomify_action/_enrichment/sources/tea.py Outdated
Comment thread tests/test_tea_cli.py
Comment thread tests/test_tea_enrichment.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sbomify_action/_enrichment/sources/tea.py
Comment thread sbomify_action/_enrichment/sources/tea.py Outdated
Comment thread sbomify_action/_enrichment/sources/tea.py Outdated
Comment thread sbomify_action/_enrichment/registry.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sbomify_action/_enrichment/enricher.py
Comment thread sbomify_action/_enrichment/registry.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/conftest.py
Comment thread sbomify_action/_enrichment/sources/tea.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sbomify_action/cli/tea.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sbomify_action/_enrichment/sources/tea.py Outdated
Comment thread sbomify_action/cli/tea.py
Copilot AI review requested due to automatic review settings March 9, 2026 19:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sbomify_action/_enrichment/registry.py Outdated
Comment thread tests/test_tea_cli.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sbomify_action/_enrichment/protocol.py Outdated
Comment thread tests/test_tea_enrichment.py
Comment thread sbomify_action/cli/tea.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/conftest.py
@aurangzaib048 aurangzaib048 requested a review from Copilot March 9, 2026 20:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread sbomify_action/_enrichment/sources/tea.py Outdated
Comment thread sbomify_action/_enrichment/sources/tea.py
- Replace manual is_private/is_loopback/etc checks with ip.is_global
  which also rejects multicast (224.0.0.0/4, ff00::/8) and other
  non-globally-routable ranges
- Add comment explaining str() wrap on to_string() for mypy strict
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_tea_enrichment.py Outdated
Comment thread sbomify_action/_enrichment/registry.py
…cstring

- Add clear=True to test_fetch_base_url_override and
  test_fetch_base_url_with_token to prevent TEA_TOKEN env pollution
- Update fetch_metadata docstring to describe two-phase early exit:
  NTIA+CLE complete stops entirely, NTIA-only skips non-CLE sources
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sbomify_action/_enrichment/sources/tea.py Outdated
Comment thread sbomify_action/cli/tea.py Outdated
Comment thread sbomify_action/_enrichment/sources/tea.py Outdated
…erride first

- Move _is_safe_url call inside cache-miss branch to avoid redundant
  DNS resolution on every _get_client invocation
- Import libtea private helpers (_build_client, _error) via getattr with
  fallback functions that provide clear error messages if API changes
- Check TEA_BASE_URL safety first in supports() — unsafe override now
  returns False for all PURL types instead of only unmapped ones
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sbomify_action/_enrichment/sources/tea.py
Split _is_safe_url into a cached wrapper and _check_url_safety for
the actual check. Results are memoized per URL in _url_safety_cache,
making supports() O(1) after the first call. Cache is cleared by
clear_cache().
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sbomify_action/_enrichment/enricher.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sbomify_action/cli/tea.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sbomify_action/_enrichment/sources/tea.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants