Skip to content

Udp.Code. Add ip to white list - #877

Open
alexander-b-clean wants to merge 2 commits into
devfrom
ip-to-white-list.ab
Open

Udp.Code. Add ip to white list#877
alexander-b-clean wants to merge 2 commits into
devfrom
ip-to-white-list.ab

Conversation

@alexander-b-clean

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Comment thread lib/Cleantalk/Common/Helper.php
Comment thread lib/Cleantalk/Common/Helper.php Outdated
@codecov

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 30.03%. Comparing base (f2102e1) to head (047d6a0).

Files with missing lines Patch % Lines
lib/Cleantalk/Common/Helper.php 50.00% 5 Missing ⚠️

❌ 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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants