fix(security): upgrade LocalCommandLineCodeExecutor warning to DeprecationWarning#7467
Open
xr843 wants to merge 1 commit intomicrosoft:mainfrom
Open
fix(security): upgrade LocalCommandLineCodeExecutor warning to DeprecationWarning#7467xr843 wants to merge 1 commit intomicrosoft:mainfrom
xr843 wants to merge 1 commit intomicrosoft:mainfrom
Conversation
…ationWarning Addresses microsoft#7462 - The existing UserWarning for unsandboxed code execution is easily suppressed in production configurations (e.g., `-W ignore`). Changes: - Upgrade warning from UserWarning to DeprecationWarning, which is visible by default in __main__ contexts and harder to accidentally silence - Add logger.warning() call so the security message is visible in logging pipelines that don't capture Python warnings - Improve warning message with clearer description of the risk and link to documentation - Add test for the new DeprecationWarning behavior Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
|
@microsoft-github-policy-service agree |
Author
|
Hi team, just a gentle ping on this PR. CLA has been signed and all CI checks are passing. Happy to make any adjustments if needed. Thanks for your time! |
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
Fixes #7462
The
LocalCommandLineCodeExecutorcurrently emits aUserWarningat construction time to alert developers about unsandboxed code execution. However,UserWarningis easily suppressed in production configurations (e.g.,python -W ignore, logging pipelines that filter warnings), which means the security message can be silently swallowed.This PR makes the warning harder to accidentally suppress by:
UserWarningtoDeprecationWarning— visible by default in__main__contexts and not filtered by standard production warning configurationslogger.warning()call — ensures the security message is visible in logging pipelines that don't capture Python warnings (dual-channel notification)Changes
python/packages/autogen-ext/src/autogen_ext/code_executors/local/__init__.py:UserWarningtoDeprecationWarninglogger.warning()for logging pipeline visibilitypython/packages/autogen-ext/tests/code_executors/test_commandline_code_executor.py:DeprecationWarningbehaviorBackward Compatibility
This change is fully backward compatible:
UserWarningbroadly will still work sinceDeprecationWarningis a separate categoryTest plan
UserWarning)DeprecationWarningis emitted on constructionLocalCommandLineCodeExecutorand confirm warning is visible🤖 Generated with Claude Code