Skip to content

fix: wire validate_command_network_egress into execute_task#631

Open
ionfwsrijan wants to merge 3 commits into
utksh1:mainfrom
ionfwsrijan:fix/614-validate-command-network-egress
Open

fix: wire validate_command_network_egress into execute_task#631
ionfwsrijan wants to merge 3 commits into
utksh1:mainfrom
ionfwsrijan:fix/614-validate-command-network-egress

Conversation

@ionfwsrijan
Copy link
Copy Markdown
Contributor

Description

The function validate_command_network_egress() in validation.py inspects 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.py or routes.py). While the primary target field is validated, secondary plugin fields like proxy, virtual_host, config_file, and user_agent can contain arbitrary network destinations that bypass target validation entirely.

Fix: wire validate_command_network_egress() into executor.py's execute_task() right after the command is built and before Docker sandboxing, ensuring every command argument is validated.

Related Issues

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

The validate_command_network_egress function is now called after plugin_manager.build_command() completes and before subprocess execution. If any argument fails validation, a ValueError is raised, preventing task execution.

Checklist

  • My code follows the code style of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.

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
@ionfwsrijan ionfwsrijan force-pushed the fix/614-validate-command-network-egress branch 2 times, most recently from 8cb3b8d to 06d0663 Compare June 6, 2026 09:02
@ionfwsrijan ionfwsrijan force-pushed the fix/614-validate-command-network-egress branch from 06d0663 to c610ba5 Compare June 6, 2026 09:26
@ionfwsrijan
Copy link
Copy Markdown
Contributor Author

@utksh1 You may review and merge this

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