Problem/Motivation

follow-up #3323461: Hosting environment (e.g. cPanel) may add additional files (including symlinks) to the project, which breaks AU — in response to questions raised at #3323461-7: Hosting environment (e.g. cPanel) may add additional files (including symlinks) to the project, which breaks AU

In that issue a site was having problems because the Composer project for Drupal was installed at the base of the hosting account. So in the directory where the project's composer.json was there were other folders such as .cpanel. Some of these folders had symlinks so our SymlinkValidator was stopping Package Manager from working. Even if these folders did not have symlinks there would still be a problem because package_manager by default works by assuming everything under project root should be staged unless a folder is explicitly excluded. If we staged a folder like .cpanel and a change was made to the system this folder after we staged it we could wipe out these changes when we applied the update.

The main reason package_manager stages the whole project directory is because unfortunately even though something is not in the install path of a Composer package does not mean it is not managed by Composer. For instance our drupal/core-composer-scaffold plugin puts index.php and other files in their places and when a core update happens these files might be updated. But if we looked for the path index.php and the other files it manages under any of the install_path's of the packages that Composer knows about they would not be present. Of course we ship with drupal/core-composer-scaffold so we could special case these files.

The problem is if we special case these files then we are implicitly declaring that no other composer plugin can act like drupal/core-composer-scaffold and manage files outside it's install_path because we would not know about the files it manages.

So by default package_manager has been including everything inside the Composer project expect things that explicitly excluded. We exclude paths we know should excluded like the Sqlite db file or the files folder, see the classes under package_manager/src/PathExcluder. Basically we did this because we determined because of how Composer plugins work there is no 100% sure way of knowing what is managed by composer. If we accidentally exclude files that are managed by composer these files will not get updated if a new version of package updates these. Since we don't know the purpose of the files we might miss it is probably best to assume they are critical

Proposed resolution

Create a package manager enforce that only know Composer plugins are allowed.

This validator should:

  1. Subscribe to pre-create, pre-apply, and status-check events
  2. Check the active and staged(if exists) directories
  3. Add an error if there are any packages that require composer-plugin-api and are allowed via settings of the current composer project(there may be an API that determines this?) and are not in the list of allow plugins
  4. Allow specifying additional allowed composer plugins through configuration (with initially just a $config['package_manager.settings']… line), a UI is for later: #3334906: Improve UX for trusting additional composer plugins

Remaining tasks

  1. Create a core policy issue to be clear that projects with other Composer plugins will have to set this setting#3335918: [Policy, no patch] Projects depending on composer plugins will have to update the additional_trusted_composer_plugins setting in package_manager.settings
  2. Deviated from point 3, see question in #9: why do we need to check if a package requires composer-plugin-api? Why can't we just check type === 'composer-plugin'?

User interface changes

Instead of allowing all composer plugins by default, restricting to only explicitly trusted composer plugins.

API changes

package_manager.settings configuration now has a additional_trusted_composer_plugins setting, which accepts a list of package names.

The following composer plugins are supported by default:

  1. drupal/core-vendor-hardening
  2. drupal/core-composer-scaffold
  3. drupal/core-project-message
  4. dealerdirect/phpcodesniffer-composer-installer
  5. phpstan/extension-installer
  6. cweagans/composer-patches

(The first 3 are Drupal core's (of which the first comes with an associated excluder: VendorHardeningExcluder), the 4th and 5th are used for Drupal core development and don't interfere with php-tuf/composer-stager and the last one comes with explicit validation: ComposerPatchesValidator.)

Data model changes

None.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

tedbow created an issue. See original summary.

tedbow’s picture

Issue summary: View changes
wim leers’s picture

On it!

xjm’s picture

Issue tags: -Needs follow-up +Needs followup
wim leers’s picture

Issue summary: View changes
effulgentsia’s picture

Priority: Normal » Major
wim leers’s picture

FYI this will become more relevant in the Drupal world once the Recipes Initiative is further along:

Create composer plugin react when a drupal recipe is installed to unpack the
recipe's dependencies and copy it to PROJECT_ROOT/recipes

