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

x/vuln: decentralized option #54982

Open
willfaught opened this issue Sep 9, 2022 · 13 comments
Open

x/vuln: decentralized option #54982

willfaught opened this issue Sep 9, 2022 · 13 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. vulncheck or vulndb Issues for the x/vuln or x/vulndb repo

Comments

@willfaught
Copy link
Contributor

(This is a suggestion, which the Go blog post about vuln asked for and linked to here, so I'm ignoring the issue template.)

While I like that vuln reports are tailored and cleaned up by the Go Team, I think the community would be best served with an option for a decentralized solution, at least as a fallback, similar to how the module proxy and sum database work.

Module authors should be able to publish their own vuln determinations as part of the module or package itself, and those publications should be able to be extracted as part of the module/package info. That way the community isn't reliant on the Go Team to communicate and manage vulns.

@willfaught willfaught added the vulncheck or vulndb Issues for the x/vuln or x/vulndb repo label Sep 9, 2022
@gopherbot gopherbot added this to the Unreleased milestone Sep 9, 2022
@seankhliao
Copy link
Member

seankhliao commented Sep 9, 2022

This fallback already in place, see package docs:

Set the GOVULNDB environment variable to specify a different database, which must implement the specification at https://go.dev/security/vuln/database.

@seankhliao
Copy link
Member

The distributed mechanism is to publish retractions.

Vulnerability reporting relies on somewhat centralized CVE IDs to allow communication between different parties, a fully decentralized option doesn't make sense here.

@seankhliao
Copy link
Member

cc @golang/vulndb

@zpavlinovic zpavlinovic modified the milestones: Unreleased, vuln/unplanned Sep 9, 2022
@zpavlinovic zpavlinovic self-assigned this Sep 9, 2022
@zpavlinovic
Copy link
Contributor

As mentioned earlier, users can provide other vulnerability databases to govulncheck via GOVULNDB environment variable.

@zpavlinovic zpavlinovic modified the milestones: vuln/unplanned, vuln/2022 Sep 9, 2022
@willfaught
Copy link
Contributor Author

I wasn't clear, I think. I don't mean in the sense of GOPROXY=myproxy, I mean in the sense of GOPROXY=direct. Basically, have a way for module authors to declare vulns in modules themselves, identified by commit hash or version, e.g.

module example.com/foo

go 1.19

vulnerability {
  versions: v1.2.0...v1.2.9, v1.2.11
  description: "My description"
  method: Bar.Baz
}

@willfaught
Copy link
Contributor Author

Common identifiers can be derived from the module and vulnerability info, e.g. the example.com/foo:Bar.Baz:v1.2.0...v1.2.9,v1.2.11 vulnerability. Or maybe there's a naming convention like

module example.com/foo

go 1.19

vulnerability 2022-09-09 {
  versions: v1.2.0...v1.2.9, v1.2.11
  description: "My description"
  method: Bar.Baz
}

Vulnerability example.com/foo:2022-09-09.

@seankhliao
Copy link
Member

That was what eventually became the retract directive: #24031

@zpavlinovic
Copy link
Contributor

I believe this would need to go through a formal proposal process with pros, cons, motivation, etc.

@willfaught
Copy link
Contributor Author

willfaught commented Sep 9, 2022

That was what eventually became the retract directive

Thanks for pointing me to that.

  • It looks like the retract directive is ignored by Go 1.15 and earlier:

    Go 1.15 and lower will report an error if a retract directive is written in the main module’s go.mod file and will ignore retract directives in go.mod files of dependencies.

    Wouldn't that be an issue when using the vuln tool for those Go versions?

  • Retractions don't seem to be necessarily considered a security concern by the vuln tool/database, and aren't considered unless you upgrade the package manually or by Minimum Version Selection to a version that has the retraction

  • Retractions don't flag particular functions/methods, as the vuln tool/database does

I believe this would need to go through a formal proposal process with pros, cons, motivation, etc.

If this is true, then we should fix the Go blog post to not point users to make vuln suggestions here by creating an x/vuln: issue. This isn't meant to be a suggestion in the formal Go proposal process sense.

@zpavlinovic
Copy link
Contributor

zpavlinovic commented Sep 9, 2022

If this is true, then we should fix the Go blog post to not point users to make vuln suggestions here by creating an x/vuln: issue. This isn't meant to be a suggestion in the formal Go proposal process sense.

I should have been more precise. My mention of the formal proposal process was in response to the suggested change

module example.com/foo

go 1.19

vulnerability 2022-09-09 {
  versions: v1.2.0...v1.2.9, v1.2.11
  description: "My description"
  method: Bar.Baz
}

which would also require modifications to the specification and handling of go.mod files. However, we can choose a different way to implement this.

My concern is that this would add an extra maintenance burden on the programmers so this would ultimately not be able to completely replace the existing approach. Or maybe it is not supposed to?

@willfaught
Copy link
Contributor Author

My concern is that this would add an extra maintenance burden on the programmers

I think this would actually be simpler for module owners. Instead of figuring out how to report a CVE, a GHABCDEFwhateverthisis, submit a report to the official Go vuln database, etc. etc., they can simply report the problem in go.mod, and the toolchain automatically surfaces the problem when others try to build with it. All the info is contained within the module itself, and published as one unit.

I guess the go tool would have to consult the latest version for vuln retractions regardless of what the minimum version selected for builds is.

so this would ultimately not be able to completely replace the existing approach

Which approach do you mean? The new vuln stuff?

@zpavlinovic
Copy link
Contributor

My concern is that this would add an extra maintenance burden on the programmers

I think this would actually be simpler for module owners. Instead of figuring out how to report a CVE, a GHABCDEFwhateverthisis, submit a report to the official Go vuln database, etc. etc., they can simply report the problem in go.mod, and the toolchain automatically surfaces the problem when others try to build with it. All the info is contained within the module itself, and published as one unit.

I guess the go tool would have to consult the latest version for vuln retractions regardless of what the minimum version selected for builds is.

so this would ultimately not be able to completely replace the existing approach

Which approach do you mean? The new vuln stuff?

Yes, the current approach with a vulnerability database.

@tatianab @jba @neild

@willfaught
Copy link
Contributor Author

willfaught commented Sep 10, 2022

I would say that a decentralized approach would be a good basis, but you'd also want users to be able to specify a database they trust (defaulting to the Go Team's) for issuing vuln retractions on behalf of module owners, like if module owners are too slow to do it.

Perhaps if vuln retractions are cached in go.sum or something comparable to prevent bad actors from undoing module-based retractions, then database entries could be removed as the corresponding modules publish retractions. This keeps the "active" database size to a minimum, and keeps the vuln retraction history with the (cached) modules.

@julieqiu julieqiu removed the x/vuln label Sep 10, 2022
@zpavlinovic zpavlinovic removed their assignment Jan 26, 2023
@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 30, 2023
@julieqiu julieqiu modified the milestones: vuln/2022, vuln/unplanned Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. vulncheck or vulndb Issues for the x/vuln or x/vulndb repo
Projects
None yet
Development

No branches or pull requests

6 participants