Skip to content

Commit

Permalink
Make it possible to always allow direct
Browse files Browse the repository at this point in the history
  • Loading branch information
eiriksm committed Mar 22, 2023
1 parent 1e056b7 commit 135b871
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"violinist-dev/slug-from-url": "^1",
"violinist-dev/symfony-cloud-security-checker": "^2",
"violinist-dev/timeframe-handler": "^1.0",
"violinist-dev/violinist-config": "^2.0",
"violinist-dev/violinist-config": "^2.1",
"violinist-dev/violinist-messages": "^1.6.0",
"wa72/simplelogger": "^1.0"
},
Expand Down
10 changes: 10 additions & 0 deletions src/CosyComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,16 @@ public function run()
}
// Only update the ones in the allow list, if indicated.
$handler = AllowListHandler::createFromConfig($config);
if ($config->shouldAlwaysAllowDirect()) {
$require_list = [];
if (!empty($composer_json_data->require)) {
$require_list = array_keys(get_object_vars($composer_json_data->require));
}
if (!empty($composer_json_data->{'require-dev'})) {
$require_list = array_merge($require_list, array_keys(get_object_vars($composer_json_data->require)));
}
$handler = AllowListHandler::createFromArray(array_merge($require_list, $config->getAllowList()));
}
$handler->setLogger($this->getLogger());
$data = $handler->applyToItems($data);
// Remove non-security packages, if indicated.
Expand Down

0 comments on commit 135b871

Please sign in to comment.