Skip to content

[Feature] ability to install packages with at least X days since publication #4494

@osher

Description

@osher

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

We're in work on FedRAMP certification, and there's a stormy debate about dependency scans and dependency vulnerabilities. Here's how it relates to you:

Currently, npm i and npm update will install the latest version of a depenency (or the latest according to the policy in package.json) - even if it was published just now.
Published just now - could also be - published with a new vulnerability that is yet to be reported.

e.g.

  • a package ownership was compromised and loaded with malicious code.
  • a package was just published with an exploit

Expected Behavior

Ideally, I would like to run npm i in a new project, or npm update in an existing project, and get all the dependencies that have had at least X days or more since their publication date.
My security team currently names 7, but teams should be able to can bring their own policy over some built-in default.

Basically,
This 7 or X can come from a global setting, from a project's .npmrc, from CLI args, from env-var - whatever you decide to support.

Ideally, there should be a form to configure such an X to a pattern in package name (e.g. starts with a prefix, belongs to a scope, or a concrete name) - but that's already high-end customization, way past the MVP of this feature.

When the policy of version-range that offers only too-new versions - I suppose I'd like a message about it, and it should be possible to control the npm exit code for this case.

Steps To Reproduce

Well, it's a feature request... I'll describe the usage

npm config set stabilityDays 7
npm config set '@my-corp/*.onOnlyTooNew' warn
npm config set '@my-corp/*.stabilityDays' 1
npm config set '@my-corp/*.onOnlyTooNew' info
npm config set package-that-gave-problems-before.stabilityDays 90
npm config set 'package-that-gave-problems-before.onOnlyTooNew' error

and then:

npm update

Can conisder to distinct npm config -g or something to distinct project settings and global settings.

Sure, this is a big one, and this might call for a discussion.
I hope this helps.

Environment

  • npm: any
  • Node.js: any active or LTS version
  • OS Name: all
  • System Model Name: all
  • npm config:
; copy and paste output from `npm config ls` here

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 8.xwork is associated with a specific npm 8 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions