Skip to content
Snippets Groups Projects

Issue #3310729: Incorrect documentation link in UI in case of Process error

9 files
+ 565
18
Compare changes
  • Side-by-side
  • Inline
Files
9
  • 34a00b34
    Issue #3316617 by phenaproxima, tedbow, Wim Leers: Add a validator to check... · 34a00b34
    Adam G-H authored
    Issue #3316617 by phenaproxima, tedbow, Wim Leers: Add a validator to check that PHP-TUF's Composer integration is present and configured correctly
@@ -85,6 +85,7 @@ final class ComposerPluginsValidator implements EventSubscriberInterface {
'drupal/core-project-message' => '*',
'phpstan/extension-installer' => '^1.1',
// cSpell:enable
PhpTufValidator::PLUGIN_NAME => '^1',
];
/**
@@ -152,23 +153,13 @@ final class ComposerPluginsValidator implements EventSubscriberInterface {
? $stage->getStageDirectory()
: $this->pathLocator->getProjectRoot();
try {
// @see https://getcomposer.org/doc/06-config.md#allow-plugins
$value = $this->inspector->getConfig('allow-plugins', $dir);
$allowed_plugins = $this->inspector->getAllowPluginsConfig($dir);
}
catch (RuntimeException $exception) {
$event->addErrorFromThrowable($exception, $this->t('Unable to determine Composer <code>allow-plugins</code> setting.'));
return;
}
// Try to convert the value we got back to a boolean. If that can't be done,
// assume it's an array of plugin-specific flags and parse it as JSON.
try {
$allowed_plugins = ComposerInspector::toBoolean($value);
}
catch (\UnhandledMatchError) {
$allowed_plugins = json_decode($value, TRUE, flags: JSON_THROW_ON_ERROR);
}
if ($allowed_plugins === TRUE) {
$event->addError([$this->t('All composer plugins are allowed because <code>config.allow-plugins</code> is configured to <code>true</code>. This is an unacceptable security risk.')]);
return;
Loading