Commit 71cecb29 authored by catch's avatar catch
Browse files

Revert "Issue #3534278 by phenaproxima, longwave, xjm: The vendor hardening...

Revert "Issue #3534278 by phenaproxima, longwave, xjm: The vendor hardening plugin should provide a way to skip cleaning certain packages"

This reverts commit ce807bf9.
parent bdf5cff3
Loading
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -126,11 +126,6 @@ public function getAllCleanupPaths() {
      $this->configData = array_change_key_case($package_config['drupal-core-vendor-hardening'], CASE_LOWER);
    }

    // Find the packages which should not be cleaned up.
    $do_not_clean = array_filter($this->configData, function ($paths) {
      return $paths === FALSE;
    });

    // Ensure the values are arrays.
    $this->configData = array_map(function ($paths) {
      return (array) $paths;
@@ -142,10 +137,6 @@ public function getAllCleanupPaths() {
        $this->configData[$package] ?? [],
        $paths);
    }

    // Remove packages that should not be cleaned up.
    $this->configData = array_diff_key($this->configData, $do_not_clean);

    return $this->configData;
  }

+0 −11
Original line number Diff line number Diff line
@@ -80,14 +80,3 @@ paths specified for this package might look like this:
This would then cause the plugin to try and remove
web/modules/contrib/module_name/tests and
web/modules/contrib/module_name/src/Tests.

The plugin can be configured to NOT clean certain packages. This is not
recommended, but it may be useful for advanced use cases, such as allowing
Drupal to use a copy of Composer installed locally in the project. For
example, to prevent the plugin from cleaning `composer/composer`:

    "extra": {
      "drupal-core-vendor-hardening": {
        "composer/composer": false
      }
    }
+0 −6
Original line number Diff line number Diff line
@@ -12,7 +12,6 @@
use Symfony\Component\Validator\Constraints\Blank;
use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Constraints\Choice;
use Symfony\Component\Validator\Constraints\File;
use Symfony\Component\Validator\Constraints\IdenticalTo;
use Symfony\Component\Validator\Constraints\Image;
use Symfony\Component\Validator\Constraints\NotBlank;
@@ -119,11 +118,6 @@ public function registerDefinitions() {
      'class' => Choice::class,
      'type' => FALSE,
    ]);
    $this->getDiscovery()->setDefinition('File', [
      'label' => new TranslatableMarkup('File'),
      'class' => File::class,
      'type' => ['string'],
    ]);
    $this->getDiscovery()->setDefinition('Image', [
      'label' => new TranslatableMarkup('Image'),
      'class' => Image::class,
+1 −3
Original line number Diff line number Diff line
@@ -19,9 +19,7 @@ package_manager.settings:
          label: 'Absolute path to Composer executable, or NULL to auto-detect'
          nullable: true
          constraints:
            # The file has to exist but need not be directly executable, because it is
            # always passed to the PHP interpreter.
            File: []
            IsExecutable: []
        rsync:
          type: string
          label: 'Absolute path to rsync executable, or NULL to auto-detect'
+1 −3
Original line number Diff line number Diff line
@@ -68,10 +68,8 @@ public function testSettingsForm(): void {
      'composer' => 'rm -rf /',
      'rsync' => 'cat /etc/passwd',
    ], 'Save configuration');
    $assert_session->statusMessageContains('The file could not be found.', 'error');
    $assert_session->statusMessageContains('"rm -rf /" is not an executable file.', 'error');
    $assert_session->statusMessageContains('"cat /etc/passwd" is not an executable file.', 'error');
    $this->assertTrue($assert_session->fieldExists('composer')->hasClass('error'));
    $this->assertTrue($assert_session->fieldExists('rsync')->hasClass('error'));
  }

}
Loading