Registry Mirror
Skip to content

Conversation

@TBX3D

@TBX3D TBX3D commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

stacked on #384, so only the commits above it are this pr's.

the payloads field only took one anonymous list, so a fuzzing module could vary exactly one thing, and generation materialized the whole cross product before sending anything.

a mapping now declares ordered named sets injectable at {{name}}, a scalar names a local wordlist loaded through the existing loadWordlist, and a sequence still means the legacy single set. generation becomes a lazy iter.Seq consumed by a fixed worker pool over an unbuffered feed with one collector owning the findings slice, so the mutex and the product-sized results channel both go away. -fuzz-max-requests caps a module at 25000 requests per target by default.

@codecov-commenter

codecov-commenter commented Jul 31, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 91.25475% with 23 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@e9d578a). Learn more about missing BASE report.

Files with missing lines Patch % Lines
internal/modules/executor.go 92.48% 6 Missing and 4 partials ⚠️
sif.go 0.00% 5 Missing ⚠️
internal/modules/dsl.go 95.06% 2 Missing and 2 partials ⚠️
internal/modules/yaml.go 89.18% 2 Missing and 2 partials ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #386   +/-   ##
=======================================
  Coverage        ?   69.15%           
=======================================
  Files           ?       90           
  Lines           ?     9121           
  Branches        ?        0           
=======================================
  Hits            ?     6308           
  Misses          ?     2400           
  Partials        ?      413           

☔ 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.

@github-actions github-actions Bot added size/xl 500+ lines changed modules changes to scan modules docs documentation changes tests test changes config configuration changes deps dependency updates labels Jul 31, 2026
@github-actions

github-actions Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

pr summary

16 files changed (+1158 -89)

category files
go source 13
tests 6
deps 1

vmfunc commented Aug 22, 2026

Copy link
Copy Markdown
Owner

the streaming rewrite is the right move - dropping the product-sized channel especially. it sits on #384 and collides with the ssl branch on the same executor refactor. once #384 lands, rebase and i'll take this + #387 as a pair.


Generated by Claude Code

TBX3D added 13 commits August 22, 2026 11:54
add the dsl matcher type with a curated helper allowlist and load-time
compile validation (bad syntax, non-allowlisted functions, empty or
over-length expressions all rejected before scan time). evaluation
lands in a follow-up; a loaded dsl matcher currently misses at match
time.
drives a live httptest server through ExecuteHTTPModule with a dsl
matcher bound to status_code and body, mirroring the existing favicon
integration test, and asserts exactly one finding.
parse the request url and expose host[:port] so a nuclei-style
host == "..." expression matches; dedupe the header serialization.
covers the bound variables, the helper allowlist and the load-time compile, so a
module author does not have to read dsl.go to know what an expression can touch.
overload the payloads field with a custom unmarshaler: a yaml sequence is the
legacy single set named "payload", a mapping is ordered named sets injectable
at {{name}}. generation moves to a lazy iter.Seq that never materializes the
product, and substitution now reaches header values. file-backed sets parse but
are rejected until the loader lands.
a named set whose yaml value is a scalar string is a local wordlist path,
loaded via the existing loadWordlist at resolve time. resolveSets is the single
point set resolution can fail.
per fuzzing-module-per-target request cap, default 25000, 0 = unlimited.
threaded into modules.Options; enforced by the executor in a follow-up.
ExecuteHTTPModule consumes streamRequests directly instead of materializing
the full product and sizing the results channel to it. a fixed worker pool
pulls from an unbuffered feed, a single collector owns the findings slice
(dropping the mutex), and the producer enforces -fuzz-max-requests with a
one-shot truncation log.
the existing cancel test only ever passes an already-cancelled context, so
the producer returns at its up-front ctx.Err() check and never reaches the
send-select guarding reqCh. add a regression test that cancels while a
large payload set is mid-flight against a blocking server, so the
producer's and workers' send-selects both get exercised, and assert
ExecuteHTTPModule still returns promptly with no goroutine leak.
substitute header values on the no-payload path too, matching the payload and
chain paths; warn when a resolved payload set is empty so a misconfigured
wordlist is not mistaken for a clean no-findings run. harden the mid-stream
cancel test to poll for goroutine drain instead of a fixed sleep.
the payloads field grew two shapes (named sets, file-backed sets) and a scan-wide
cap; none of that was discoverable without reading yaml.go.
the yaml shape rejections and the clusterbomb empty-set short-circuit were
unexercised; removing either left the suite green.
Copilot AI lite review requested due to automatic review settings August 22, 2026 20:05
@TBX3D
TBX3D force-pushed the lane/fuzz-payload-sets branch from 8c43e96 to 43ba2b2 Compare August 22, 2026 20:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

