Dependencies are locked Lock dependencies and Composer is pinnedpin Composer
- Comparing
- v1 to v2
- Current
- Read the document
Context
composer.lock is gitignored, and every CI job runs composer self-update && composer install && composer dump-autoload. Each run resolves dependencies freshafresh, against a Composer binary that also movesmoves as well. A transitive
release can turn the build red overnight with no local change, and PHPStan or php-cs-fixer can behave differently
differently in CI CI
than they do locally.
Committing the lock file is the standard, recommended practice for a project: everyone who sets up the projectproject up, CI
included, then runs on exactly the same dependency versions.
Decision
I will commit composer.lock is committed, and have CI installs install from it with composer install --no-interaction --no-progress. CI
runs will run a pinned Composer version, matching the same one used locally, and the pin is changed will only change deliberately.
Alternatives
Resolving dependencies fresh afresh on every CI run, with the lock file ignored and Composer self-updatedupdating itself first. It lets
builds I
rejected this because it lets a build break with no local change, and lets tools behave differently in CI than they do
locally.
No other arrangement was weighed.
Consequences
Easier:
- Every CI job will install the
dependencyversions in the committed lock file, the same ones used locally, soaa build willnotnot break without a local change and tools will behave the same in CI as they do locally. - CI will no longer need
composer dump-autoloadwill no longer be needed in CI, sincecomposer installgenerates the autoloader.
Harder:
- Updating Composer will be a deliberate change to the pin. A vulnerable Composer will stay pinned until
someone movessomeone moves it, so Composer's security releases will need acting on.
Constrained:
DeclaredThe declared lower bounds of dependencies will not be tested. A--prefer-lowestmatrixleg, keepingleg to keep themhonest, willhonest will be aseparateseparate change.
Sources
- PR #50, chore(engine): Tooling, CI and documentation cleanup, opened and merged ,
squashed assquashed as 54dcfb0: the problem, the decision, the alternative and the consequences other than Composer'ssecuritysecurity releases.. Its commit message and diff record the lock file and pin changes.createdis when it was openedandanddecidedwhenwhen it merged. - PR #75, chore: Rename package, add licence and patch Composer CVE, merged and squashed as 3372f20
: the: the consequence for Composer's security releases, taken from what followed rather than anticipated. It movedthethe pinfromfrom 2.9.3 to 2.10.3 because 2.9.3 is inside the range affected by CVE-2026-84361, which had left CIrunningrunning aComposerComposer open to arbitrary command execution through a package's Perforce source URL. - Composer documentation, Basic usage, "Commit your composer.lock file to version control", read : committing the lock file as the standard practice for projects, and why.
Source adr/0015-locked-dependencies.md · commit 9444a99 · published