fix: prevent nil panic for unsafe HEAD requests#2455
fix: prevent nil panic for unsafe HEAD requests#2455tal7aouy wants to merge 1 commit intoprojectdiscovery:devfrom
Conversation
Neo - PR Security ReviewNo security issues found Highlights
Comment |
|
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 (1)
WalkthroughThe change refactors error handling logic in the unsafe HEAD request path by replacing a switch case guard with a direct if condition that explicitly checks for non-nil errors while excluding i/o timeout errors. This prevents potential nil pointer dereference when the error is nil. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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 Tip CodeRabbit can scan for known vulnerabilities in your dependencies using OSV Scanner.OSV Scanner will automatically detect and report security vulnerabilities in your project's dependencies. No additional configuration is required. |
Description:
httpxwith--unsafeand sending aHEADrequest,Do()could panic due to dereferencingerrwhen it wasnil(err.Error()was called even on success).err.Error()call by requiringerr != nilbefore accessing it.go test tools.(all tests pass).Summary by CodeRabbit