Skip to content

[BUG] npm won't update to higher version of package allowed by constraints, preventing security patching #7356

Closed

Description

@G-Rath

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

For some reason when installing netlify-cli, npm decides to use a slightly lower version of follow-redirects and word-wrap which have known security vulnerabilities even though the version constraints allows the patched version:

❯ npm ls word-wrap follow-redirects
[email protected] /home/jones/workspace/projects-scrap/netcheck
├─┬ [email protected]
│ └── [email protected]
├─┬ [email protected]
│ ├─┬ @netlify/[email protected]
│ │ └─┬ [email protected]
│ │   └─┬ [email protected]
│ │     └─┬ [email protected]
│ │       └─┬ [email protected]
│ │         └── [email protected]
│ └─┬ [email protected]
│   └── [email protected]
└─┬ [email protected]
  └── [email protected]

No matter what I do I can't get more information about why these lower versions are being used and doing npm update for these packages does nothing (having tried with all kinds of combos of "removing node_modules", "remove lockfile", "remove both", "remove ...")

npm audit also reports these vulnerabilities and says they're fixable but npm audit fix does nothing.

Expected Behavior

The latest version allowed by the constraint is used, especially when doing an explicit npm update <package>.

Steps To Reproduce

  1. install netlify-cli
  2. run npm audit
  3. run npm audit fix
  4. run npm update follow-redirects
  5. etc

Environment

  • npm: 10.5.1
  • Node.js: 20.11.0
  • OS Name: Ubuntu 20.04
  • System Model Name:
  • npm config:
❯ npm config ls
; "user" config from /home/jones/.npmrc

audit = false
fund = false

; node bin location = /home/jones/.nodenv/versions/20.11.0/bin/node
; node version = v20.11.0
; npm local prefix = /home/jones/workspace/projects-scrap/netcheck
; npm version = 10.5.1
; cwd = /home/jones/workspace/projects-scrap/netcheck
; HOME = /home/jones
; Run `npm config ls -l` to show all defaults.

Activity

  1. added
    Bug
    Needs Triage
    on Apr 9, 2024
  2. wraithgar commented on Apr 11, 2024

    @wraithgar
    Contributor

    netlify-cli ships with an npm-shrinkwrap.json file. You won't be able to change any of its subdependencies, they will have to publish a new version with an updated shrinkwrap.

    More info on shrinkwraps can be found at: https://docs.npmjs.com/cli/v10/configuring-npm/npm-shrinkwrap-json

  3. G-Rath commented on Apr 11, 2024

    @G-Rath
    ContributorAuthor

    @wraithgar sorry about that - I knew as I reported this it'd be because of shrinkwrap because that was the only thing I hadn't checked, but was a bit burnt out and didn't think shrinkwarps were in use that much these days (this is actually I think the first time I've seen one in the wild) 😓

  4. wraithgar commented on Apr 11, 2024

    @wraithgar
    Contributor

    npm has been my primary job for YEARS and it still took me 10 minutes to figure out. Don't feel bad. We all miss easy things every day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNeeds TriageRelease 10.x

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions