From Russia with doubt: Go library's Kremlin ties stoke fear
(www.theregister.com)
from cm0002@lemmy.world to golang@programming.dev on 07 May 2025 16:55
https://lemmy.world/post/29281728
from cm0002@lemmy.world to golang@programming.dev on 07 May 2025 16:55
https://lemmy.world/post/29281728
#golang
threaded - newest
Vender your dependencies.
I would like to see a web of trust model in Go libraries. I import a library with no dependencies and spend a couple of hours auditing it. It looks good, so I sign that commit hash. Someone who trusts me can used that version with less concern. If other people also audit the same library and sign it, it gets even more trustworthy.
I can audit a library with no dependencies in a couple of hours; the problem is that many libraries have deep dependency trees.
I’d even be happy to do an audit-for-hire, that comes with insurance. Something more reasonable than current audit costs, but surely we can crowd source a solution.
Is vendoring really going to help? Vendor or not, you need to review your deps’ code.
Go’s go.sum should already protect against malicious changes in upstream packages, no?
You’re right that it’s crucial to review dependencies. Vendoring does help, in a few ways:
vendor
directoryhg diff
will show you what code changed in the dependencies, whereas go.mod will only tell you which packages changed. You can use your regular code review process to audit. With non-vendored dependencies, you have to go in, one by one, andhg diff -r old-dep-tag:new-dep-tag
every dependency. It is far, far harder to do with non-vendored dependencies.I have always been opposed to vendoring, even when it briefly was becoming the standard package management before go mod; but we can’t have nice things in this world because of the human refuse doing these kinds of exploits, and vendoring is the suspenders for your security belt.
What I want is a robust static analysis auditing tool like
govulncheck
, but which looks for intentionally malicious code and not just programming SNAFUs. I’d be more comfortable not vendoring if such a thing existed, but I’m not aware of one and not certain it’d win the perpetual security arms race. It would certainly be hell maintaining such a tool.All true, but regarding #1: the size of the go.sum and all the indirect deps in the go.mod are also telling me a lot already :)
Oh, absolutely. I think it’s just more visceral with vendoring.