Repository navigation
fix(auxiliary/mitmdump): skip stop cleanup when mitmdump is not enabled for task - #103
Closed
karlhiramoto wants to merge 2 commits into
Closed
karlhiramoto wants to merge 2 commits into
karlhiramoto wants to merge 2 commits into
Conversation
…ts, and parse options
karlhiramoto
marked this pull request as ready for review
November 27, 2026 09:31
dsecuma
approved these changes
Nov 27, 2026
dsecuma
left a comment
There was a problem hiding this comment.
Review Summary: LGTM / Approved ✅
Reviewed VirusTotal/CAPEv2#103 (fix/mitmdump-skip-stop-when-disabled, commit ebc1b16ddc60b64ac3cda2fb7f1986ca337a1dbb).
Verification Summary
- Logic & Context (
modules/auxiliary/Mitmdump.py):_is_mitmdump_enabledaccurately parses comma-separated option tokens (rejecting falsy values and substrings) and skipsMitmdumpThreadcreation/port scanning when disabled, eliminating spuriousmitmdump.piderrors anddisable_mitmdumpcalls duringstop(). - Concurrency, Reliability & Tests (
modules/auxiliary/Mitmdump.py,tests/test_mitmdump.py): Synchronizingrun()/stop()with_state_lockandjoin(timeout=65), handlingrooter()dict errors with firewall rollback, reaping directself.procchildren cleanly, and adding 28 unit tests with all CI checks passing (test (3.10),test (3.14),check-changes,cla/google) look solid.
dsecuma
self-requested a review
November 27, 2026 10:44
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
When the
Mitmdumpauxiliary module is enabled inauxiliary.confbutmitmdumpis not enabled intask.options:Mitmdump.start()previously spawnedMitmdumpThread(scanning ports 8001-8080), which exited early inrun()without creatingmitmdump.pidor enabling firewall rules.MitmdumpThread.stop()unconditionally attempted to readmitmdump.pid(loggingERROR: Error: PID file not found at: .../mitmdump/mitmdump.pidand attaching that error totask.errors) and calledrooter("disable_mitmdump", ...).Changes
modules/auxiliary/Mitmdump.py:mitmdumpoption tokens cleanly in_is_mitmdump_enabled()(supporting baremitmdumpandmitmdump=<truthy>while rejecting0/no/false/empty values and unrelated substrings) and strip whitespace in_get_netns().MitmdumpThreadinMitmdump.start()when disabled.MitmdumpThread.run()andstop()via_state_lockandself.join(timeout=65)so concurrentstop()cannot skip firewall teardown or allowPopento launch afterstop().rooter()'sdictreturn contract ({"output": ..., "exception": ...}), roll backdisable_mitmdumpon enable timeout oros.makedirs/Popenfailure, wrap process stop intry/finallysodisable_mitmdumpalways runs even onOSError, and reap directself.procchildren without spinning 15s on zombies.tests/test_mitmdump.py:rooter()dict errors/timeouts,Popenrollback, concurrentrun()/stop(), direct child reaping, andos.killerror handling.Verification
ruff check modules/auxiliary/Mitmdump.py tests/test_mitmdump.pyruff format --check modules/auxiliary/Mitmdump.py tests/test_mitmdump.pytests/test_mitmdump.py: 28 passed.