There are a few correctness/performance/documentation issues in the changed code (notably payload set name validation and per-request header allocations) that should be addressed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR enhances the HTTP modules system by expanding fuzzing payload support beyond a single anonymous list and by switching request generation/execution to a streaming model to avoid materializing large cross-products in memory. It also adds a DSL-based matcher (nuclei-style) with helper allowlisting and load-time compilation/validation, plus a per-module per-target request budget flag.

Changes:

  • Add ordered, named payload sets (mapping form) with support for file-backed sets, while preserving legacy sequence payload behavior.
  • Stream fuzz request generation via iter.Seq into a fixed worker pool, with -fuzz-max-requests to cap per-module request volume.
  • Add dsl matcher type with load-time compilation/validation, curated helper allowlist, and tests/docs.
File summaries
File Description
sif.go Plumbs FuzzMaxRequests from app settings into module execution options.
internal/config/config.go Adds -fuzz-max-requests flag and persists setting.
internal/modules/yaml.go Changes payloads schema to PayloadSets with custom YAML unmarshalling + validation.
internal/modules/module.go Extends module Options and adds Matcher.DSL field.
internal/modules/executor.go Implements streaming request generation, request budget enforcement, and DSL matcher evaluation hook.
internal/modules/dsl.go Adds DSL compilation cache, helper allowlist, variable binding, and evaluation logic.
internal/modules/favicon.go Validates DSL matchers at load time alongside existing matcher validation.
internal/modules/matchers_test.go Updates HTTP request generation tests for legacy payload compatibility and adds DSL parse test.
internal/modules/executor_test.go Adds end-to-end DSL matcher execution test and updates payload expansion tests.
internal/modules/attack_modes_test.go Updates attack mode tests to use legacy payload wrapper.
internal/modules/favicon_test.go Adds DSL validation test cases.
internal/modules/dsl_test.go Adds focused unit tests for DSL compile/eval semantics and variable binding.
internal/modules/fuzz_test.go Adds payload-set parsing/ordering/file-resolution tests and executor streaming/budget/cancel regression tests.
go.mod Promotes projectdiscovery/dsl and projectdiscovery/govaluate to direct deps.
docs/usage.md Documents -fuzz-max-requests usage.
docs/modules.md Documents named payload sets and the new DSL matcher.
Review details
  • Files reviewed: 16/16 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/modules/yaml.go
Comment on lines +133 to +136
switch s.Name {
case "BaseURL", "baseurl":
return fmt.Errorf("payloads: set name %q collides with the base-url builtin", s.Name)
}
Comment on lines +54 to +56
// both keys are inline here (not file-backed): a file-backed entry is
// rejected by validate() in this task (see TestPayloadSetsValidation), so
// mixing one in would make this parse fail rather than exercise ordering.
Comment on lines +415 to 421
headers := cfg.Headers
if len(cfg.Headers) > 0 {
headers = make(map[string]string, len(cfg.Headers))
for k, v := range cfg.Headers {
headers[k] = sub(v)
}
}

@vmfunc vmfunc left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Really like the streaming rewrite, dropping the product-sized channel is a big win. A few things for the rebase onto #384:

  1. This branch carries an older copy of #384 (no headersOf nil-safety, missing two dsl tests), so please rebase on main once #384 is merged.
  2. PayloadSets.validate (yaml.go:134): please also reject an empty set name and Payload (it can't be referenced, since {{Payload}} is the legacy builtin).
  3. The scalar branch (yaml.go:110) accepts any scalar as a file path. Restricting it to a non-empty !!str would make user: 123 / user: "" fail at parse time.
  4. newFuzzRequest copies headers per request even when no header has a {{…}}. Could it copy only when substitution applies, as the comment says?
  5. Minor: the stale fuzz_test.go comment about file-backed sets being rejected, and a note in the PR description that cancelled runs now return a nil error.
  • Software Builder, lamb's AI assistant

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review of the payload-set / streaming part of this PR (commits 4f55124..43ba2b2). The producer → fixed worker pool → single collector design looks right: no goroutine leaks on cancel, the budget warning only fires when a (budget+1)th combination actually exists, and the cancellation test is a good addition. CI is green on the current head.

Not mergeable yet:

  • Stale base. This branch still has an older copy of #384 (610d371, 17c1703, 6f3b2a4, c042230, 2e16c1e). It's missing #384's later 28fc3b3 ("tolerate a matcher with no response"). The only textual conflict with main is go.mod, inside 610d371: main bumped goflags, utils, retryabledns, fastdialer and others, while #384 promotes projectdiscovery/dsl and govaluate to direct deps. I checked locally that the 8 commits that belong to this PR rebase onto current main with no conflicts. So once #384 lands:
    git fetch upstream
    git rebase --onto upstream/main 2e16c1e lane/fuzz-payload-sets   # drops the stale #384 copy
    go mod tidy && go build ./... && go test ./...                    # main now builds with go 1.26
    git push --force-with-lease
    If you rebase before #384 merges, take main's go.mod/go.sum and run go mod tidy to resolve the conflict. I didn't push a rebase here because that would publish the stale #384 copy, which goes against the merge order @vmfunc asked for.
  • @vmfunc's 2026-10-08 points are still open on this head: reject "" and Payload as set names, restrict the scalar branch to a non-empty !!str, copy headers only when a {{…}} is present, fix the stale fuzz_test.go:54-56 comment, and note in the description that cancelled runs now return nil instead of ctx.Err().

New findings (inline):

  1. substituteVariablesWithVars ranges over a map and calls ReplaceAll once per name. If one set's value contains another set's {{name}}, the request you get depends on map iteration order. Also, because payload is now in vars too, a legacy value that literally contains {{payload}} gets substituted twice, which the old newPayloadRequest didn't do. A single-pass strings.NewReplacer fixes both and should allocate less per request.
  2. Set names aren't restricted to a safe character set. Keys like a b, x}} or a non-scalar key are accepted, and you can't reference them cleanly. Validating against an identifier pattern would also cover the empty-name case.
  3. -fuzz-max-requests also caps plain paths/wordlist modules that have no payload sets. A converted dirlist module with a >25k-line wordlist now gets silently cut off by default. Either scope the budget to modules with sets, or say clearly in the docs that it applies to every non-chain HTTP module.
  4. Small: resolveSets re-reads file-backed sets once per target, and generateHTTPRequests is now only used by tests.

Merge check: not merged. There's no human approval on the latest commit, the PR conflicts with main, and it depends on #384.

Written by Devin

// substitution could apply, preserving the shared cfg.Headers map otherwise.
func newFuzzRequest(method, target, path string, vars map[string]string, cfg *HTTPConfig) *httpRequest {
pv := vars["payload"] // drives {{payload}}/{{Payload}}; "" when no such set
sub := func(s string) string { return substituteVariablesWithVars(s, target, pv, vars) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

substituteVariablesWithVars ranges over vars, which is a map, and runs one ReplaceAll per name. That makes multi-set substitution order-dependent. Example: template /{{a}}/{{b}} with a = {{b}} comes out as either /B/B or /{{b}}/B, depending on iteration order. Separately, substituteVariables already replaced {{payload}}, and then the loop replaces it again because payload is also a key in vars. So a legacy payload value that literally contains {{payload}} now gets expanded twice; the old newPayloadRequest didn't do that.

Suggestion: build one strings.NewReplacer per combination with {{BaseURL}}, {{baseurl}}, {{payload}}, {{Payload}} and every {{name}} (it's single-pass and never rescans replaced text), and use it for the URL, body and headers. That also lets you skip copying headers when none of them contains {{.

Comment thread internal/modules/yaml.go
case yaml.MappingNode:
sets := make([]PayloadSet, 0, len(value.Content)/2)
for i := 0; i+1 < len(value.Content); i += 2 {
name := value.Content[i].Value

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

On top of rejecting "" and Payload: the key node's Kind/Tag isn't checked, so a non-scalar key (? [a]: [...]) quietly becomes name "". Names like a b or x}} are also accepted even though you can't use them cleanly as {{name}}. I'd check value.Content[i].Kind == yaml.ScalarNode and validate the name against an identifier pattern such as ^[A-Za-z_][A-Za-z0-9_]*$ in validate(). That covers the empty-name case too, and the error shows up at load time.

go func() {
defer close(reqCh)
var sent int
budget := opts.FuzzMaxRequests

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

opts.FuzzMaxRequests also applies when len(sets) == 0, i.e. plain paths + wordlist modules. With the 25000 default, a dirlist-style module with a large wordlist now gets truncated silently, apart from one warning line. The docs call this a "fuzzing module" budget aimed at combinatorial blowups. Please either apply it only when payload sets exist, or document that it caps every non-chain HTTP module, and add a test for whichever you choose.

out[i] = s
continue
}
vals, err := loadWordlist(s.File)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Minor: ExecuteHTTPModule runs once per target, so a file-backed set gets re-read from disk for every target. Not a problem for small lists, but resolving once at load time, or caching by path, would avoid repeated I/O on big scans. Also, the relative path is resolved against the process CWD rather than the module file's directory. That matches wordlist:, but it would help to say so in docs/modules.md.

@devin-ai-integration

Copy link
Copy Markdown

Conflict update against current main (6cb9451, 26 commits past this branch's base e9d578a). I couldn't push to TBX3D/sif (403), so here's how to resolve it yourself.

There's still only one textual conflict: go.mod, inside 610d371. The new main commits (#421–#426: go 1.26, modules lint/test, the scan event sink, TUI) don't touch executor.go, dsl.go or fuzz_test.go. The new internal/modules/lint.go and moduletest.go only build Options{Timeout: ...} and never read HTTPConfig.Payloads, so the PayloadSets type change and the new FuzzMaxRequests field don't break them.

Resolving go.mod: take main's side of every hunk (goflags v0.2.0, go-isatty v0.0.22, fastdialer v0.5.20, and the rest). Then move these two lines from the indirect block to the direct block:

github.com/projectdiscovery/dsl v0.8.20
github.com/projectdiscovery/govaluate v0.0.0-20260615100919-5ee2581bbf7e

go.sum on main already has both, so it doesn't need to change.

Suggested rebase, keeping the #384 stack: it also picks up #384's 28fc3b3 (headersOf nil-safety), which this branch is missing. I tried this locally: the 8 commits that belong to this PR cherry-pick onto rebased #384 with no further conflicts, and getPart ends up using headersOf.

git fetch upstream main pull/384/head:dsl-384
git checkout -b tmp dsl-384 && git rebase upstream/main   # fix go.mod as above, then: git add go.mod && git rebase --continue
git cherry-pick 2e16c1e..lane/fuzz-payload-sets           # 4f55124..43ba2b2, applies cleanly
go mod tidy && go build ./... && go test ./...
git branch -f lane/fuzz-payload-sets tmp && git push --force-with-lease origin lane/fuzz-payload-sets

If #384 merges first, use git rebase --onto upstream/main 2e16c1e lane/fuzz-payload-sets from the earlier review.

The resulting tree only differs from main in go.mod by the dsl/govaluate promotion above. I couldn't run go build/go test here because no Go toolchain was available in this environment, so please let CI (lint, build (1.26), build-and-test) confirm it. The open review points from @vmfunc (2026-10-08) and the 2026-11-04 Devin review still apply.

Written by Devin

@devin-ai-integration

Copy link
Copy Markdown

Small update to my previous conflict notes: main is now at 5ed3a4c. Pushing to TBX3D/sif still returns 403 for me.

The steps are the same, and go.mod in 610d371 is still the only conflict. One thing in them is out of date: main now has goflags v0.2.1, not v0.2.0, after #433. Since #427/#428/#430/#434, main also has murmur3 v1.2.2 and x/time v0.16.0, but those merge without conflict.

After the resolution, the direct block should read:

	github.com/mattn/go-isatty v0.0.22
	github.com/projectdiscovery/dsl v0.8.20
	github.com/projectdiscovery/goflags v0.2.1
	github.com/projectdiscovery/govaluate v0.0.0-20260615100919-5ee2581bbf7e

In the indirect block, keep fastdialer v0.5.20 // indirect and drop the dsl and govaluate // indirect lines. go.sum doesn't change.

I ran the steps from the previous note locally: rebased #384 onto 5ed3a4c, then cherry-picked 2e16c1e..lane/fuzz-payload-sets. Every commit after the go.mod fix applied cleanly. Compared with main, the result's go.mod only promotes dsl and govaluate.

I couldn't run go build ./... or go test ./... here because this sandbox can't download the Go toolchain. Please run both before you force-push.

Written by Devin

@devin-ai-integration

Copy link
Copy Markdown

@TBX3D this branch conflicts with main (5ed3a4c), and I can't push to your fork, so here are rebase steps. I rebased all 13 commits locally. go.mod is the only conflict, and it only shows up while replaying the first commit (610d371 feat(modules): validate and compile dsl matchers at load). The other 12 commits apply cleanly.

git fetch upstream            # upstream = github.com/vmfunc/sif
git checkout lane/fuzz-payload-sets
git rebase upstream/main      # stops on 610d371 with go.mod conflicted

Resolve go.mod like this: keep main's versions and add your two new direct deps.

  • Direct require block:
    	github.com/mattn/go-isatty v0.0.22
    	github.com/projectdiscovery/dsl v0.8.20
    	github.com/projectdiscovery/goflags v0.2.1
    	github.com/projectdiscovery/govaluate v0.0.0-20260615100919-5ee2581bbf7e
    
    (goflags becomes main's v0.2.1, not v0.1.76.)
  • Indirect block: drop the github.com/projectdiscovery/dsl ... // indirect line, because it is direct now. Keep main's github.com/projectdiscovery/fastdialer v0.5.20 // indirect, not v0.5.11. Your commit already removed the govaluate // indirect line cleanly.
git add go.mod && git rebase --continue
go mod tidy && go build ./... && go test ./...
git push --force-with-lease origin lane/fuzz-payload-sets

Notes:

Written by Devin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config configuration changes deps dependency updates docs documentation changes modules changes to scan modules size/xl 500+ lines changed tests test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants