Problem/Motivation
The upcoming composer release is going to cause problems for our test suite - see https://git.drupalcode.org/issue/drupal-3523596/-/jobs/7271837 and https://git.drupalcode.org/issue/drupal-3523596/-/jobs/7271767
Problem 1
├ - Root composer.json requires drupal/core 9.8.0 (exact version match: 9.8.0 or 9.8.0.0), found drupal/core[9.8.0] but these were not loaded, because they are affected by security advisories. To ignore the advisories, add ("SA-CORE-2024-001", "SA-CORE-2024-003", "SA-CORE-2024-004", "SA-CORE-2024-006", "SA-CORE-2024-007", "SA-CORE-2024-008", "SA-CORE-2025-001", "SA-CORE-2025-002", "SA-CORE-2025-003", "SA-CORE-2025-004", "SA-CORE-2025-007", "SA-CORE-2025-008", "SA-CORE-2025-005", "SA-CORE-2025-006") to the audit "ignore" config. To turn the feature off entirely, you can set "block-insecure" to false in your "audit" config.
Looks like a new security feature is coming.
Steps to reproduce
Run \Drupal\Tests\package_manager\Kernel\PhpTufValidatorTest or some of the build tests
Proposed resolution
TBD
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Comments
Comment #2
cilefen commentedIt is https://github.com/composer/composer/pull/11956.
Comment #3
longwaveGiven 2.9.0 is now out let's use this issue to do the upgrade in 11.x and fix the tests at the same time.
Comment #4
longwaveComment #6
longwavePhpTufValidatorTest passed locally, let's see what happens to everything else.
Comment #7
longwave@alexpott can you confirm the problem is gone for you on 2.9.0?
Comment #8
alexpottThere's nothing in https://github.com/composer/composer/compare/2.9.0-RC1...2.9.0 that shows why this would have changed. I suspect that you did not actually upgrade the composer on your system and I suspect that our tests are using the system composer and not the composer we ship with.
Comment #9
alexpottYep if I do
composer self=updateand run ./vendor/bin/phpunit core/modules/package_manager/tests/src/Kernel/PhpTufValidatorTest.php it fails.So we need to fix both the test and the test infra where we are using the globally installed composer.
Comment #10
andypostBuilding CI PHP 8.4 dev image with composer 2.9 https://git.drupalcode.org/project/drupalci_environments/-/jobs/7277506
Comment #11
alexpottSo locally
in \Drupal\package_manager\ExecutableFinder so not result in using the local composer... because \Drupal\Composer\Plugin\VendorHardening\Config::$defaultConfig removes the composer bin by default.
Comment #12
alexpott@andypost ideally we'd use the version core is shipping with once composer has done the initial install...
Comment #15
andypostCreated separate MR to try updated CI image with real composer 2.9.1
Comment #19
longwaveI can reproduce locally after upgrading Composer inside ddev.
I tried adding
'audit.block-insecure' => FALSE,to setUp() in the test but I getMight be worth waiting for https://github.com/composer/composer/issues/12607, if enabling
COMPOSER_NO_AUDITis respected then perhaps we do that for the purposes of the test.Comment #20
longwaveAlso opened https://github.com/composer/composer/issues/12611 as I don't see why
composer config audit.block-insecure falseisn't allowed if we are going to go down that route.Comment #21
catchComment #22
andyposthttps://github.com/composer/composer/releases/tag/2.9.2 is tagged
building 8.4-dev image for it
Comment #23
andypostComment #24
longwavePhpTufValidatorTest passes locally now we can reconfigure Composer to allow insecure packages.
Comment #25
smustgrave commentedLGTM
Comment #26
alexpottI agree with @andypost we shouldn't be changing the removal of the composer bin file here. I think we should open a follow-up issue work out how we can can this for tests.
Comment #27
longwaveReverted the vendor hardening change, although I think if the image is on Composer 2.9.1 or lower then the
audit.block-insecurepart will fail now...Comment #28
longwaveYep:
Comment #30
longwaveComment #31
smustgrave commentedAppears to need rebase.
Comment #32
godotislateRe #19:
Instead of
COMPOSER_NO_AUDIT, they introduced a new envCOMPOSER_NO_SECURITY_BLOCKINGor flag--no-security-blockingin Composer 2.9.2. Maybe using that would work?Comment #33
andyposthttps://getcomposer.org/doc/03-cli.md#composer-no-security-blocking looks needs to be added to
ore/tests/Drupal/BuildTests/Composer/Component/ComponentsTaggedReleaseTest.phpas test failed https://git.drupalcode.org/issue/drupal-3557585/-/jobs/7728580Comment #34
godotislateTests are all passing on composer 2.9.2, so lgtm.
Comment #37
catchCommitted/pushed to 11.x and cherry-picked to 11.3.x, thanks!
Do we need to backport this more? I'm guessing yes so moving to 11.2 for now.
Comment #39
andypostI think now I can upgrade composer in all (8.1-8.5) CI images and see later if older branches will start to fail
Comment #40
andypostUpgrade for composer and PHP is went in
Comment #41
godotislateYeah, looks like 10.6.x and 10.5.x are failing as well.
https://git.drupalcode.org/project/drupal/-/jobs/7740931
https://git.drupalcode.org/project/drupal/-/jobs/7741745
Comment #44
dwwOpened an MR for 10.6.x: https://git.drupalcode.org/project/drupal/-/merge_requests/14168
core/modules/package_manager/tests/src/Kernel/PhpTufValidatorTest.phponly exists in 11.x.But the fix for
core/tests/Drupal/BuildTests/Composer/Component/ComponentsTaggedReleaseTest.phpapplied cleanly.Let's see what the bot thinks at https://git.drupalcode.org/issue/drupal-3557585/-/pipelines/694106
Comment #45
andypostThanks good idea
Comment #46
dwwHrm. The default pipeline passed, so I didn't break
ComponentsTaggedReleaseTest. But it looks like the daily 10.6.x job only fails in here with the updated dependencies thing, since we're pinned to an earlier composer (I think). So I tried running the updated deps job manually. However, it fails withphpstancomplaining about deprecated stuff from Twig and OpenTelemetry. It doesn't seem there's any way to move forward and have the actual tests run in this case. Seems fairly expected that phpstan will hit deprecation errors with updated dependencies. Can we change thephpstanjob inside the updated deps part of the pipeline to allow failure and only warn on problems but not halt the entire pipeline?Comment #47
dwwOkay, here's some progress to report. Reading through the core scheduled pipelines, looks like 10.6.x daily job is consistently failing with the PHP 8.4 configuration:
https://git.drupalcode.org/project/drupal/-/pipelines/693649
- PHP 8.4: https://git.drupalcode.org/project/drupal/-/pipelines/693679
- Build failure: https://git.drupalcode.org/project/drupal/-/jobs/7767121
So, I launched that same pipeline here:
https://git.drupalcode.org/issue/drupal-3557585/-/pipelines/694128
And the "Build" test is now passing:
https://git.drupalcode.org/issue/drupal-3557585/-/jobs/7773059
Therefore, even without resolving the "updated deps" vs. phpstan woes I mentioned in #46, I think it's safe to call this RTBC and commit the backport...
Comment #48
xjmMaintenance minor releases do receive dependency updates, so 10.6 should also actually update to 2.9.2 itself. This means it presumably also needs the hunk that the 11.x and 11.3 MRs had?
Also, it looks like things are being done out of order here -- this was moved to 10.6 before 11.2 was addressed, which is going to create confusion even though yes 10.6 is bugfix while 11.2 is security-only. Since
composer/composeris still just a dev dependency, there is a strong case to be made that updating it for 11.2 (and 10.5) is not an issue and we should commit it there as well.So, can we get 10.6 to update the dep, and can we get MRs for 11.2 and 10.5? The 11.2 MR should be RTBCed and committed first so that committers don't get totally confused.
Thanks!
Comment #49
xjmComment #52
godotislate11.2.x MR: https://git.drupalcode.org/project/drupal/-/merge_requests/14223
10.6.x MR from #44: https://git.drupalcode.org/project/drupal/-/merge_requests/14168
10.5.x MR: https://git.drupalcode.org/project/drupal/-/merge_requests/14224
Comment #53
smustgrave commentedAre the changes for core/modules/package_manager/tests/src/Kernel/PhpTufValidatorTest.php not needed in 10.5 or 10.6?
Comment #54
godotislatecore/modules/package_manager/tests/src/Kernel/PhpTufValidatorTest.phponly exists in the 11 branch. See #44.Comment #55
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #56
smustgrave commentedComment #57
godotislateI'm skeptical that there's a merge issue, but rebasing the 10.6 MR for bot this one time, but the bot can stay quiet from now on.
Oops cross-posted.
Comment #58
smustgrave commentedthink it just gets confused because it doesn't apply to 11.x
But backport wise looks fine.
Comment #63
andypostSadly we need new issue to upgrade to 2.9.3 as it's a security upgrade https://getcomposer.org/changelog/2.9.3
Comment #65
catchCommitted/pushed the backport MRs to 11.2.x, 10.6.x, and 10.5.x respectively, thanks!
Comment #68
dwwThanks for the commits!
Opened #3565943: [security hardening] Update composer to 2.9.3 for #63.
Needs followup.