Problem/Motivation
https://github.com/twigphp/Twig/releases/tag/v3.27.0
Twig once again has security vulnerabilities and Drupal pins the vulnerable versions, preventing composer from installing or updating Drupal.
Problem 1
- Root composer.json requires drupal/core-recommended ^11.3.10 -> satisfiable by drupal/core-recommended[11.3.10].
- drupal/core-recommended 11.3.10 requires twig/twig ~v3.26.0 -> found twig/twig[v3.26.0] but these were not loaded, because they are affected by security advisories ("PKSA-fbvq-z33h-r2np", "PKSA-g9zw-qxh8-pq8w", "PKSA-yd6k-t2gh-1m43", "PKSA-1tmc-rt7x-12w6", "PKSA-xx6c-6d96-db2w"). Go to https://packagist.org/security-advisories/ to find advisory details. To ignore the advisories, add them to the audit "ignore" config. To turn the feature off entirely, you can set "block-insecure" to false in your "audit" config.
Steps to reproduce
- Install Drupal core using
drupal/core-recommended11.3.10. - Run:
composer audit - Observe the vulnerabilities reported for twig/twig.
- Run:
composer update twig/twig -W - Observe that Composer cannot resolve dependencies because the vulnerable version is pinned by
drupal/core-recommended.
Proposed resolution
Update the pinned twig/twig version in
drupal/core-recommended to a non-vulnerable release: v3.27.0
Also, we should consider what to do if this keeps happening more frequently. With AI being used more and more to find vulnerabilities, it's likely that the frequency of vulnerability fixes will increase.
Workaround
composer require "twig/twig": "v3.27.0 as v3.26.0"
Issue fork drupal-3592382
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:
- 3592382-update-twig-3.27-10.5.x
changes, plain diff MR !15898
- 3592382-update-twig-3.27-11.2.x
changes, plain diff MR !15896
- 3592382-update-twig-3.27-10.6.x
changes, plain diff MR !15897
- 3592382-update-twig-3.27-11.4.x
changes, plain diff MR !15894
- 3592382-update-twig-3.27-11.x
changes, plain diff MR !15893
- 3592382-update-twig-3.27
changes, plain diff MR !15892
- 3592382-update-twig-3.27-11.3.x
changes, plain diff MR !15895
Comments
Comment #3
godotislateTested patch locally, works against main.
Diff does not apply to 11.x, so there'll likely need to be separate MRs for backports.
Comment #10
godotislateMRs for main, 11.4.x, 11.3.x, 10.6.x all look good and passed.
lgtm, though we can rerun those jobs just in case.
Comment #17
longwave11.2 looks like random failures, rerunning
Comment #18
catchCommitted/pushed everything to the respective branches except the 10.5 MR which appears to have unrelated version changes in components.
Edit: so does 11.2.x but I apparently did not spot that one, reverted just until it's confirmed that should actually happen or for it to be fixed.
Comment #25
godotislateI think 10.5 and 11.2 have additional changes because they weren't set back to dev previously?
Comment #28
godotislateYeah, there are no "Back to dev" commits on 11.2.x or 10.5.x after 11.2.12 and 10.5.10.
Comment #30
longwaveI think the merge part of the security tagging script doesn't quite do the correct thing in all cases. This means that 11.2.x and 10.5.x didn't correctly get their various
composer.jsons reverted to the dev version. The changes in these branches bring them back in line with how they should be compared to the other branches, so this is the correct thing to do in order for us to do normal patch releases of all branches to bump the dependencies.Comment #34
catchOK clarified that while the 11.2 and 10.5 MR changes were a slight oddity due to the security-only status of 11.2 and 10.5 and previous security releases, that they do in fact get us to the right place.
Committed/pushed to 11.2.x and 10.5.x, thanks!
Comment #36
solideogloria commentedUpdated to have a more useful issue summary that includes info about the vulnerabilities and the workaround.
Comment #40
solideogloria commented