fix: restrict importlib provider loading to trusted namespaces - #7463
Merged
Conversation
Add namespace allowlist to ComponentLoader.load_component() so that arbitrary module paths in ComponentModel.provider are rejected by default. Only first-party autogen packages (autogen_core, autogen_agentchat, autogen_ext, autogen_studio, autogenstudio) are trusted. Users with custom provider packages can extend the allowlist via the AUTOGEN_ALLOWED_PROVIDER_NAMESPACES environment variable. Also harden VideoSurfer extract_audio() against SSRF via ffmpeg by rejecting URL inputs, enforcing .mp3 extension, and preventing path traversal outside the working directory.
Add the caution and security note language to the AutoGen Studio GitHub README, the main repo README, and the installation docs to make it clear that AutoGen Studio is not production-ready. Also fix minor lint issues from prior commit (ruff format, unused import).
Allow test_ prefixed modules (pytest convention) and add autogen_test_utils to trusted namespaces. Remove conftest-based env var approach which was unreliable across package boundaries.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7463 +/- ##
==========================================
+ Coverage 81.21% 81.23% +0.01%
==========================================
Files 244 244
Lines 18514 18527 +13
==========================================
+ Hits 15037 15050 +13
Misses 3477 3477
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ComponentLoader.load_component()to only load providers from trusted first-party AutoGen namespaces (autogen_core,autogen_agentchat,autogen_ext,autogen_studio,autogenstudio), preventing arbitrary module loading via untrusted provider stringsAUTOGEN_ALLOWED_PROVIDER_NAMESPACESenvironment variable so users with custom provider packages can extend the allowlistextract_audio()to reject URL inputs (SSRF), enforce.mp3extension, and block path traversalTest plan
test_untrusted_provider_rejected— verifies providers outside trusted namespaces are blockedtest_trusted_provider_via_env_var— verifies env var extends the allowlistpoe formatcleanpoe lintcleanpoe pyrightclean (0 errors in autogen-core)poe mypyclean (0 errors in autogen-core)