[feat] Add ComponentManifest infra#12637
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ PR preview is ready!
|
528e219 to
368d4fe
Compare
📉 Python coverage change detectedThe Python unit test coverage has decreased by 0.0722%
💡 Consider adding more unit tests to maintain or improve coverage. Coverage by files
|
There was a problem hiding this comment.
Pull Request Overview
This PR introduces the Component Catalog v2 (CCv2) infrastructure for discovering and processing Streamlit component manifests defined in pyproject.toml files. The implementation provides a robust system for scanning installed Python packages, extracting component definitions, and managing asset paths with security constraints.
Key Changes:
- Adds component manifest scanning with parallel processing and early filtering to optimize performance
- Implements path utilities with security validation to prevent path traversal attacks
- Creates a manifest handler that processes component definitions and enforces asset root constraints
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
lib/streamlit/components/v2/manifest_scanner.py |
Core scanner that discovers pyproject.toml files across installed packages and extracts component manifests |
lib/streamlit/components/v2/component_path_utils.py |
Security-focused path utilities for validating component asset paths and preventing traversal attacks |
lib/streamlit/components/v2/component_manifest_handler.py |
Processes manifests into component definitions while enforcing asset directory constraints |
lib/streamlit/components/v2/__init__.py |
Package initialization file |
lib/tests/streamlit/components/v2/test_manifest_scanner.py |
Comprehensive test suite covering manifest scanning, path resolution, and edge cases |
Comments suppressed due to low confidence (1)
lib/streamlit/components/v2/component_manifest_handler.py:1
- Same security issue as Comment 2 - string prefix comparison for path validation is vulnerable to path traversal attacks where malicious paths with similar prefixes could bypass validation.
# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2025)
368d4fe to
37d911a
Compare
37d911a to
e18e755
Compare
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)
lib/streamlit/components/v2/manifest_scanner.py:1
- Using bare
except Exceptionclauses without logging the exceptions makes debugging difficult. Consider logging the exceptions at debug level or being more specific about which exceptions to catch.
# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2025)
e18e755 to
82c1b0e
Compare
c0b94ac to
a3ea4ff
Compare
82c1b0e to
8bdcce6
Compare
a3ea4ff to
7957af2
Compare
e55f66f to
256273d
Compare
a68b226 to
aeb5b04
Compare
60f1393 to
091465f
Compare
091465f to
77613c7
Compare
77613c7 to
93f342d
Compare

Describe your changes
manifest_scanner: Discovers installed packages that declare CCv2 metadata in pyproject.toml and parses aComponentManifest.component_path_utils: Centralizes secure path handling and file/glob resolution with parent directory traversal and symlink-escape protection.component_manifest_handler: Processes a parsed manifest, validatesasset_dirlocations, and stores per-component asset roots and metadata.Motivation:
We need a secure and reliable way to discover and validate third-party Streamlit CCv2s declared via package metadata, and to resolve their asset roots safely. This lays the foundation for automatic component registration and asset serving in a future PR.
GitHub Issue Link (if applicable)
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.