Skip to content

[BUG] "npm approve-scripts --allow-scripts-pending" shows approved depdencies #9558

@calle2010

Description

@calle2010

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

This is not just a request to bump a dependency for a CVE

  • This is not solely a request to bump a dependency for a CVE

Current Behavior

I run npm 11.17.0

I have added this to package.json:

    "allowScripts": {
        "[email protected]": true,
        "@sap/[email protected]": true,
        "[email protected]": true,
        "[email protected]": true,
        "[email protected]": true,
        "[email protected]": true,
        "[email protected]": true,
        "[email protected]": true
    }

The output of "--allow-scripts-pending" is:

$ npm approve-scripts --allow-scripts-pending
5 packages have install scripts not yet covered by allowScripts:
  @sap/[email protected] (install: node checkbuild.js)
  [email protected] (postinstall: node install.js)
  [email protected] (install: node install cloud-mta-build-tool)
  [email protected] (install: node-gyp rebuild)
  [email protected] (postinstall: node ./lib/post-install.js)

Run `npm approve-scripts <pkg>` to allow, or `npm deny-scripts <pkg>` to deny.

The same output appears for "npm install" or "npm ci".

When I remove the allowScripts section and run npm approve-scripts --all, only three packages are added to package.json:

$ npm approve-scripts --all
Approved esbuild:
  added [email protected]
Approved protobufjs:
  added [email protected]
  added [email protected]

This is in a workspace root. For the omitted dependencies I can see no clear picture: devDependencies from root, devDependencies from workspaces, prod dependencies from workspaces.

Expected Behavior

  • npm approve-scripts --allow-scripts-pending should not list already approved dependencies
  • npm approve-scripts --all should add all listed dependencies to allowScripts in package.json

Environment

  • npm: 11.17.0
  • Node.js: 22.21.1
  • OS Name: Linux
  • System Model Name: x86_64 GNU/Linux
  • npm config:
; "project" config from /home/wsl/git/redacted/.npmrc

engine-strict = true
min-release-age = 3

; node bin location = /home/wsl/.local/share/fnm/node-versions/v22.21.1/installation/bin/node
; node version = v22.21.1
; npm local prefix = /home/wsl/git/sol24c-main
; npm version = 11.17.0
; cwd = /home/wsl/git/redacted
; HOME = /home/wsl
; Run `npm config ls -l` to show all defaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next steps

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions