fix(loader): compile requests during validation - #7616
Conversation
Do not let parsed template cache hits bypass protocol compilation, making `-validate` reject templates with runtime compilation errors. Fixes #7602 Signed-off-by: Dwi Siswanto <git@dw1.io>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughTemplate validation now parses each template directly instead of reusing cached parsed templates, allowing runtime compilation errors to fail validation. A regression test covers an invalid regex extractor group. ChangesRuntime validation
Estimated code review effort: 3 (Moderate) | ~15–30 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
Verified #7616 fixes #7602 — built it and ran the original repro: $ nuclei -t /tmp/bad.yaml -validate
[ERR] Error occurred parsing template /tmp/bad.yaml: could not compile request:
could not compile operators: could not compile extractor:
regex extractor group must be >= 0, got -1
[FTL] Could not validate templates: errors occurred during template validationBefore, that same file returned Your approach is better than mine. #7603 pointed validation at the compiled cache; #7616 removes the cache lookup entirely so Thanks for picking it up. Nothing outstanding from me on this one. |
Proposed changes
Do not let parsed template cache hits bypass
protocol compilation, making
-validaterejecttemplates with runtime compilation errors.
Fixes #7602
Proof
Checklist
Summary by CodeRabbit
Bug Fixes
Tests