Udp.Code. Add ip to white list - #877
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
dnsResolve() still fails for direct IP (and IP:port) inputs because it attempts DNS resolution instead of returning the validated IP immediately.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates Cleantalk\Common\Helper::dnsResolve() to accept and normalize more host input formats (string hostnames, URLs, and host:port), likely to support adding server IPs to whitelist/exclusion logic that relies on resolving HTTP_HOST.
Changes:
- Relaxed input validation from “must be a URL” to “must be a string”, with additional normalization steps.
- Added URL host extraction via
parse_url()when a scheme is present. - Added host:port stripping and broadened validation to accept either a hostname or an IP.
File summaries
| File | Description |
|---|---|
| lib/Cleantalk/Common/Helper.php | Expands dnsResolve() input normalization/validation to handle hostnames/URLs/ports and (intended) IP inputs. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (50.00%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## dev #877 +/- ##
============================================
+ Coverage 30.00% 30.03% +0.02%
- Complexity 6539 6546 +7
============================================
Files 289 289
Lines 26259 26268 +9
============================================
+ Hits 7880 7890 +10
+ Misses 18379 18378 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
https://app.doboard.com/1/task/42174