https://git.drupalcode.org/project/distributions_recipes/-/blob/1.0.x/do...

wim leers’s picture

Title: Limit allow Composer plugins to a known list » [PP-2] Limit allow Composer plugins to a known list
Status: Active » Needs review
Parent issue: » #3319030: Drupal Core Roadmap for Package Manager and Update Manager
Related issues: +#3252299: Reliably support cweagans/composer-patches in Package Manager & Automatic Updates: validate stage, +#3328234: Improve test DX *and* confidence: stop using VFS

First, let's start with implementing the first three points of the proposed solution:

  1. Subscribe to pre-create, pre-apply, and status-check events
  2. Check the active and staged(if exists) directories
  3. Add an error if there are any packages that require composer-plugin-api and are allowed via settings of the current composer project(there may be an API that determines this?) and are not in the list of allow plugins
  4. Allow a setting in settings.php to add plugins to the allowed list

For the third point, I'm not quite sure why we need to check if a package requires composer-plugin-api? Why can't we just check type === 'composer-plugin'? That's what I went with for now.

⚠️ Failures expected

I expect the commit I just pushed (ed7ef929396880a97c921e5f7bb16c3f3c477e21) to fail because of:

  1. a bug in PreOperationStageEvent::addError()
  2. a bug in \Drupal\fixture_manipulator\FixtureManipulator::setPackage() for dealing with pretty vs non-pretty package names
  3. a critical bug in ComposerPatchesValidator — already captured at #3252299-17: Reliably support cweagans/composer-patches in Package Manager & Automatic Updates: validate stage 👉 postponing this issue on that one ⚠️
  4. once that is fixed, it'll fail because the message generated by ComposerPatchesValidator is nonsensical (it complains about a non-existent config.json file) due to #3328234: Improve test DX *and* confidence: stop using VFS 👉 postponing this issue on that one ⚠️ (and actually HEAD is already wrongly testing that since #3314137: Make Automatic Updates Drupal 10-compatible, but only because of #3328234: Improve test DX *and* confidence: stop using VFS…)

The first two are trivial fixes but nonsensical to write separate tests for, so I propose to fix those here. The other two I'll provide fixes for here so we can continue development here, but this MR should not land with those fixes.

Next

After fixing those failures, I'll address point 4 of the proposed solution.

Question

The issue summary seems to imply that a better solution still would be to flip the architecture around entirely, and switch from exclusions to inclusions. If we are to only support specific composer plugins, and each of those would require explicit vetting, then that would be possible. That'd of course be a drastic change, with big consequences.

But in security, in general, exclusions are considered a bad practice. So why was the architectural decision made to include everything, but allow exclusions, instead of the other way around? 🤔 This is not documented in package_manager.api.php and should be. Will update #3318306: Define the Package Manager API (package_manager.api.php is outdated).

wim leers’s picture

Just pushed 6e35d17 — that fixes the second bug mentioned in #9, and will make these failures disappear:

+        'summary' => 'Package Manager could not get the data for the following packages.'
wim leers’s picture

Just pushed 3c5e5a7, that fixes the first bug mentioned in #9, and will make these failures disappear:

--- Expected
+++ Actual
@@ @@
     0 => Array &1 (
         'severity' => 2
         'messages' => Array &2 (
-            0 => 'NOT-cweagans/NOT-composer-patches 6.1'
+            'not-cweagans/not-composer-patches' => 'NOT-cweagans/NOT-composer-patches 6.1'
         )
         'summary' => 'An unsupported composer plugin was detected.'
     )
wim leers’s picture

Just pushed 1d22833, that fixes the third bug mentioned in #9, and will make these failures disappear:

3) Drupal\Tests\package_manager\Kernel\ComposerPluginsValidatorTest::testValidationDuringPreApply with data set "one supported composer plugin" (array(array('cweagans/composer-patches', '1.0.0', 'composer-plugin')), array(Drupal\package_manager\ValidationResult Object (...)))
Failed asserting that an array is empty.

4) Drupal\Tests\package_manager\Kernel\ComposerPluginsValidatorTest::testValidationDuringPreApply with data set "complex combination" (array(array('drupal/semver_test', '8.1.0', 'drupal-module', '../../modules/semver_test'), array('cweagans/composer-patches', '1.0.0', 'composer-plugin'), array('NOT-cweagans/NOT-composer-patches', '6.1', 'composer-plugin'), array('drupal/core-vendor-hardening', '9.8.0', 'composer-plugin')), array(Drupal\package_manager\ValidationResult Object (...), Drupal\package_manager\ValidationResult Object (...)))
Failed asserting that two arrays are identical.
--- Expected
+++ Actual
@@ @@
         )
         'summary' => 'An unsupported composer plugin was detected.'
     )
-    1 => Array &3 (
-        'severity' => 2
-        'messages' => Array &4 (
-            0 => 'The <code>cweagans/composer-patches

plugin is installed, but the composer-exit-on-patch-failure key is not set to true in the extra section of composer.json.'
- )
- 'summary' => null
- )
)

wim leers’s picture

Status: Needs review » Needs work

8 of the 9 failures are Build tests. The 9th failure should be fixed in 4bb2458 which I just pushed.

wim leers’s picture

Up until #13, we were getting:

Testing Drupal\Tests\automatic_updates_extensions\Build\ModuleUpdateTest
EE                                                                  2 / 2 (100%)

Time: 02:15.021, Memory: 18.00 MB

There were 2 errors:

1) Drupal\Tests\automatic_updates_extensions\Build\ModuleUpdateTest::testApi
Behat\Mink\Exception\ExpectationException: Current response status code is 500, but 200 expected.
…
2) Drupal\Tests\automatic_updates_extensions\Build\ModuleUpdateTest::testUi
Behat\Mink\Exception\ElementNotFoundException: Button with id|name|title|alt|value "Update" not found.
…

Testing Drupal\Tests\package_manager\Build\PackageUpdateTest
E                                                                   1 / 1 (100%)

Time: 01:01.558, Memory: 16.00 MB

There was 1 error:

1) Drupal\Tests\package_manager\Build\PackageUpdateTest::testPackageUpdate
Behat\Mink\Exception\ExpectationException: Current response status code is 500, but 200 expected.
…

Testing Drupal\Tests\automatic_updates\Build\CoreUpdateTest
FEEEE                                                               5 / 5 (100%)

Time: 05:43.348, Memory: 18.00 MB

There were 4 errors:

1) Drupal\Tests\automatic_updates\Build\CoreUpdateTest::testUi
Behat\Mink\Exception\ElementNotFoundException: Button with id|name|title|alt|value "Update to 9.8.1" not found.

…

2) Drupal\Tests\automatic_updates\Build\CoreUpdateTest::testCron with data set "RecommendedProject" ('RecommendedProject')
Behat\Mink\Exception\ResponseTextException: The text "Your site is ready for automatic updates." was not found anywhere in the text of the current page.

…

3) Drupal\Tests\automatic_updates\Build\CoreUpdateTest::testCron with data set "LegacyProject" ('LegacyProject')
Behat\Mink\Exception\ResponseTextException: The text "Your site is ready for automatic updates." was not found anywhere in the text of the current page.

…

4) Drupal\Tests\automatic_updates\Build\CoreUpdateTest::testStageDestroyedIfNotAvailable
Behat\Mink\Exception\ElementNotFoundException: Button with id|name|title|alt|value "Update to 9.8.1" not found.

…

--

There was 1 failure:

1) Drupal\Tests\automatic_updates\Build\CoreUpdateTest::testApi
Failed asserting that two arrays are identical.
--- Expected
+++ Actual
@@ @@
     0 => 'package_manager_test_event_logger-start: Event: Drupal\package_manager\Event\PreCreateEvent, Stage instance of: Drupal\automatic_updates\Updater:package_manager_test_event_logger-end'
     1 => 'package_manager_test_event_logger-start: Event: Drupal\package_manager\Event\PreCreateEvent, Stage instance of: Drupal\automatic_updates\Updater:package_manager_test_event_logger-end'
     2 => 'package_manager_test_event_logger-start: Event: Drupal\package_manager\Event\PreCreateEvent, Stage instance of: Drupal\automatic_updates\Updater:package_manager_test_event_logger-end'
