KEMBAR78
Add security warnings and default to DockerCommandLineCodeExecutor by ekzhu · Pull Request #7035 · microsoft/autogen · GitHub
Skip to content

Conversation

@ekzhu
Copy link
Collaborator

@ekzhu ekzhu commented Sep 17, 2025

This commit enhances security by:

  1. Default to DockerCommandLineCodeExecutor: Added create_default_code_executor()
    function that prefers Docker when available, falling back to Local with warnings

  2. LocalCommandLineCodeExecutor warnings: Added security warning when
    LocalCommandLineCodeExecutor is instantiated directly, recommending Docker instead

  3. CodeExecutorAgent approval warnings: Added warning when no approval_func
    is set, encouraging human oversight for code execution

  4. Centralized logic: Created shared utility in autogen_ext.code_executors
    for consistent default executor behavior across the codebase

  5. Updated MagenticOne: Refactored to use the shared default executor logic
    while maintaining backward compatibility

  6. Test compatibility: Updated test mocks to work with the new structure

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

Why are these changes needed?

Related issue number

Checks

This commit enhances security by:

1. **Default to DockerCommandLineCodeExecutor**: Added create_default_code_executor()
   function that prefers Docker when available, falling back to Local with warnings

2. **LocalCommandLineCodeExecutor warnings**: Added security warning when
   LocalCommandLineCodeExecutor is instantiated directly, recommending Docker instead

3. **CodeExecutorAgent approval warnings**: Added warning when no approval_func
   is set, encouraging human oversight for code execution

4. **Centralized logic**: Created shared utility in autogen_ext.code_executors
   for consistent default executor behavior across the codebase

5. **Updated MagenticOne**: Refactored to use the shared default executor logic
   while maintaining backward compatibility

6. **Test compatibility**: Updated test mocks to work with the new structure

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Sep 18, 2025

Codecov Report

❌ Patch coverage is 71.73913% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.08%. Comparing base (6f67b95) to head (276c414).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...gen-ext/src/autogen_ext/code_executors/__init__.py 65.78% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7035      +/-   ##
==========================================
+ Coverage   80.95%   81.08%   +0.13%     
==========================================
  Files         237      238       +1     
  Lines       18258    18271      +13     
==========================================
+ Hits        14780    14815      +35     
+ Misses       3478     3456      -22     
Flag Coverage Δ
unittests 80.95% <71.73%> (+<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.

@ekzhu ekzhu merged commit 17d3aef into main Sep 18, 2025
75 of 76 checks passed
@ekzhu ekzhu deleted the ekzhu/code-executor branch September 18, 2025 00:40
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