Skip to content

Commit

Permalink
Add allow-list config option to securitychecker_enlightn
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjaap committed Nov 19, 2022
1 parent 33449e8 commit a93d611
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Task/SecurityChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ public static function getConfigurableOptions(): OptionsResolver
'end_point' => null,
'timeout' => null,
'run_always' => false,
'allow-list' => [],
]);

$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']);
$resolver->addAllowedTypes('allow-list', ['array']);

return $resolver;
}
Expand Down
5 changes: 5 additions & 0 deletions src/Task/SecurityCheckerEnlightn.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ public static function getConfigurableOptions(): OptionsResolver
$resolver->setDefaults([
'lockfile' => './composer.lock',
'run_always' => false,
'allow-list' => []
]);

$resolver->addAllowedTypes('lockfile', ['string']);
$resolver->addAllowedTypes('run_always', ['bool']);
$resolver->addAllowedTypes('allow-list', ['array']);

return $resolver;
}
Expand All @@ -45,6 +47,9 @@ public function run(ContextInterface $context): TaskResultInterface
$arguments = $this->processBuilder->createArgumentsForCommand('security-checker');
$arguments->add('security:check');
$arguments->addOptionalArgument('%s', $config['lockfile']);
foreach ($config['allow-list'] as $cve) {
$arguments->addOptionalArgument('--allow-list=%s', $cve);
}

$process = $this->processBuilder->buildProcess($arguments);
$process->run();
Expand Down
1 change: 1 addition & 0 deletions test/Unit/Task/SecurityCheckerEnlightnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function provideConfigurableOptions(): iterable
[
'lockfile' => './composer.lock',
'run_always' => false,
'allow-list' => [],
]
];
}
Expand Down

0 comments on commit a93d611

Please sign in to comment.