fix(runner): use Print instead to listAvailableStoreTags#7145
Conversation
Tag listing (`-tgl`) output was moved to debug log level, making it invisible during normal runs. Restore tag output to default log level (Print) for better usability. Fixes #7142 Signed-off-by: Dwi Siswanto <git@dw1.io>
Neo - PR Security ReviewNo security issues found Highlights
Hardening Notes
Comment |
WalkthroughThe changes fix the tag listing functionality by separating tag and template listing logic paths. A new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
Uses metadata caching via catalog index to reduce runtime overhead. Add `(*Store).LoadTemplateTags` for efficient tag aggregation. Signed-off-by: Dwi Siswanto <git@dw1.io>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/runner/templates.go (1)
100-108: Consider usingSilent()for JSONL output to enable clean piping.Based on learnings,
Print()writes to stderr whileSilent()writes to stdout. For the JSONL output path (Line 103), usingSilent()would allow users to pipe the machine-readable output cleanly:nuclei -tgl --jsonl | jq '.tag'Currently, both JSONL and regular output go to stderr, which may complicate scripting use cases.
♻️ Suggested change for JSONL output
for _, tag := range tagsList { if r.options.JSONL { marshalled, _ := jsoniter.Marshal(tag) - r.Logger.Print().Msgf("%s", string(marshalled)) + r.Logger.Silent().Msgf("%s", string(marshalled)) } else { r.Logger.Print().Msgf("%s (%d)", tag.Key, tag.Value) } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/runner/templates.go` around lines 100 - 108, The loop that emits tags uses r.Logger.Print() for both output modes so JSONL output is written to stderr; when r.options.JSONL is true, switch the logger call to r.Logger.Silent() so the marshalled JSON (marshalled variable in the JSONL branch) is written to stdout for clean piping, while leaving the non-JSONL branch using r.Logger.Print() to keep human-readable output on stderr.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@internal/runner/templates.go`:
- Around line 100-108: The loop that emits tags uses r.Logger.Print() for both
output modes so JSONL output is written to stderr; when r.options.JSONL is true,
switch the logger call to r.Logger.Silent() so the marshalled JSON (marshalled
variable in the JSONL branch) is written to stdout for clean piping, while
leaving the non-JSONL branch using r.Logger.Print() to keep human-readable
output on stderr.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e21aeed1-d157-49f4-9fa3-b02c0ccb1d38
📒 Files selected for processing (3)
internal/runner/runner.gointernal/runner/templates.gopkg/catalog/loader/loader.go
Proposed changes
Tag listing (`-tgl`) output was moved to debug log
level, making it invisible during normal runs.
Restore tag output to default log level (Print)
for better usability.
Fixes #7142
Proof
before:
after:
And it's 2x++ faster (#7143).
Checklist
Summary by CodeRabbit