-
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
An entry in go.sum does not represent a dependency #4740
Comments
Is this a security alert or a PR bumping an outdated package? I think this repo is just for the logic for bumping outdated deps and issues with security alerts are supposed to be reported elsewhere (I have no idea where unfortunately). That said, we hit the problem with As long as you're using Additionally, the |
Yeah @jeffwidman is right that the alerting logic is not based on the code in dependabot-core here, but I will make sure to point the team that works on alerts at this issue though. |
@08d2, you are correct that that go.mod file does not represent a dependency graph, and that it includes modules that were downloaded only to compute the dependency graph. Specifically, the go.sum file contains two kinds of entries: regular entries, which indicate that the .zip file of the module is needed during the build, and You might argue that the module dependency graph is a crude overapproximation of the set of packages used in the build, and that it gives rise to infeasible dependency paths---and you would be right. However, a package-level dependency analysis would require a totally different approach---and it too would produce infeasible paths at function granularity. It would be an interesting project to build a Go-specific tool that computed the set of vulnerable dependencies using the finest available dependency information, perhaps based on a call graph. [Update: govulncheck now exists.] |
It's important to be clear, here: |
The alerts I saw were part of |
You're absolutely right, but the architecture of GitHub's dependency computation system assumes that the graph is expressed in a small number of manifest files, so running go list on the actual Go source is out of the question. |
So, concretely, GitHub's (apparently opt-out) Dependabot feature created false-positive "security alerts" in my repo, based on some entries in a go.sum file file in a subdirectory somewhere. I think these false positive alerts are really bad and need to be fixed! 😬 And I think it's bad enough that if the only way to fix them is to disable Dependabot for Go altogether, that's preferable to the current state. |
I agree that false positives are frustrating, especially if they cannot be easily dismissed. There are several ways we could resolve this:
Which approach is best depends on the answer to these questions:
I don't know the answer to either question, but perhaps our product folks do. [Update: I'm talking about Dependabot Alerts, not the more sophisticated Dependabot core. Thanks @jurre for clarifying.] |
IIUC, running So in that case, it probably makes sense to disable the scanning of the |
This is confusing to me. As far as I understand, go.sum is, factually, not a manifest file — it has at best a correlative relationship to its module's dependency graph. Is that not true? |
IIUC go.mod file always defines the deps required to build the module, invariant of version. |
Yes, but previously it didn't necessarily list all the So previously a security scanner couldn't merely scan what was listed in in Stepping back, from the POV of a security scanner, walking the dep tree often simply wasn't feasible, especially since they'd still struggle to identify which indirect deps made it into the final binary and which were only used by intermediate modules. That's why the scanners used Now with So now So this makes the job of a security scanner much easier, since they can directly use I should caveat this with the disclaimer that I'm not part of the go team, and this stuff is complicated, ie, I could be mistaken. The best resource I've found was the design doc for the module graph pruning feature that @bcmills put together here: golang/go#36460 |
Going into possible solution mode here. So it's important to note that there are different systems in play here, that have different properties:
1 and 2 can't reasonably do any complicated computation given our current architecture, but for 3 we run complicated computation all the time. We actually already run We could look into closing the alert when Dependabot Updates attempts to bump the alert that was generated for this dependency but the dependency doesn't appear in the This still leaves users with some noise to deal with, as they'd get notified about the alert being opened etc, but it might end up being a better experience? There's a risk here that if we somehow fail to detect the dependency in dependabot-core/dependabot updates, but it does actually exist in the repo, we now close out a valid alert, so we'll need to be careful of we decide to go this route. Just wanted to amplify that the problem we're describing here is not with dependabot-core. I'll keep the thread open here because the conversation is really interesting and I don't want to kill it by asking everyone to move to a different place. |
I think @08d2 is right that treating a go.sum file as a manifest is not helpful because the set of spurious zip (non-/go.mod) entries in it grows quickly with project size. The issue is that the go.mod file doesn't distinguish production and test-only dependencies, and this problem compounds recursively, so if one of your dependencies has huge tests, your go.sum file will enumerate them (and their dependencies) even though this code isn't relevant to your build. Until go1.17-style go.mod files are more widespread, we have a choice of basing our graph on go.mod (currently an underapproximation) or go.sum, an overapproximation. (Unfortunately the architecture of DG doesn't allow us to look at both files in conjunction--otherwise we could use go.sum for older versions and go.mod for later versions.) Users were unhappy with the underapproximation leading to missed vulnerability alerts, and now a user is unhappy with the overapproximation. I tend to think analysis tools should be precise or be silent. Users get justly frustrated by false positives and learn to ignore them. False negatives carry a risk too, but at least users know the tools are serious and act on their advice. I propose that we disable go.sum support in DG, or at least stop using it as a basis for alerting. |
Thanks for these comments, they're educating! I concur with @adonovan, false negatives are far preferable to false positives.
Do you mean the GitHub Dependency Graph available under the insights tab? I see that go.sum is (incorrectly) used as a source of truth for that feature — maybe this is the underlying problem. Do you know where I can file an issue for that? I poked around a bit but couldn't find the corresponding repo or project... |
Exactly; as @jurre pointed out, DG is the source for Dependabot Alerts. I don't know if it's exposed as a product with its own issue tracker. I will ask internally. |
👋 from the Dependency Graph team. We're aware of this now and coming up with an acceptable short-term solution. The false positive alerts are frustrating; we'll see what we can do to address this. |
Usually the easiest thing is to go through the support team, as the dependency graph codebase is not publicly available. But given that the team is already engaging in this issue, I think you're good for now 👍 |
Hi there, was this issue resolved in dependabot? Based on the open state, I assumed it was not; however, I recently resolved an instance of this advisory: GHSA-c3h9-896r-86jm After resolving it, I noticed that dependabot marked it as fixed, even though my go.sum still has this line: Although this checksum exists in my |
The previous PR which fixes this did not actually remove the bad version from the go.sum file. Funny story, go.sum is not really a list of deps included in the actually binary, its more of a manifest that go used to walk the dep tree. Dependabot will sometimes improperly use this as the source of truth which is not 100% correct. I am not 100% sure if that is what is happening here, but it def could be because the final binary is only including 1.3.2 of protobuf. The reason this wasnt cleaned up is that go 1.15's `go mod tidy` does not do as good of job of cleaning up the go.sum as 1.16. I have modified my patching scripts to delete the go.sum along with the vendor dir and regenerate it instead. ref: dependabot/dependabot-core#4740
The previous PR which fixes this did not actually remove the bad version from the go.sum file. Funny story, go.sum is not really a list of deps included in the actually binary, its more of a manifest that go used to walk the dep tree. Dependabot will sometimes improperly use this as the source of truth which is not 100% correct. I am not 100% sure if that is what is happening here, but it def could be because the final binary is only including 1.3.2 of protobuf. The reason this wasnt cleaned up is that go 1.15's `go mod tidy` does not do as good of job of cleaning up the go.sum as 1.16. I have modified my patching scripts to delete the go.sum along with the vendor dir and regenerate it instead. ref: dependabot/dependabot-core#4740
This issue is still not resolved. I just got a slew of Dependabot alerts across tons of repositories due to a go-yaml release. However, none of the repositories require go.pkg.in/yaml(.v2|v3) directly themselves, they're just part of the go.sum because a dependency might be using it. |
What we're left with is essentially telling users to close all alerts coming from |
After I last commented on this issue I joined the Dependabot team, so I’m now privy to internal discussions on this (and have a personal interest in getting it resolved). Folks internally here at GitHub are well aware of this issue, and in agreement that it’s frustrating and we’d like to resolve it. From a technical perspective, the quick solution is to disable Another option is doing a version check before choosing whether to ingest We’re still researching the metrics to see how many users would be impacted, as well as the rate of change of how fast they’re moving to At some point we’ll pull the plug on |
The release of Go 1.19 earlier this month signaled the official end-of-life of 1.17 (and below). I understand things are not always so simple, but if the core language team has dropped support for a version, I think it's entirely reasonable for anyone in the ecosystem to do the same. |
|
Note that |
Thanks for the update, @jeffwidman. I think what @adonovan wrote in #4740 (comment) is pretty much what I am thinking should be done too, but ultimately I don't know which of your important users prefer false positives over false negatives. To add to what @bcmills said: Go 1.17.x is already deprecated as a Go versions for developers to use, as Go only backports fixes to the two latest versions per the release maintenance policy. But like Bryan says, this does not mean that Go modules declaring much older versions like For the reasons above, plus the Go toolchain's backwards compatibility with older |
I appreciate everyone chiming in. At my previous company I primarily worked in Yes, ideally we could only scan The good news is we actually pulled the metrics yesterday, and I was pleasantly surprised how many repos were already on I can't share a whole lot more at this time, but know that we do see this as annoying, and we are looking toward fixing it. For those looking to leave more comments about how annoying this is, the best thing you can do is 👍 the initial comment. Adding "me too" just spams everyone watching this issue for updates. |
I think this could apply to Go ecosystem changes as well - update your What is surprising to me is that dependabot can't/doesn't parse the actual dependency files, when it does parse the Probably the most flexible method is described by @hedhyw:
GitHub is entirely in control of this configuration schema. I can already see fields that can be used, including:
|
This is a good point. The version specified in the go.mod is more of a upper bound for language features than it is a toolchain requirement. |
I think where we've arrived is that # go.mod
require (
- golang.org/x/crypto v0.5.0
+ golang.org/x/crypto v0.6.0
) but your # go.sum
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc=
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= Discovering dependencies (incorrectly) by using
|
👋 Hi folks! Dependency graph no longer ingests |
Could anyone link the PR that fixed this issue? |
@katexochen Hi! This was resolved in the dependency graph code base, which is not public. |
I have just received Dependabot alerts based on entries in a go.sum file in my repository. But an entry in go.sum does not represent a dependency of my project, it represents a module that the Go toolchain had to verify when computing the dependency graph.
The text was updated successfully, but these errors were encountered: