Repository navigation
Expose nuclei's newer template-selection options - #3479
Merged
Merged
Conversation
Add nine passthrough options that compose alongside `mode` rather than adding new `mode` values: profile, template_condition, new_templates, new_templates_versions, exclude_severity, protocol_types, include_tags, template_ids, exclude_ids. Validate severity, exclude_severity and protocol_types against nuclei's enums at preset-validation time, with a test that pins those lists against what the binary advertises. Fix two budget mode selection bugs that let templates run request blocks outside the budget, and cache the template parse on the installed templates version instead of repeating it every scan. Add nuclei-recommended and nuclei-new presets.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #3479 +/- ##
======================================
- Coverage 91% 91% -0%
======================================
Files 465 465
Lines 50015 50134 +119
======================================
+ Hits 45142 45244 +102
- Misses 4873 4890 +17 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
📊 Performance Benchmark Report
📈 Detailed Results (All Benchmarks)
🎯 Performance Summary+ 2 improvements 🚀
29 unchanged ✅🔍 Significant Changes (>10%)
🐍 Python Version 3.11.17 |
liquidsec
marked this pull request as ready for review
October 15, 2026 19:18
liquidsec
added a commit
that referenced
this pull request
Oct 17, 2026
en0f
previously approved these changes
Oct 20, 2026
# Conflicts: # docs/scanning/presets_list.md
en0f
approved these changes
Oct 21, 2026
en0f
approved these changes
Oct 21, 2026
This was referenced Oct 26, 2026
Draft
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.
Closes #3478.
The nuclei module was written in 2022, when
-severitywas essentially the only way to narrow the template set. This exposes what ProjectDiscovery has added since, and fixes budget mode.Template selection
Nine passthrough options that sit alongside
moderather than adding newmodevalues, so they compose. nuclei intersects its filters, soprofile: recommendedplusseverity: criticalgives you the templates satisfying both.profile-tpexclude_severity-estemplate_condition-tcprotocol_types-ptnew_templates-ntinclude_tags-itagsnew_templates_versions-ntvtemplate_ids-idexclude_ids-eid-tcopens the most up: it filters on template metadata that didn't exist when this module was written, includingepss_score,cvss_score,max_request,cve_id,vendorandproduct.Two presets:
nuclei-recommended(ProjectDiscovery's curated profile, which carries a maintained list of known-FP template ids that updates with the template tree) andnuclei-new(latest templates release only).Validation
severity,exclude_severityandprotocol_typesare validated against nuclei's enums at preset-validation time instead of failing partway into a scan.severitywasn't validated at all before.Those lists are hardcoded, since module
Configbodies are exec'd without module globals.TestNucleiEnumDriftparsesnuclei -hand asserts every value the binary advertises still passes validation, so a version bump that changes them fails here rather than in the field.profileaccepts a built-in profile id or a path to a profile file.template_conditiongets a pre-flight match count, because nuclei treats an unrecognized field name as a non-match rather than an error, so a typo would otherwise select nothing and report success.Budget mode
Nothing in nuclei replaces budget mode.
metadata.max-requestcaps requests per template; budget mode caps them per host, by selecting templates whose paths all come from the N most common paths in the tree so nuclei's clustering merges them.Two selection bugs:
validwas initialized once per template, but the path loop runs per request block and never reset it.This is a user-visible change.
budget: 10, which is whatnuclei-budget.ymlships, goes from 1,581 templates / 134 requests per host to 1,477 / 15. Roughly the same coverage for a tenth of the traffic, andbudget: Nnow actually means N.Separately, the
yaml.safe_loadsweep over all 13,510 templates was 35.2s, blocking, on the event loop, and reran every scan. It's now cached as JSON keyed on the installed templates version, and runs inrun_in_executor_mpon a miss. 34.7s to 0.01s warm.Note
docs/scanning/advanced.mdis deliberately untouched. The docs generator rewrites its argparse block differently depending on local Python version, and that churn isn't part of this change.