• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

j0k3r / httplug-ssrf-plugin / 45374878518

24 Nov 2026 10:26AM UTC coverage: 97.619% (-1.8%) from 99.422%
45374878518

Pull #53

github

web-flow
Merge d2a3be0a1 into dde93a5d1
Pull Request #53: Fix SSRF validation for domains with mixed IPv4 and IPv6 addresses

48 of 52 new or added lines in 3 files covered. (92.31%)

205 of 210 relevant lines covered (97.62%)

25.47 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.0
/src/NativeNameResolver.php
1
<?php
2

3
namespace Graby\HttpClient\Plugin\ServerSideRequestForgeryProtection;
4

5
final class NativeNameResolver implements NameResolver
6
{
7
    public function resolve(string $hostname): array
8
    {
9
        $records = @socket_addrinfo_lookup(trim($hostname, '[]'), null, [
18 ✔
10
            'ai_socktype' => \SOCK_STREAM,
18 ✔
11
        ]);
18 ✔
12

13
        if (false === $records) {
18 ✔
NEW
14
            return [];
×
15
        }
16

17
        $ips = [];
18 ✔
18
        foreach ($records as $record) {
18 ✔
19
            $address = socket_addrinfo_explain($record)['ai_addr'] ?? null;
18 ✔
20
            if (!\is_array($address)) {
18 ✔
NEW
21
                return [];
×
22
            }
23

24
            $ip = $address['sin_addr'] ?? $address['sin6_addr'] ?? null;
18 ✔
25
            if (!\is_string($ip)) {
18 ✔
NEW
26
                return [];
×
27
            }
28

29
            $ips[] = $ip;
18 ✔
30
        }
31

32
        return array_values(array_unique($ips));
18 ✔
33
    }
34
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc