Fix _minimize() race in forward_event stripping WEB_PARAMETER fields - #3163
Merged
Conversation
forward_event() distributes events to modules via sequential awaits. Between iterations, a fast module can process the event and call _minimize(), dropping _module_consumers to 0 and stripping fields like original_value before slower modules are even queued. Add a sentinel (+1 before the loop, _minimize() after) so the counter never transiently hits 0 during distribution. Also use defensive .get() in lightfuzz metadata() as a belt-and-suspenders guard.
ausmaster
approved these changes
Jun 11, 2026
Contributor
🚀 Performance Benchmark Report
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #3163 +/- ##
=====================================
+ Coverage 91% 91% +1%
=====================================
Files 448 448
Lines 42631 42654 +23
=====================================
+ Hits 38380 38403 +23
Misses 4251 4251 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merged
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
forward_event()distributes events to modules via sequentialawait module.queue_event(event)calls. Between iterations, the event loop can schedule a fast module's worker, which processes the event and calls_minimize(). If_module_consumerstransiently hits 0 mid-loop,_minimize()strips fields likeoriginal_value,additional_params, andassigned_cookiesfromWEB_PARAMETERevents before slower modules (like lightfuzz) are even queued. This causedKeyError: 'original_value'crashes in lightfuzz'smetadata()for every COOKIE-typeWEB_PARAMETER.Fix: Add a sentinel hold on
_module_consumers(+1 before the distribution loop,_minimize()after) so the counter never transiently reaches 0 during distribution. Also use defensive.get()in lightfuzzmetadata()as a belt-and-suspenders guard.Regression test:
test_web_parameter_minimize_sentinelmonkey-patches output modules to simulate instant processing, reorders modules so fast ones iterate before the slow one, then calls realforward_event()and assertsoriginal_valuesurvives. Confirmed: fails without fix, passes with fix. All 112 lightfuzz tests pass.