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:
parent
d916ac1af3
commit
6c3958ec86
3 changed files with 47 additions and 8 deletions
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue