Skip to content
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

[gomod] Support updating indirect dependencies #6361

Merged
merged 5 commits into from
Jan 4, 2023

Conversation

mctofu
Copy link
Contributor

@mctofu mctofu commented Dec 23, 2022

This is an improved take on an earlier spike I did to support updating indirect dependencies in a security update. This allows updating indirect dependencies that are listed in the go.mod file in either version or security updates. Dependencies that are only included in the go.sum and not the go.mod still can't be updated but using the go 1.17+ go.mod file any used indirect dependencies should be contained in the go.mod.

For version updates, the default allow filter is to only update direct dependencies so indirect dependencies will only be updated if a user configures their dependabot.yml to do so.

A benefit over my previous attempt is that this approach maintains the indirect dependency distinction so using the https://github.com/dependabot/fetch-metadata to inspect the commit metadata for the PR will correctly indicate an indirect dependency is being updated.

Another edge case I ran into with bdb3ae3 is that we previously parsed "replaced" dependencies but removed their requirements. That caused us to treat them as indirect dependencies and not attempt to update them. I've preserved the behavior of not updating replaced dependencies (until we can implement a way to properly update them) by skipping them during the file parsing step.

The go smoke test is currently failing but that's expected. It needs to be updated to:

  • Use the default allow condition so indirect deps aren't updated
  • Update the expectation for the submitted dependency list which will now include indirect deps but exclude replaced deps.

@mctofu mctofu force-pushed the mctofu/go-transitive-security-updates branch from 3f7b8c8 to 3727e08 Compare December 23, 2022 22:37
@mctofu mctofu changed the title Mctofu/go transitive security updates [gomod] Support updating indirect dependencies Dec 23, 2022
@mctofu mctofu marked this pull request as ready for review December 23, 2022 22:56
@mctofu mctofu requested a review from a team as a code owner December 23, 2022 22:56
Copy link
Member

@jakecoffman jakecoffman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me!

mctofu added 5 commits January 4, 2023 11:56
We previously prevented updating replaced dependencies by treating them
as indirect dependencies which we didn't support updating. Now that
indirect updates are supported we still don't want to update replaced
dependencies till we can properly support them.
@mctofu mctofu force-pushed the mctofu/go-transitive-security-updates branch from bdb3ae3 to cddd02a Compare January 4, 2023 19:56
@mctofu mctofu merged commit 18d6094 into main Jan 4, 2023
@mctofu mctofu deleted the mctofu/go-transitive-security-updates branch January 4, 2023 21:38
@jeffwidman
Copy link
Member

For version updates, the default allow filter is to only update direct dependencies so indirect dependencies will only be updated if a user configures their dependabot.yml to do so.

👍 Thanks for clarifying this, it was my one question after looking at the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants