Skip to content

qickfix for "false" route handling#2979

Open
MMikePL wants to merge 1 commit into
kevoreilly:masterfrom
PCSS-PSNC:feature/false-route-qickfix
Open

qickfix for "false" route handling#2979
MMikePL wants to merge 1 commit into
kevoreilly:masterfrom
PCSS-PSNC:feature/false-route-qickfix

Conversation

@MMikePL
Copy link
Copy Markdown

@MMikePL MMikePL commented Apr 16, 2026

If a user or an API call set the routing option to "false":
1.Initial identification (line 540) worked: The system use four different values as indicators to disable routing: "none", "None", "drop", and "false"
2.The "Drop" command was skipped: The code failed to call rooter("drop_enable", ...) because "false" was missing from the second check. This meant the network traffic might not have been explicitly blocked by the rooter as intended.
3.Cleanup was skipped: During task teardown, rooter("drop_disable", ...) was not called, potentially leaving the network state inconsistent for future tasks.

this fix ensure that rooter correctly enables and disables traffic dropping when "false" is used.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the network routing logic in lib/cuckoo/core/analysis_manager.py to include 'false' as a valid value for disabling routing in both route_network and unroute_network methods. The reviewer suggests refactoring these checks to be case-insensitive and to handle potential boolean types more robustly, which would also reduce duplication across the file.

self.rooter_response = rooter("libvirt_fwo_enable", self.machine.interface, self.machine.ip)

elif self.route in ("none", "None", "drop"):
elif self.route in ("none", "None", "drop", "false"):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The tuple of routing values ("none", "None", "drop", "false") is now duplicated in three places within this file (lines 540, 609, and 746). To improve maintainability and robustness, consider using a case-insensitive check. This approach also handles variations like "False" or "DROP" and correctly processes boolean False values that might be passed via API calls.

Suggested change
elif self.route in ("none", "None", "drop", "false"):
elif str(self.route).lower() in ("none", "drop", "false"):

self.rooter_response = rooter("libvirt_fwo_disable", self.machine.interface, self.machine.ip)

elif self.route in ("none", "None", "drop"):
elif self.route in ("none", "None", "drop", "false"):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with the logic in route_network, consider using a case-insensitive check here as well. This ensures that the cleanup process correctly identifies all variations of the 'no routing' state.

Suggested change
elif self.route in ("none", "None", "drop", "false"):
elif str(self.route).lower() in ("none", "drop", "false"):

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