-    3 => 'package_manager_test_event_logger-start: Event: Drupal\package_manager\Event\PostCreateEvent, Stage instance of: Drupal\automatic_updates\Updater:package_manager_test_event_logger-end'
-    4 => 'package_manager_test_event_logger-start: Event: Drupal\package_manager\Event\PreRequireEvent, Stage instance of: Drupal\automatic_updates\Updater:package_manager_test_event_logger-end'
-    5 => 'package_manager_test_event_logger-start: Event: Drupal\package_manager\Event\PostRequireEvent, Stage instance of: Drupal\automatic_updates\Updater:package_manager_test_event_logger-end'
-    6 => 'package_manager_test_event_logger-start: Event: Drupal\package_manager\Event\PreApplyEvent, Stage instance of: Drupal\automatic_updates\Updater:package_manager_test_event_logger-end'
-    7 => 'package_manager_test_event_logger-start: Event: Drupal\package_manager\Event\PostApplyEvent, Stage instance of: Drupal\automatic_updates\Updater:package_manager_test_event_logger-end'
-    8 => 'package_manager_test_event_logger-start: Event: Drupal\package_manager\Event\PreDestroyEvent, Stage instance of: Drupal\automatic_updates\Updater:package_manager_test_event_logger-end'
-    9 => 'package_manager_test_event_logger-start: Event: Drupal\package_manager\Event\PostDestroyEvent, Stage instance of: Drupal\automatic_updates\Updater:package_manager_test_event_logger-end'
 )
…

👆 These failures do not indicate at all what is happening! 😬

So I just spent a shockingly long time improving the DX for this, for the next poor soul who is working on adding a validator… 😊 Let's find out in the morning 😴

wim leers’s picture

Great, now we got this instead:

Testing Drupal\Tests\automatic_updates_extensions\Build\ModuleUpdateTest
FF                                                                  2 / 2 (100%)

Time: 02:15.326, Memory: 18.00 MB

There were 2 failures:

1) Drupal\Tests\automatic_updates_extensions\Build\ModuleUpdateTest::testApi
Error response: The website encountered an unexpected error. Please try again later.Drupal\automatic_updates\Exception\UpdateException: An unsupported composer plugin was detected.
drupal/core-composer-scaffold 10.1.x-dev
…

2) Drupal\Tests\automatic_updates_extensions\Build\ModuleUpdateTest::testUi
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-''
+'Error message Your site does not pass some readiness checks for automatic updates. It cannot be automatically updated until further action is performed.drupal/core-composer-scaffold 10.1.x-dev'
…

Testing Drupal\Tests\package_manager\Build\PackageUpdateTest
F                                                                   1 / 1 (100%)

Time: 01:00.061, Memory: 16.00 MB

There was 1 failure:

1) Drupal\Tests\package_manager\Build\PackageUpdateTest::testPackageUpdate
Error response: The website encountered an unexpected error. Please try again later.Drupal\package_manager\Exception\StageValidationException: An unsupported composer plugin was detected.
drupal/core-composer-scaffold 10.1.x-dev
…

Testing Drupal\Tests\package_manager\Build\PackageInstallTest
F                                                                   1 / 1 (100%)

Time: 00:53.560, Memory: 16.00 MB

There was 1 failure:

1) Drupal\Tests\package_manager\Build\PackageInstallTest::testPackageInstall
Error response: The website encountered an unexpected error. Please try again later.Drupal\package_manager\Exception\StageValidationException: An unsupported composer plugin was detected.
drupal/core-composer-scaffold 10.1.x-dev
…

Testing Drupal\Tests\automatic_updates\Build\CoreUpdateTest
FFFFF                                                               5 / 5 (100%)

