Skip to content

fix: restrict importlib provider loading to trusted namespaces - #7463

Merged
Victor Dibia (victordibia) merged 4 commits into
mainfrom
ags_fix_2
Mar 26, 2026
Merged

fix: restrict importlib provider loading to trusted namespaces#7463
Victor Dibia (victordibia) merged 4 commits into
mainfrom
ags_fix_2

Conversation

@victordibia

Copy link
Copy Markdown
Contributor

Summary

  • Restrict 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 strings
  • Add AUTOGEN_ALLOWED_PROVIDER_NAMESPACES environment variable so users with custom provider packages can extend the allowlist
  • Harden VideoSurfer extract_audio() to reject URL inputs (SSRF), enforce .mp3 extension, and block path traversal
  • Add security caution language to AutoGen Studio README, main repo README, and installation docs

Test plan

  • test_untrusted_provider_rejected — verifies providers outside trusted namespaces are blocked
  • test_trusted_provider_via_env_var — verifies env var extends the allowlist
  • All 226 autogen-core tests pass
  • poe format clean
  • poe lint clean
  • poe pyright clean (0 errors in autogen-core)
  • poe mypy clean (0 errors in autogen-core)
  • CI checks pass

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

codecov Bot commented Mar 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.23%. Comparing base (b047730) to head (1634d7a).
⚠️ Report is 1 commits behind head on main.

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              
Flag Coverage Δ
unittests 81.23% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@victordibia
Victor Dibia (victordibia) merged commit 8544314 into main Mar 26, 2026
77 checks passed
@victordibia
Victor Dibia (victordibia) deleted the ags_fix_2 branch March 26, 2026 03:15
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.

1 participant