Skip to content

Commit

Permalink
Merge pull request #8 from spryker-sdk/feature/sdk-2351-uses-latest-v…
Browse files Browse the repository at this point in the history
…ersion

SDK-2351: Uses latest package version
  • Loading branch information
DmytroKlymanSpryker authored Apr 24, 2023
2 parents 35187fa + 9976c24 commit 619c9c6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/SecurityChecker/Command/SecurityCheckerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Exception\RuntimeException;
use Symfony\Component\Process\Process;

class SecurityCheckerCommand extends Command
Expand All @@ -23,7 +24,7 @@ class SecurityCheckerCommand extends Command

protected const COMMAND_NAME = 'security:check';

protected const BINARY_CHECKER = 'https://github.com/fabpot/local-php-security-checker/releases/download/v1.0.0/local-php-security-checker_1.0.0_linux_amd64';
protected const BINARY_CHECKER = '$(curl -s https://api.github.com/repos/fabpot/local-php-security-checker/releases/latest | grep browser_download_url | cut -d\" -f4 | egrep "local-php-security-checker_[0-9.]+_linux_amd64$")';
protected const FILE_NAME = '/tmp/security-checker';
protected const FALSE_POSITIVE_ISSUE_NUMBER = 'CVE-NONE-0001';

Expand Down Expand Up @@ -93,7 +94,7 @@ protected function getParameters(InputInterface $input): array
}

/**
* @throws \Symfony\Component\Process\Exception\ProcessFailedException
* @throws \Symfony\Component\Process\Exception\RuntimeException
*
* @return void
*/
Expand All @@ -103,11 +104,10 @@ protected function loadFile(): void
return;
}

$process = new Process(['wget', static::BINARY_CHECKER, '-O', static::FILE_NAME]);
$process->run();
exec(sprintf('wget %s -O %s 2>&1', static::BINARY_CHECKER, static::FILE_NAME), $output, $resultCode);

if ($process->getExitCode() === static::CODE_ERROR) {
throw new ProcessFailedException($process);
if ($resultCode === static::CODE_ERROR) {
throw new RuntimeException(implode(PHP_EOL, $output));
}

$this->changeFileMode();
Expand Down

0 comments on commit 619c9c6

Please sign in to comment.