Time: 05:24.420, Memory: 18.00 MB

There were 5 failures:

1) Drupal\Tests\automatic_updates\Build\CoreUpdateTest::testApi
Error response: The website encountered an unexpected error. Please try again later.Drupal\automatic_updates\Exception\UpdateException: An unsupported composer plugin was detected.
drupal/core-composer-scaffold 9.8.0
…
Failed asserting that two arrays are identical.
--- Expected
+++ Actual
@@ @@
     0 => 'package_manager_test_event_logger-start: Event: Drupal\package_manager\Event\PreCreateEvent, Stage instance of: Drupal\automatic_updates\Updater:package_manager_test_event_logger-end'
     1 => 'package_manager_test_event_logger-start: Event: Drupal\package_manager\Event\PreCreateEvent, Stage instance of: Drupal\automatic_updates\Updater:package_manager_test_event_logger-end'
     2 => 'package_manager_test_event_logger-start: Event: Drupal\package_manager\Event\PreCreateEvent, Stage instance of: Drupal\automatic_updates\Updater:package_manager_test_event_logger-end'
-    3 => 'package_manager_test_event_logger-start: Event: Drupal\package_manager\Event\PostCreateEvent, Stage instance of: Drupal\automatic_updates\Updater:package_manager_test_event_logger-end'
-    4 => 'package_manager_test_event_logger-start: Event: Drupal\package_manager\Event\PreRequireEvent, Stage instance of: Drupal\automatic_updates\Updater:package_manager_test_event_logger-end'
-    5 => 'package_manager_test_event_logger-start: Event: Drupal\package_manager\Event\PostRequireEvent, Stage instance of: Drupal\automatic_updates\Updater:package_manager_test_event_logger-end'
-    6 => 'package_manager_test_event_logger-start: Event: Drupal\package_manager\Event\PreApplyEvent, Stage instance of: Drupal\automatic_updates\Updater:package_manager_test_event_logger-end'
-    7 => 'package_manager_test_event_logger-start: Event: Drupal\package_manager\Event\PostApplyEvent, Stage instance of: Drupal\automatic_updates\Updater:package_manager_test_event_logger-end'
-    8 => 'package_manager_test_event_logger-start: Event: Drupal\package_manager\Event\PreDestroyEvent, Stage instance of: Drupal\automatic_updates\Updater:package_manager_test_event_logger-end'
-    9 => 'package_manager_test_event_logger-start: Event: Drupal\package_manager\Event\PostDestroyEvent, Stage instance of: Drupal\automatic_updates\Updater:package_manager_test_event_logger-end'
 )
…

2) Drupal\Tests\automatic_updates\Build\CoreUpdateTest::testUi
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-''
+'Error message Your site does not pass some readiness checks for automatic updates. It cannot be automatically updated until further action is performed.drupal/core-composer-scaffold 9.8.0'
…

3) Drupal\Tests\automatic_updates\Build\CoreUpdateTest::testCron with data set "RecommendedProject" ('RecommendedProject')
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-''
+'Your site does not pass some readiness checks for automatic updates. It cannot be automatically updated until further action is performed. drupal/core-composer-scaffold 9.8.0Rerun readiness checks now.'
…

4) Drupal\Tests\automatic_updates\Build\CoreUpdateTest::testCron with data set "LegacyProject" ('LegacyProject')
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-''
+'Your site does not pass some readiness checks for automatic updates. It cannot be automatically updated until further action is performed. drupal/core-composer-scaffold 9.8.0Rerun readiness checks now.'
…

5) Drupal\Tests\automatic_updates\Build\CoreUpdateTest::testStageDestroyedIfNotAvailable
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-''
+'Error message Your site does not pass some readiness checks for automatic updates. It cannot be automatically updated until further action is performed.drupal/core-composer-scaffold 9.8.0'
…

🥳

wim leers’s picture

The test coverage improvements between #13 and #15 also unblock other issues — see #3319679-19: Assert known preconditions for test runs and fail early if unmet. Tagging blocker.

wim leers’s picture

