-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Reporting validation #6456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reporting validation #6456
Changes from all commits
6b635be
1425fdd
c7e149d
0b6ea85
01854c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -288,6 +288,10 @@ func (c *ReportingClient) CreateIssue(event *output.ResultEvent) error { | |
| return nil | ||
| } | ||
|
|
||
| if c.options.ValidatorCallback != nil && !c.options.ValidatorCallback(event) { | ||
| return nil | ||
| } | ||
|
|
||
|
Comment on lines
+291
to
+294
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainHarden validator callback against panics and add trace on rejection A faulty user callback can crash reporting. Wrap it with recover and optionally emit a debug when it rejects. Apply: - if c.options.ValidatorCallback != nil && !c.options.ValidatorCallback(event) {
- return nil
- }
+ if v := c.options.ValidatorCallback; v != nil {
+ valid := false
+ func() {
+ defer func() {
+ if r := recover(); r != nil {
+ gologger.Warning().Msgf("reporting: validator panicked: %v", r)
+ valid = false
+ }
+ }()
+ valid = v(event)
+ }()
+ if !valid {
+ // rejected by validator; skip reporting
+ // gologger.Debug().Msg("reporting: event rejected by ValidatorCallback")
+ return nil
+ }
+ }Also, double-check that skipping dedupe on validator rejection is intentional (events will be re-evaluated every run). 🏁 Script executed: #!/bin/bash
file="pkg/reporting/reporting.go"
if [ ! -f "$file" ]; then
echo "$file not found"
exit 1
fi
echo "=== Imports ==="
sed -n '1,80p' "$file"
echo "=== Validator snippet context ==="
sed -n '260,330p' "$file"
echo "=== Searching for dedupe in pkg/reporting ==="
grep -R -n "dedupe" pkg/reportingLength of output: 5797 Harden validator callback against panics and add trace on rejection 🤖 Prompt for AI Agents |
||
| var err error | ||
| unique := true | ||
| if c.dedupe != nil { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
httpx pseudo-version bump — verify build/tidy and compatibility
Looks fine, but please run mod hygiene and confirm no breakages in dependents.
Suggested checks:
🏁 Script executed:
Length of output: 20309
The directory listing will confirm whether
regexes.jsonis missing inpkg/output/stats/waf. If it’s absent, add the file or adjust the//go:embedpattern accordingly before merging.🤖 Prompt for AI Agents