Skip to content

fix(http): reject request-condition(s) in fuzzing - #7466

Merged
Mzack9999 merged 1 commit into
devfrom
dwisiswant0/fix/http/reject-request-conditions-in-fuzzing
Jun 23, 2026
Merged

fix(http): reject request-condition(s) in fuzzing#7466
Mzack9999 merged 1 commit into
devfrom
dwisiswant0/fix/http/reject-request-conditions-in-fuzzing

Conversation

@dwisiswant0

@dwisiswant0 dwisiswant0 commented Jun 16, 2026

Copy link
Copy Markdown
Member

Proposed changes

HTTP fuzzing does not maintain the ordered request
history used by request-condition fields. Reject
fuzzing templates that reference those fields at
validation time instead of letting them eval with
an invalid request count.

Fixes #4891

Proof

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Summary by CodeRabbit

  • Bug Fixes
    • Added HTTP request validation to prevent enabling fuzzing alongside request-condition matchers, ensuring conflicting configurations are rejected with clear error messaging.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 841aa053-5681-47fe-a618-95cc52adb95e

📥 Commits

Reviewing files that changed from the base of the PR and between b39356c and 037abd8.

📒 Files selected for processing (2)
  • pkg/protocols/http/validate.go
  • pkg/protocols/http/validate_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/protocols/http/validate_test.go
  • pkg/protocols/http/validate.go

Walkthrough

(*Request).validate() gains a new guard that returns an error when both Fuzzing and NeedsRequestCondition() are true. A new test function, TestValidateFuzzingWithRequestCondition, covers this with two subtests using DSL matchers and Part extractors respectively.

Changes

Fuzzing + request-condition mutual exclusion

Layer / File(s) Summary
Validation guard and tests
pkg/protocols/http/validate.go, pkg/protocols/http/validate_test.go
validate() adds a branch that rejects Fuzzing combined with NeedsRequestCondition(). Test imports are extended with fuzz, operators, extractors, and matchers packages; TestValidateFuzzingWithRequestCondition adds two subtests that assert the error message matches the exclusivity rule for both matcher-DSL and extractor-Part configurations.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~4 minutes

Poem

🐇 Hop hop, a tiny guard appears,
No fuzzing with conditions, it cheers!
Four lines of code, a simple stand,
Request context safely planned.
The rabbit stamps the diff — all clear! ✅

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(http): reject request-condition(s) in fuzzing' accurately describes the main change—validation now rejects fuzzing configurations that include request-condition logic.
Linked Issues check ✅ Passed The PR implements the first proposed solution from issue #4891: rejecting fuzzing templates at validation time if they reference request-condition fields, preventing incorrect evaluation.
Out of Scope Changes check ✅ Passed All changes are directly scoped to addressing issue #4891: validation logic to reject fuzzing with request-conditions and corresponding test coverage.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dwisiswant0/fix/http/reject-request-conditions-in-fuzzing

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/protocols/http/validate_test.go`:
- Around line 72-73: The test assertions in the subtests are expecting an error
message that does not match what the validate() function actually returns.
Update the require.Contains assertions to expect the actual error message string
that validate() produces when rejecting fuzzing with request-condition matchers
or extractors. This fix applies at both the first location (around line 72-73)
and the second affected location (around line 86-87) where the same validation
error is tested.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 786ecd12-681d-4105-950f-6ac23f06ca9f

📥 Commits

Reviewing files that changed from the base of the PR and between 63124ef and b39356c.

📒 Files selected for processing (2)
  • pkg/protocols/http/validate.go
  • pkg/protocols/http/validate_test.go

Comment thread pkg/protocols/http/validate_test.go Outdated
@Mzack9999
Mzack9999 self-requested a review June 16, 2026 20:41
HTTP fuzzing does not maintain the ordered request
history used by request-condition fields. Reject
fuzzing templates that reference those fields at
validation time instead of letting them eval with
an invalid request count.

Fixes #4891

Signed-off-by: Dwi Siswanto <git@dw1.io>
@dwisiswant0
dwisiswant0 force-pushed the dwisiswant0/fix/http/reject-request-conditions-in-fuzzing branch from b39356c to 037abd8 Compare June 17, 2026 05:12
@daviediao-code

Copy link
Copy Markdown

Reviewed this PR.

Assessment: Implementation looks solid and follows project conventions. Clean code quality.

Approved ✅

@Mzack9999
Mzack9999 merged commit 14b89f8 into dev Jun 23, 2026
29 of 30 checks passed
@Mzack9999
Mzack9999 deleted the dwisiswant0/fix/http/reject-request-conditions-in-fuzzing branch June 23, 2026 21:57
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.

Fuzzing loses context of request condition

3 participants