Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced abandoned Sensiolabs security checker with Enlightn security checker #870

Merged
merged 2 commits into from
Feb 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"consolidation/robo": "Lets GrumPHP run your automated PHP tasks.",
"designsecurity/progpilot": "Lets GrumPHP be sure that there are no vulnerabilities in your code.",
"doctrine/orm": "Lets GrumPHP validate your Doctrine mapping files.",
"enlightn/security-checker": "Lets GrumPHP be sure that there are no known security issues.",
"ergebnis/composer-normalize": "Lets GrumPHP tidy and normalize your composer.json file.",
"friendsofphp/php-cs-fixer": "Lets GrumPHP automatically fix your codestyle.",
"friendsoftwig/twigcs": "Lets GrumPHP check Twig coding standard.",
Expand All @@ -74,7 +75,6 @@
"povils/phpmnd": "Lets GrumPHP help you detect magic numbers in PHP code.",
"roave/security-advisories": "Lets GrumPHP be sure that there are no known security issues.",
"sebastian/phpcpd": "Lets GrumPHP find duplicated code.",
"sensiolabs/security-checker": "Lets GrumPHP be sure that there are no known security issues.",
"squizlabs/php_codesniffer": "Lets GrumPHP sniff on your code.",
"sstalle/php7cc": "Lets GrumPHP check PHP 5.3 - 5.6 code compatibility with PHP 7.",
"symfony/phpunit-bridge": "Lets GrumPHP run your unit tests with the phpunit-bridge of Symfony.",
Expand Down
23 changes: 1 addition & 22 deletions doc/tasks/securitychecker.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The Security Checker will check your `composer.lock` file for known security vul
***Composer***

```
composer require --dev sensiolabs/security-checker
composer require --dev enlightn/security-checker
```

***Config***
Expand All @@ -18,9 +18,6 @@ grumphp:
tasks:
securitychecker:
lockfile: ./composer.lock
format: ~
end_point: ~
timeout: ~
run_always: false
```

Expand All @@ -30,24 +27,6 @@ grumphp:

If your `composer.lock` file is located in an exotic location, you can specify the location with this option. By default, the task will try to load a `composer.lock` file in the current directory.

**format**

*Default: null*

You can choose the format of the output. The available options are `text`, `json` and `simple`. By default, grumphp will use the format `text`.

**end_point**

*Default: null*

You can use a different end point for the security checks. Grumphp will use the default end point which is [https://security.symfony.com/check_lock](https://security.symfony.com/check_lock).

**timeout**

*Default: null*

You can change the timeout value for the command. By default this value is `20`.

**run_always**

*Default: false*
Expand Down
9 changes: 0 additions & 9 deletions src/Task/SecurityChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,10 @@ public static function getConfigurableOptions(): OptionsResolver
$resolver = new OptionsResolver();
$resolver->setDefaults([
'lockfile' => './composer.lock',
'format' => null,
'end_point' => null,
'timeout' => null,
'run_always' => false,
]);

$resolver->addAllowedTypes('lockfile', ['string']);
$resolver->addAllowedTypes('format', ['null', 'string']);
$resolver->addAllowedTypes('end_point', ['null', 'string']);
$resolver->addAllowedTypes('timeout', ['null', 'int']);
$resolver->addAllowedTypes('run_always', ['bool']);

return $resolver;
Expand All @@ -52,9 +46,6 @@ public function run(ContextInterface $context): TaskResultInterface
$arguments = $this->processBuilder->createArgumentsForCommand('security-checker');
$arguments->add('security:check');
$arguments->addOptionalArgument('%s', $config['lockfile']);
$arguments->addOptionalArgument('--format=%s', $config['format']);
$arguments->addOptionalArgument('--end-point=%s', $config['end_point']);
$arguments->addOptionalArgument('--timeout=%s', $config['timeout']);

$process = $this->processBuilder->buildProcess($arguments);
$process->run();
Expand Down
29 changes: 0 additions & 29 deletions test/Unit/Task/SecurityCheckerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ public function provideConfigurableOptions(): iterable
[],
[
'lockfile' => './composer.lock',
'format' => null,
'end_point' => null,
'timeout' => null,
'run_always' => false,
]
];
Expand Down Expand Up @@ -110,31 +107,5 @@ public function provideExternalTaskRuns(): iterable
'./composer.lock',
]
];

yield 'endpoint' => [
[
'end_point' => $endpoint = 'http://myserver.com',
],
$this->mockContext(RunContext::class, ['composer.lock']),
'security-checker',
[
'security:check',
'./composer.lock',
'--end-point='.$endpoint
]
];

yield 'timeout' => [
[
'timeout' => 2,
],
$this->mockContext(RunContext::class, ['composer.lock']),
'security-checker',
[
'security:check',
'./composer.lock',
'--timeout=2'
]
];
}
}