-
Notifications
You must be signed in to change notification settings - Fork 437
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
Add allow-list functionality to securitychecker_enlightn #1161
base: v2.x
Are you sure you want to change the base?
Changes from all commits
3187ef1
a935884
5646362
9026e69
bed10e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,10 +24,12 @@ public static function getConfigurableOptions(): ConfigOptionsResolver | |
$resolver->setDefaults([ | ||
'lockfile' => './composer.lock', | ||
'run_always' => false, | ||
'allow_list' => [] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The method |
||
]); | ||
|
||
$resolver->addAllowedTypes('lockfile', ['string']); | ||
$resolver->addAllowedTypes('run_always', ['bool']); | ||
$resolver->addAllowedTypes('allow_list', ['array']); | ||
|
||
return ConfigOptionsResolver::fromOptionsResolver($resolver); | ||
} | ||
|
@@ -50,6 +52,7 @@ public function run(ContextInterface $context): TaskResultInterface | |
$arguments = $this->processBuilder->createArgumentsForCommand('security-checker'); | ||
$arguments->add('security:check'); | ||
$arguments->addOptionalArgument('%s', $config['lockfile']); | ||
$arguments->addArgumentArrayWithSeparatedValue('--allow-list', $config['allow_list'] ?? []); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. allow_list is not nullable since it has a default of [] |
||
|
||
$process = $this->processBuilder->buildProcess($arguments); | ||
$process->run(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,5 +107,16 @@ public function provideExternalTaskRuns(): iterable | |
'./composer.lock', | ||
] | ||
]; | ||
|
||
yield 'with_allow_list' => [ | ||
['allow_list' => ['allow_advisory_1', 'allow_advisory_2']], | ||
$this->mockContext(RunContext::class, ['composer.lock']), | ||
'security-checker', | ||
[ | ||
'security:check', | ||
'./composer.lock', | ||
'--allow-list=allow_advisory_1,allow_advisory_2' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not how addArgumentArrayWithSeparatedValue works. addOptionalCommaSeparatedArgument('--allow-list=%s', $config['allow_list']); |
||
] | ||
]; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This configuraiton option should be explained in more details underneath.