A single failure on 9.4.7:

Testing Drupal\Tests\automatic_updates_extensions\Build\ModuleUpdateTest
.F                                                                  2 / 2 (100%)

Time: 03:27.012, Memory: 18.00 MB

There was 1 failure:

1) Drupal\Tests\automatic_updates_extensions\Build\ModuleUpdateTest::testUi
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-''
+'Error message There is a security update available for your version of Drupal. To ensure the security of your server, you should update immediately! See the available updates page for more information and to install your missing updates.'

→ because we're now explicitly asserting that no error messages appear prior to installing a package, but that error message was present all along. Because that test still is being told that Drupal 9.8.1 is the latest version available, and we're on 9.4.x, so "a new sec release" is available — unlike on 10.1.x, for which 9.8.1 evidently is not a viable security update! So the test is in part testing the wrong thing; it should have been testing only that module updates were available, not core updates.

Fix pushed: 6e97f1a88a706b32cd797c71ae634691424c1946.

wim leers’s picture

Title: [PP-2] Limit allow Composer plugins to a known list » [PP-2] Limit trusted Composer plugins to a known list, allow user to add more
Issue summary: View changes

Overhauled issue summary to reflect current status and to reflect direction for the remaining work after having discussed with @tedbow 😊

wim leers’s picture

That test coverage works, but:

Testing Drupal\Tests\package_manager\Kernel\ComposerPluginsValidatorTest
..........SSSFF                                                   15 / 15 (100%)

Time: 00:25.033, Memory: 6.00 MB

There were 2 failures:
  1. It skips some, we shouldn't be doing that.
  2. It's only testing the trusting of things for the PreCreateEvent, we should also do it for PreApplyEvent just to be safe.

Fixed in 116892a05c1e3f605206e16acb70d935ba39238c, which should get us to:

Testing Drupal\Tests\package_manager\Kernel\ComposerPluginsValidatorTest
..............                                                    14 / 14 (100%)

Time: 16.58 seconds, Memory: 8.00 MB

OK (14 tests, 53 assertions)
wim leers’s picture

Assigned: wim leers » tedbow
Issue summary: View changes
Status: Needs work » Needs review
Issue tags: +Needs documentation updates
  • Test coverage finished, including update path test.
  • Ability to trust additional composer plugins added.
  • Update path implemented.
  • Help/docs written.
  • CR created: https://www.drupal.org/node/3334960

What's still needed is updating package_manager.api.php. Tagging for that.

This can already be reviewed today, even though there's 2 blockers still preventing this from landing.

wim leers’s picture

Title: [PP-2] Limit trusted Composer plugins to a known list, allow user to add more » [PP-1] Limit trusted Composer plugins to a known list, allow user to add more
wim leers’s picture

Title: [PP-1] Limit trusted Composer plugins to a known list, allow user to add more » Limit trusted Composer plugins to a known list, allow user to add more

Merged in 8.x-2.x, which includes #3328234: Improve test DX *and* confidence: stop using VFS. The changes that were made there made it all the more awkward to make the changes here that #3252299: Reliably support cweagans/composer-patches in Package Manager & Automatic Updates: validate stage should make. So … removed them, and instead commented out the ~20 LoC that will ensure full test coverage of this issue's new validator combined with ComposerPatchesValidator.

And that made me realize that in fact this issue should move forward already without #3252299: Reliably support cweagans/composer-patches in Package Manager & Automatic Updates: validate stage having landed, because this makes it more clear in what way HEAD's ComposerPatchesValidator is not yet dealing with all edge cases. So: pushed 3bdc3ea to uncouple it and now unpostponing!

wim leers’s picture

Documentation added.

wim leers’s picture

Status: Needs review » Reviewed & tested by the community

This is ready for final review from @tedbow.

tedbow’s picture

Assigned: tedbow » wim leers
Status: Reviewed & tested by the community » Needs work

Needs work for MR question

wim leers’s picture

Status: Needs work » Reviewed & tested by the community
Issue tags: +Needs followup

