1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +00:00

Add warning if host is accessed via verify_peer or verify_peer_name disabled (#10722)

This commit is contained in:
Stephan 2022-04-13 11:21:08 +01:00 committed by GitHub
parent d916ac1af3
commit 6c3958ec86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 8 deletions

View file

@ -13,6 +13,9 @@
namespace Composer\Test;
use Composer\Config;
use Composer\IO\BaseIO;
use Composer\IO\IOInterface;
use Composer\IO\NullIO;
use Composer\Util\Platform;
class ConfigTest extends TestCase
@ -308,6 +311,24 @@ class ConfigTest extends TestCase
}, $urls));
}
public function testProhibitedUrlsWarningVerifyPeer(): void
{
$io = $this->getMockBuilder(IOInterface::class)->disableOriginalConstructor()->getMock();
$io
->expects($this->once())
->method('writeError')
->with($this->equalTo('<warning>Warning: Accessing example.org with verify_peer and verify_peer_name disabled.</warning>'));
$config = new Config(false);
$config->prohibitUrlByConfig('https://example.org', $io, [
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
]
]);
}
/**
* @group TLS
*/