fix: wire validate_command_network_egress into execute_task#631
fix: wire validate_command_network_egress into execute_task#631ionfwsrijan wants to merge 7 commits into
Conversation
The function validate_command_network_egress() was defined in validation.py but never imported or invoked anywhere in the execution pipeline. This meant secondary plugin fields like proxy, virtual_host, config_file, and user_agent could contain arbitrary network destinations that bypassed target validation entirely. Now validate_command_network_egress() is called right after the command is built and before Docker sandboxing, ensuring every command argument is inspected for network destinations against the safe-mode + network policy configuration. Fixes utksh1#614
8cb3b8d to
06d0663
Compare
06d0663 to
c610ba5
Compare
|
@utksh1 You may review and merge this |
utksh1
left a comment
There was a problem hiding this comment.
Focused security fix wiring validate_command_network_egress into task execution before sandbox execution. Checks are green; approving.
utksh1
left a comment
There was a problem hiding this comment.
After #629 merged, this branch now conflicts with main because it carries the same CI baseline files. The security fix is still useful, but this PR is not mergeable now. Please rebase on latest main and keep only the validate_command_network_egress execution-path change plus its directly related validation change/tests.
…and-network-egress
…and-network-egress
utksh1
left a comment
There was a problem hiding this comment.
Re-reviewed after the latest update. The branch is no longer conflicted, but it still carries unrelated CI-baseline/frontend test changes in addition to the executor/validation security fix. Please rebase on latest main and narrow the PR to backend/secuscan/executor.py, backend/secuscan/validation.py, and directly related tests only.
|
@utksh1 You may merge this now |
Description
The function
validate_command_network_egress()invalidation.pyinspects every command argument for network destinations against the safe-mode + network policy configuration. However, it is never imported or invoked anywhere in the execution pipeline (executor.pyorroutes.py). While the primarytargetfield is validated, secondary plugin fields likeproxy,virtual_host,config_file, anduser_agentcan contain arbitrary network destinations that bypass target validation entirely.Fix: wire
validate_command_network_egress()intoexecutor.py'sexecute_task()right after the command is built and before Docker sandboxing, ensuring every command argument is validated.Related Issues
validate_command_network_egressis Dead Code — Secondary Fields Bypass Target Validation #614Type of Change
How Has This Been Tested?
The
validate_command_network_egressfunction is now called afterplugin_manager.build_command()completes and before subprocess execution. If any argument fails validation, aValueErroris raised, preventing task execution.Checklist