Responded on MR. Thank you. This made me realize we need a new issue, which actually is technically unrelated to this issue, but it was definitely discovered thanks to this issue — tagging Needs followup to ensure we don't forget 😊

wim leers’s picture

Title: Limit trusted Composer plugins to a known list, allow user to add more » [PP-1] Limit trusted Composer plugins to a known list, allow user to add more
Assigned: wim leers » Unassigned
Status: Reviewed & tested by the community » Postponed

Let's wait a moment here, because I think a lot of the stuff this had to do could land in #3320792: Make build tests fail 1) more explicitly, 2) earlier when possible (failing StatusCheckEvent subscribers)

wim leers’s picture

wim leers’s picture

Assigned: Unassigned » wim leers
Issue tags: -Needs followup

Discussed with @tedbow in detail. #3320792: Make build tests fail 1) more explicitly, 2) earlier when possible (failing StatusCheckEvent subscribers) will incorporate the changes to Build tests that this issue made. That means this issue is now officially postponed on that one.

All follow-ups were created.

Once #3320792: Make build tests fail 1) more explicitly, 2) earlier when possible (failing StatusCheckEvent subscribers) lands, the changes in this MR will be significantly smaller and easier to review, so let's wait for that 😊 Assigning to me to update it after that lands. 👍

tedbow’s picture

Title: [PP-1] Limit trusted Composer plugins to a known list, allow user to add more » Limit trusted Composer plugins to a known list, allow user to add more
Status: Postponed » Needs work
wim leers’s picture

Assigned: wim leers » Unassigned
Status: Needs work » Reviewed & tested by the community
Related issues: +#3337049: Assert no errors after creating the test project in ModuleUpdateTest

And now removed the remaining out-of-scope-but-discovered-here changes from this MR and adding them to #3337049: Assert no errors after creating the test project in ModuleUpdateTest 👍

tedbow’s picture

tedbow’s picture

Assigned: Unassigned » wim leers
Status: Reviewed & tested by the community » Needs work

Needs work for MR comments

wim leers’s picture

Discusssed with @tedbow, I'm 70% of the way through implementing this — I thought it'd be trivial but because now we need to modify composer.json, I also need to modify the FixtureManipulator… 😬

Probably will be unable to finish this tonight; almost need to run for dinner. Definitely to be continued tomorrow!

wim leers’s picture

Issue tags: +Needs tests

Got it working, but still need to expand the test coverage for the new possible failure modes tomorrow.

wim leers’s picture

Assigned: wim leers » tedbow
Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs tests

Addressed all of @tedbow's feedback, test coverage expanded accordingly, and found a critical bug in my test coverage while doing so 👍

Also thoroughly documented the rationale behind the architecture in the class-level docblock, so that the results of the conversatino @tedbow and I had are available for posterity 😊

tedbow’s picture

Assigned: tedbow » wim leers
Status: Reviewed & tested by the community » Needs work

Needs work at least to use the Composer Inspector

tedbow’s picture

Status: Needs work » Reviewed & tested by the community

RTBC

@Wim Leers if I didn't address your question well enough in https://git.drupalcode.org/project/automatic_updates/-/merge_requests/65...

lets make a follow-up

  • tedbow committed 9bfc8ace on 8.x-2.x authored by Wim Leers
    Issue #3331168 by Wim Leers, tedbow: Limit trusted Composer plugins to a...
tedbow’s picture

Status: Reviewed & tested by the community » Fixed

Thanks @Wim Leers!

wim leers’s picture

Assigned: wim leers » Unassigned

@tedbow I’m really glad that this landed, but I worry that introducing version restrictions on the supported composer plugins later will constitute a BC break — not just for the configuration, but also for the behavior of the "out of the box supported" composer plugins.

Is that not a concern for you?

Either way, it's good to have this landed, we can add version constraints in a next issue. And I agree with your remark that you posted just prior to committing: \Drupal\package_manager\Validator\ComposerPatchesValidator should be marked final and @internal. Perhaps we can do all of that combined in a core-mvp follow-up?

wim leers’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.