Permalink
Browse files

added the possibility to change the security checker URL

  • Loading branch information...
1 parent 941b1b9 commit b9de1a29e3d24beb371ce862a11f11fae7198791 @fabpot fabpot committed Jun 20, 2014
@@ -39,6 +39,7 @@ protected function configure()
->setDefinition(array(
new InputArgument('lock', InputArgument::OPTIONAL, 'The path to the composer.lock file', 'composer.lock'),
new InputOption('format', '', InputOption::VALUE_REQUIRED, 'The output format', 'text'),
+ new InputOption('end-point', '', InputOption::VALUE_REQUIRED, 'The security checker server URL'),
))
->setDescription('Checks security issues in your project dependencies')
->setHelp(<<<EOF
@@ -61,6 +62,10 @@ protected function configure()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
+ if ($endPoint = $input->getOption('end-point')) {
+ $this->checker->setEndPoint($endPoint);
+ }
+
try {
$data = $this->checker->check($input->getArgument('lock'), $input->getOption('format'));
} catch (\Exception $e) {
@@ -13,8 +13,14 @@
class SecurityChecker
{
+ private $endPoint = 'https://security.sensiolabs.org/check_lock';
private $vulnerabilitiesCount;
+ public function setEndPoint($endPoint)
+ {
+ $this->endPoint = $endPoint;
+ }
+
/**
* Checks a composer.lock file.
*
@@ -67,7 +73,7 @@ public function check($lock, $format = 'text')
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, true);
- curl_setopt($curl, CURLOPT_URL, 'https://security.sensiolabs.org/check_lock');
+ curl_setopt($curl, CURLOPT_URL, $this->endPoint);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: '.$accept));
curl_setopt($curl, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);

0 comments on commit b9de1a2

Please sign in to comment.