Conversation
Neo - PR Security ReviewNo security issues found Highlights
Comment |
WalkthroughAdded query time tracking to DNS operations. The runner now measures elapsed duration for each DNS query and stores the result in the response data structure with JSON and CSV serialization support. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@internal/runner/runner.go`:
- Around line 628-630: The DNS query timing (dnsData.QueryTime) is being
assigned after calling r.dnsx.QueryMultiple(domain) but wildcard-mode storage
only serializes retryabledns.DNSData, so the QueryTime string is never
persisted; update the representation that gets stored/loaded (the
retryabledns.DNSData type or the code paths that serialize it) to include
QueryTime and ensure you set that field immediately after QueryMultiple returns
(locations around the dnsData assignment in runner.go and the other noted spots:
~533-547, ~628-630, ~737-742, ~922-944). Concretely, modify the
retryabledns.DNSData struct to have a QueryTime field (string or duration) or
wrap the stored payload so QueryTime is included, and set that field right after
dnsx.QueryMultiple(domain) before any save/serialize operations so wildcard runs
emit the timing in JSON.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8f98c090-f672-4620-8da7-5714d5430c90
📒 Files selected for processing (2)
internal/runner/runner.golibs/dnsx/dnsx.go
| queryStart := time.Now() | ||
| dnsData.DNSData, _ = r.dnsx.QueryMultiple(domain) | ||
| dnsData.QueryTime = time.Since(queryStart).Round(time.Millisecond).String() |
There was a problem hiding this comment.
Query time is dropped in wildcard-filtering output path.
dnsData.QueryTime is set at Line 630, but wildcard mode stores/loads only retryabledns.DNSData, so JSON emitted later cannot include the new field. This makes query-time output incomplete for wildcard runs.
💡 Suggested patch direction
+type storedDNSData struct {
+ DNSData *retryabledns.DNSData `json:"dns_data"`
+ QueryTime string `json:"query-time,omitempty"`
+}
- if err := r.storeDNSData(dnsData.DNSData); err != nil {
+ if err := r.storeDNSData(&dnsData); err != nil {
gologger.Debug().Msgf("Failed to store DNS data for %s: %v\n", domain, err)
}
-func (r *Runner) storeDNSData(dnsdata *retryabledns.DNSData) error {
- dnsdata.RawResp = nil
- data, err := dnsdata.JSON()
+func (r *Runner) storeDNSData(resp *dnsx.ResponseData) error {
+ resp.RawResp = nil
+ data, err := json.Marshal(storedDNSData{
+ DNSData: resp.DNSData,
+ QueryTime: resp.QueryTime,
+ })
if err != nil {
return err
}
- return r.hm.Set(dnsdata.Host, []byte(data))
+ return r.hm.Set(resp.Host, data)
}
-func (r *Runner) loadStoredDNSData(host string) (*retryabledns.DNSData, error) {
+func (r *Runner) loadStoredDNSData(host string) (*storedDNSData, error) {
data, ok := r.hm.Get(host)
if !ok {
return nil, errors.New("dns data not found")
}
-
- var dnsdata retryabledns.DNSData
- if err := json.Unmarshal(data, &dnsdata); err != nil {
+ var stored storedDNSData
+ if err := json.Unmarshal(data, &stored); err != nil {
return nil, err
}
-
- return &dnsdata, nil
+ return &stored, nil
}Also applies to: 737-742, 533-547, 922-944
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@internal/runner/runner.go` around lines 628 - 630, The DNS query timing
(dnsData.QueryTime) is being assigned after calling r.dnsx.QueryMultiple(domain)
but wildcard-mode storage only serializes retryabledns.DNSData, so the QueryTime
string is never persisted; update the representation that gets stored/loaded
(the retryabledns.DNSData type or the code paths that serialize it) to include
QueryTime and ensure you set that field immediately after QueryMultiple returns
(locations around the dnsData assignment in runner.go and the other noted spots:
~533-547, ~628-630, ~737-742, ~922-944). Concretely, modify the
retryabledns.DNSData struct to have a QueryTime field (string or duration) or
wrap the stored payload so QueryTime is included, and set that field right after
dnsx.QueryMultiple(domain) before any save/serialize operations so wildcard runs
emit the timing in JSON.
Closes #870
Summary by CodeRabbit