-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Is it safe for Dependabot to modify lock files directly? #1285
Comments
We typically don’t modify lockfiles directly - we use the package manager CLI or internals to write the updated lockfile after updating a dependency. In these cases, I think we’ve updated the transitive dependencies to fix known vulnerabilities. I’ll close this for now but let us know if you spot anything unexpected! |
I'm still seeing dependabot open PRs where the only file modifications are the lockfiles. I do not believe dependabot should be doing this, as it likely to cause issues/get out of sync with actual dependencies. |
I'm not sure I follow re: "get out of sync with actual dependencies", the lockfile is what determines which dependencies will be installed right? Depending on how dependencies are set up, updating only the lockfile is often entirely valid. Are you maybe vendoring dependencies? That's something that's not (yet) supported in all ecosystems, it's possible to set up an action or some other CI job that does the vendoring step for you and commit the results back to the branch. If it's something else, if you could link to an example PR that'd be helpful. |
I'm wondering this as well. dependabot updates second-hand dependencies, for example dependency2 below package.json
yarn.lock
|
@JulianKingman could you link to a PR or share a setup we can use to reproduce what you're seeing? |
When updating an indirect dependency in the lockfile, i.e. not a direct dependency declared in the package file, there is no guarantee that the direct packages that rely on it will work correctly. Typically, the indirect dependencies get newer versions as the primary dependencies update to require them. If package A is a primary dependency and requires package B, and there's a security vulnerability with package B, then package A should be updated to a new version that includes the updated package B. Doing this the other way around means that
Tracing through the dependencies to see what package A is from the dependabot alert for package B is a lot of work and is error prone, but seems to be necessary in order to get a guaranteed stable update. It would be more useful if dependabot did this effort as well, instead of crawling only the lockfile. Also, as the original poster mentioned, my understanding is that updating lockfiles directly is not recommended for the reasons I stated. |
I am interested in understanding this too |
Seems like this should still be an open conversation? Dependabot is still modifying lock files only. |
I would like an answer to this too. It was my understanding that configuring dependabot to only allow "direct" dependency updates would prevent lockfile-only updates but it hasn't. |
@Smmaca I think that's correct, except for security updates where Dependabot will prioritize security over everything else and always offer a PR if possible, regardless of configuration. In the Javascript ecosystem, this is essentially what |
We're also seeing this, and would also appreciate an answer. gabrielliwerant's concern is still unanswered, and is a completely valid concern. To me, updating the lock file directly defeats the purpose of having the libraries manage their own dependencies, and is concerning to be out of sync with what the library expects to exist. Note: only the lock file is updated |
I no longer maintain Dependabot but I don't understand the concerns raised.
Generally security updates should never break anything, but rather fix things. Dependabot will only update an indirect dependency (in your example, package B) if the new version satisfies the requirement the dependant package has set on it (package A in your example). For example, if package A declares Also, for what it's worth, Dependabot does not modify lockfiles directly, but uses package managers to do it. For example, for NPM it runs the following command: dependabot-core/npm_and_yarn/lib/dependabot/npm_and_yarn/native_helpers.rb Lines 18 to 46 in 1121a33
|
This may not be the correct place for this question, but wasn't sure where else it should go.
I'm seeing open PRs for the first time from Dependabot on one project. It has two PRs:
In both of those, the only changes are in
yarn.lock
. In both, it's updating versions of transitive dependencies. Not dependencies directly added to the project. In everything I've read about yarn and npm lock files, it says they should not be edited directly. Including the first line ofyarn.lock
itself:My question is, is it safe for Dependabot to do this? We're not seeing anything adverse from the two mentioned PRs, but editing
yarn.lock
directly is something we never do anywhere else so it's raising concerns.The text was updated successfully, but these errors were encountered: