Skip to content

[fix] Add defensive check in Manifest Scanner#13612

Merged
sfc-gh-bnisco merged 1 commit intodevelopfrom
01-16-_fix_add_defensive_check_in_manifest_scanner
Jan 16, 2026
Merged

[fix] Add defensive check in Manifest Scanner#13612
sfc-gh-bnisco merged 1 commit intodevelopfrom
01-16-_fix_add_defensive_check_in_manifest_scanner

Conversation

@sfc-gh-bnisco
Copy link
Copy Markdown
Collaborator

@sfc-gh-bnisco sfc-gh-bnisco commented Jan 16, 2026

Describe your changes

Added defensive handling for distributions without a valid name in the component manifest scanner. The scanner now properly skips distributions with missing or invalid names instead of potentially raising errors during processing.

This was raised in this comment: #13600 (comment)

Testing Plan

  • Adds new unit test

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@sfc-gh-bnisco sfc-gh-bnisco added change:bugfix PR contains bug fix implementation impact:users PR changes affect end users security-assessment-completed labels Jan 16, 2026 — with Graphite App
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 16, 2026

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-13612/streamlit-1.53.0-py3-none-any.whl
📦 @streamlit/component-v2-lib Download from artifacts
🕹️ Preview app pr-13612.streamlit.app (☁️ Deploy here if not accessible)

@snyk-io
Copy link
Copy Markdown
Contributor

snyk-io bot commented Jan 16, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

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 adds defensive handling for distributions with missing or invalid names in the component manifest scanner. The fix prevents potential runtime errors when the scanner encounters malformed distribution metadata during package scanning.

Changes:

  • Added a defensive check in _is_likely_streamlit_component_package() to validate that dist.name exists and is a non-empty string before attempting to process it
  • Added a unit test to verify that distributions with None or invalid names are properly skipped during scanning

Reviewed changes

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

File Description
lib/streamlit/components/v2/manifest_scanner.py Added defensive check to validate dist.name is a valid string before processing in the filter function
lib/tests/streamlit/components/v2/test_manifest_scanner.py Added test case verifying distributions without valid names are skipped and valid distributions are still processed
Comments suppressed due to low confidence (1)

lib/tests/streamlit/components/v2/test_manifest_scanner.py:320

  • The test doesn't cover the type check portion of the defensive logic (not isinstance(dist_name, str)). Consider adding a test case where dist.name is set to an integer or other non-string type to verify that branch of the condition is also working correctly.
    nameless_dist = Mock()
    nameless_dist.name = None

@sfc-gh-bnisco sfc-gh-bnisco force-pushed the 01-16-_fix_add_defensive_check_in_manifest_scanner branch from 32417c6 to defa929 Compare January 16, 2026 21:32
@sfc-gh-bnisco sfc-gh-bnisco requested a review from Copilot January 16, 2026 21:32
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 2 out of 2 changed files in this pull request and generated 1 comment.

@sfc-gh-bnisco sfc-gh-bnisco force-pushed the 01-16-_fix_add_defensive_check_in_manifest_scanner branch from defa929 to f04e9f4 Compare January 16, 2026 21:39
@sfc-gh-bnisco sfc-gh-bnisco requested a review from Copilot January 16, 2026 21: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 2 out of 2 changed files in this pull request and generated no new comments.

@sfc-gh-bnisco sfc-gh-bnisco marked this pull request as ready for review January 16, 2026 21:45
Copy link
Copy Markdown
Collaborator

@lukasmasuch lukasmasuch left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@github-actions
Copy link
Copy Markdown
Contributor

📉 Frontend coverage change detected

The frontend unit test (vitest) coverage has decreased by 0.0500%

  • Current PR: 86.5200% (12899 lines, 1738 missed)
  • Latest develop: 86.5700% (12899 lines, 1732 missed)

💡 Consider adding more unit tests to maintain or improve coverage.

📊 View detailed coverage comparison

@sfc-gh-bnisco sfc-gh-bnisco enabled auto-merge (squash) January 16, 2026 21:51
@sfc-gh-bnisco sfc-gh-bnisco merged commit 272db24 into develop Jan 16, 2026
50 checks passed
@sfc-gh-bnisco sfc-gh-bnisco deleted the 01-16-_fix_add_defensive_check_in_manifest_scanner branch January 16, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:bugfix PR contains bug fix implementation impact:users PR changes affect end users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants