Dependabot should gracefully handle the overrides
field in package.json
#5590
Labels
F: configuration-file
L: javascript:npm
npm packages via npm
T: feature-request
Requests for new features
versioning
🖼️ Context
npm 8.3.0 added support for the
overrides
field inpackage.json
, which allows authors to force sub-dependencies to resolve to specific versions.Example: top-level dependency
foo@^1.3.0
depends onbar@^6.4.1
, which is a vulnerable version. Fortunately there is a patch inbar@6.4.2
. If, however, the author decided to forcebar
to resolve to the vulnerable version in theoverrides
field, it would be impossible to resolve the vuln. (This is precisely what happens withnpm audit fix
, i.e., it fails to fix the vuln.)When such an example is given to the dry-run script, Dependabot believes a fix is possible by updating from
bar@6.4.1
tobar@6.4.1
, and creates a PR stating as much, which is obviously nonsense.While this is unlikely to come up often and is arguably user error, Dependabot should still gracefully handle this field.
There 2 situations where we would definitely want to raise an
update not possible
error:Those situations make sense to error with
update not possible
, but what if a an override is used to lock a non-vulnerable dependency to a non-vulnerable version?Example: non-vulnerable sub-dependency
B
of some vulnerable dependencyA
is overridden to a non-vulnerable version.Opening a PR in this situation could help maintainers fix vulnerabilities quicker, even if it doesn't work.
But it might still be appropriate to raise
update_not_possible
because anoverrides
entry is still preventing a security update, the only difference being the blocked dependency is the parent rather than the sub-dependency itself.Seeing a failure indicating that use of the
overrides
field prevented a security update of the vulnerable parent is explicit and doesn't require having to figure out why Dependabot opened a PR with a potentially empty diff to update the parent from2.5.1
to2.5.1
.Anyhow, here's a scenario where Dependabot might still want to open a PR with an override present:
Example: some dependency
A
receives a version update and has a sub-dependencyB
that is overridden to an older version. Would we still want to raise anupdate not possible
error on the version update forA
?✅ Tasks
overrides
field inpackage.json
update_not_possible
with descriptive error messageThe text was updated successfully, but these errors were encountered: