Merge pull request #43650 from Commifreak/log_host_ip_for_access_violation

This commit is contained in:
John Molakvoæ 2024-02-24 12:43:01 +01:00 committed by GitHub
commit e79d42604d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 5 deletions

View file

@ -192,7 +192,7 @@ class Client implements IClient {
throw new LocalServerException('Could not detect any host');
}
if (!$this->remoteHostValidator->isValid($host)) {
throw new LocalServerException('Host violates local access rules');
throw new LocalServerException('Host "'.$host.'" violates local access rules');
}
}

View file

@ -147,7 +147,7 @@ class DnsPinMiddleware {
foreach ($targetIps as $ip) {
if ($this->ipAddressClassifier->isLocalAddress($ip)) {
// TODO: continue with all non-local IPs?
throw new LocalServerException('Host violates local access rules');
throw new LocalServerException('Host "'.$ip.'" ('.$hostName.':'.$port.') violates local access rules');
}
$curlResolves["$hostName:$port"][] = $ip;
}

View file

@ -287,7 +287,7 @@ class DnsPinMiddlewareTest extends TestCase {
public function testRejectIPv4() {
$this->expectException(LocalServerException::class);
$this->expectExceptionMessage('Host violates local access rules');
$this->expectExceptionMessage('violates local access rules');
$mockHandler = new MockHandler([
static function (RequestInterface $request, array $options) {
@ -334,7 +334,7 @@ class DnsPinMiddlewareTest extends TestCase {
public function testRejectIPv6() {
$this->expectException(LocalServerException::class);
$this->expectExceptionMessage('Host violates local access rules');
$this->expectExceptionMessage('violates local access rules');
$mockHandler = new MockHandler([
static function (RequestInterface $request, array $options) {
@ -381,7 +381,7 @@ class DnsPinMiddlewareTest extends TestCase {
public function testRejectCanonicalName() {
$this->expectException(LocalServerException::class);
$this->expectExceptionMessage('Host violates local access rules');
$this->expectExceptionMessage('violates local access rules');
$mockHandler = new MockHandler([
static function (RequestInterface $request, array $options) {