-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] ability to install packages with at least X days since publication #4494
Comments
You can already run |
@ljharb - if that works - that's just might be what I need! From what version is that? I cannot find it in the docs. If it works - then treat this issue as a request to update the docs: https://docs.npmjs.com/cli/v8/commands/npm-install and a proposition for thinner config control |
I think since npm 5 something? It’s been there for a long time (it can be controlled by .npmrc and env vars) |
@ljharb - thanks that's very helpful Now that you mentioned it - all I could find is this:
Line 11 in 940ba87
Which , really, enjoy-by ? I would have never guessed... 😛
and I am searching hard... So lets take it to the next level. It gets more complicated when I want dependencies of my proprietary packages to answer to this policy, even when my proprietary packages "get a free pass". Got an ace there for me? |
No, i think you have to choose all or nothing with this approach. Ab alternative approach is configuring your internal registry to wait a period of time before “releasing” things it’s downloaded from the public registry. |
aha. finally found where it appears in the docs: Still could not find a word on such option on artifactory's docs - any help will be appreciated. Anyway, this all-or-nothing thing kinda pulls the sting out of this feature 😢 I can't even think of a monkey-patching I can do to get latest fixes for corporate packages and deny the rest. How about the opposite? Anyway, that's what I got for today, any help will be appreciated! |
It's entirely possible artifactory doesn't support it; you'd need to file an issue with them for that. My personal opinion tho is that all of this is unnecessary, and the few times "waiting a day or two" would have helped in the last decade don't outweigh the billions of times immediate updates offer benefits :-) but i understand it may not be your decision. I think that what you could do is |
You're right - it's not my decision, it's a security policy I'm trying to comply with, no say there. So far, until this requirement fell down, we worked without a lockfile: when a version was packed into a docker - it was during CI and treated like a testable proofable binary: scanned, functional-tested, integration-tested and black-box e2e. With our coverage we're confident with using greatest and latest in everything except what vitally had to be pinned for a breaking change or a known vulnerability - which is followed up by the team with issues of technical debt until they are unpinned. Now, on this comes the requirement to include latest of the corporate-packages, and 7 days old for the rest, taking that 7 days is legit delay for exploits to be noted. I'm completely aware that such npm feature will not be developed fast enough for us even if the request will be adopted by npm. But I believe the usecase is sound. Anyway. To our business - I'm probably missing something.... I'm trying to think how can I use what you just showed me: Say we detected some public packages were recently updated. |
Every application always needs a lockfile; that's a long-standing best-practice. |
|
@ljharb - lockfile is not a best practice. lockfile is a recipe for technical debt. Which IMHO a by far a better alternative to the noise of dependency bots create. Obviously, if you don't have the coverage you do not have the guarantees - so you should stick to the lockfile until the project is mature enough. |
@osher a lockfile is a requirement for an application to be mature; you are free to disagree with the rest of the industry, but it doesn’t change anything. |
Is there an existing issue for this?
This issue exists in the latest npm version
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
andnpm 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.
Expected Behavior
Ideally, I would like to run
npm i
in a new project, ornpm 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
and then:
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
; copy and paste output from `npm config ls` here
The text was updated successfully, but these errors were encountered: