Skip to content

Fix _minimize() race in forward_event stripping WEB_PARAMETER fields - #3163

Merged
liquidsec merged 1 commit into
devfrom
fix-minimize-race-in-forward-event
Jun 11, 2026
Merged

Fix _minimize() race in forward_event stripping WEB_PARAMETER fields#3163
liquidsec merged 1 commit into
devfrom
fix-minimize-race-in-forward-event

Conversation

@liquidsec

Copy link
Copy Markdown
Collaborator

Summary

forward_event() distributes events to modules via sequential await 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_consumers transiently hits 0 mid-loop, _minimize() strips fields like original_value, additional_params, and assigned_cookies from WEB_PARAMETER events before slower modules (like lightfuzz) are even queued. This caused KeyError: 'original_value' crashes in lightfuzz's metadata() for every COOKIE-type WEB_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 lightfuzz metadata() as a belt-and-suspenders guard.

Regression test: test_web_parameter_minimize_sentinel monkey-patches output modules to simulate instant processing, reorders modules so fast ones iterate before the slow one, then calls real forward_event() and asserts original_value survives. Confirmed: fails without fix, passes with fix. All 112 lightfuzz tests pass.

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
ausmaster self-requested a review June 11, 2026 14:33
@ausmaster ausmaster added this to the BBOT 3.0 - blazed_elijah milestone Jun 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Performance Benchmark Report

⚠️ No current benchmark data available

This might be because:

  • Benchmarks failed to run
  • No benchmark tests found
  • Dependencies missing

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91%. Comparing base (cc7b892) to head (c487305).
⚠️ Report is 2 commits behind head on dev.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@liquidsec
liquidsec merged commit 23b2563 into dev Jun 11, 2026
19 of 20 checks passed
@liquidsec
liquidsec deleted the fix-minimize-race-in-forward-event branch June 11, 2026 16:13
@liquidsec liquidsec mentioned this pull request Jul 7, 2026
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.

2 participants