public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Florian Schmaus <flow@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] EGO_SUM
Date: Fri, 9 Jun 2023 12:07:50 +0200	[thread overview]
Message-ID: <770cb2e8-9475-5137-4979-50396e4996a9@gentoo.org> (raw)
In-Reply-To: <ZHj3lM_lZswKHrnM@linux1.home>

On 01/06/2023 21.55, William Hubbs wrote:
>> The EGO_SUM alternatives
>> - do not have the same level of trust and therefore have a negative
>> impact on security (a dubious tarball someone put somewhere, especially
>> when proxy-maint)
> 
> For this, I would argue that vetting the tarball falls to the developer
> who is proxying. If you don't trust the proxy maintainer you
> are pushing for, it is easy to make a dependency tarball yourself and
> add it to your dev space.
> 
>> - are not easily verifiable
> 
> I don't have a response to this other than to say that go does its
> own verification of modules with the dependency tarballs that it can't
> do with vendor tarballs.

Yes, go has "go mod verify", which was added to the go-mod eclass after 
I asked on 2022-10-21 in #gentoo-dev if the eclass verifies the 
dependency tarball. robbat2 was so kind to provide a proof of concept of 
the security issue I was pointing out, which is available under 
https://gist.github.com/robbat2/82f4c208b6674e707081eda689096d55. This 
demonstration of the issue triggered 
https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=733b4944c1a061269f96219cc96530f89d8f439e, 
which made the go-module.eclass run "go mod verify".

Unfortunately, a malicious contributor can trivially sidestep this 
verification step, rendering it ineffective. First, neither portage [1] 
nor PMS require that a later (source) archive can not override an 
existing file. This looseness allows, for example, the (non-upstream) 
dependency tarball, to override (upstream's) go.sum. Secondly, a 
dependency tarball could create the vendor/ directory, preventing the 
condition under which the go-module.eclass runs "go mod verify". Both 
approaches allow the dependency tarball to inject malicious code. With 
the first approach, "go mod verify" completes successfully; with the 
second, "go mod verify" is simply not invoked.

The verification, as is, is ineffective.


>> Last but not least, we have the same situation in the Rust ecosystem,
>> but we allow the EGO_SUM "equivalent" there.
> 
> I'm not sure it is quite the same because Rust projects tend to have
> much smaller numbers of dependencies.

I am curious to know of any specific reason why Rust projects generally 
get by with fewer dependencies. This impression may be deceiving, caused 
by the fact that the Go-lang ecosystem hosts several projects with a 
more significant number of dependencies. If you look at the analysis 
[2], you find that under the top 10 Go packages by EGO_SUM entry count 
are cri-o, prometheus, k3s, and k3d, among others. If someone rewrites 
any of those in Rust, they would probably end up with the same number of 
dependencies.


> Another thing to consider is that using EGO_SUM adds a significant
> amount of processing to the go-module eclass.
> I was advised recently that this isn't a good idea since bash is
> slow, so I am considering moving most of that processing into
> get-ego-vendor by having it generate the contents of SRC_URI directly
> instead of using the eclass code to do that.

Was this analyzed and quantified? Is this hurting us? The cache 
regeneration of an ebuild tree is an embarrassingly parallel operation, 
so this would need to be exponentially complex [3] to be of any 
significance.

It may be possible to tune the existing EGO_SUM handling. We should keep 
EGO_SUM if viable, as it directly maps Go's go.sum and makes developing 
Go-lang ebuilds as frictionless as possible.

- Flow



1: https://github.com/gentoo/portage/pull/1030
2: 
https://dev.gentoo.org/~flow/gentoo-tree-analysis-results/2023-05-17T100838-gentoo-at-2022-02-16-60dc7a03ff2f/post-processed-ego-sum.txt
3: something similar to what was recently found in the latex ebuilds, 
see 
https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6ee282f0645dcfccf1836b9cc7ae55556629eb8b


  parent reply	other threads:[~2023-06-09 10:08 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-17  7:37 [gentoo-dev] EGO_SUM Florian Schmaus
2023-04-17  9:28 ` [gentoo-dev] EGO_SUM Anna (cybertailor) Vyalkova
2023-04-27 18:00   ` William Hubbs
2023-04-27 18:18     ` David Seifert
2023-04-24 16:11 ` Florian Schmaus
2023-04-24 20:28   ` Sam James
2023-04-24 22:52     ` Alexey Zapparov
2023-04-26 15:31     ` Florian Schmaus
2023-04-26 16:12       ` Matt Turner
2023-04-26 19:31         ` Andrew Ammerlaan
2023-04-26 19:38           ` Chris Pritchard
2023-04-26 20:47           ` Matt Turner
2023-04-27  7:58         ` Florian Schmaus
2023-04-27  9:24           ` Ulrich Mueller
2023-04-28  6:59             ` Florian Schmaus
2023-04-27 12:54           ` Michał Górny
2023-04-27 23:12             ` Pascal Jäger
2023-04-28  0:38               ` Sam James
2023-04-28  4:27                 ` Michał Górny
2023-04-28  5:31                   ` Sam James
2023-04-28  6:59             ` Florian Schmaus
2023-04-28 14:34               ` Michał Górny
2023-05-02 19:32                 ` Florian Schmaus
2023-05-02 19:38                   ` Sam James
2023-04-29 22:34               ` Robin H. Johnson
2023-04-27 21:16           ` Sam James
2023-05-02 19:32             ` Florian Schmaus
2023-05-02 19:45               ` Sam James
2023-05-08  7:53                 ` Florian Schmaus
2023-05-08 12:03                   ` Michał Górny
2023-05-22  7:14                     ` Florian Schmaus
2023-05-02 20:04               ` Matt Turner
2023-05-08  7:53                 ` Florian Schmaus
2023-04-26 20:51       ` Sam James
2023-05-30 15:52   ` Florian Schmaus
2023-05-30 16:30     ` Anna (cybertailor) Vyalkova
2023-05-31  5:02       ` Oskari Pirhonen
2023-05-30 16:35     ` Arthur Zamarin
2023-05-31  6:20       ` Andrew Ammerlaan
2023-05-31  8:40         ` Ryan Qian
2023-05-31  9:06         ` Arsen Arsenović
2023-05-31  6:30       ` pascal.jaeger leimstift.de
2023-06-01  4:00         ` William Hubbs
2023-06-02  8:17       ` Florian Schmaus
2023-06-02  8:31         ` Michał Górny
2023-06-09 10:07           ` Florian Schmaus
2023-06-01 19:55 ` [gentoo-dev] EGO_SUM William Hubbs
2023-06-02  7:13   ` Joonas Niilola
2023-06-02 18:06     ` William Hubbs
2023-06-02 18:42       ` Joonas Niilola
2023-06-09 10:07   ` Florian Schmaus [this message]
     [not found] <2ZKWN4KF.MKEFFMWE.LGPKYP47@RTL7EJXF.RN4PF6UF.MDFBGF3C>
     [not found] ` <be450641-94ff-a0d9-51da-3a7a3abcc6c7@gentoo.org>
     [not found]   ` <b7309a3f-2980-b390-a16a-0518cce1da75@gentoo.org>
     [not found]     ` <87y1k33aoy.fsf@gentoo.org>
2023-06-30  8:15       ` [gentoo-dev] EGO_SUM (was: [gentoo-project] Gentoo Council Election 202306 ... Nominations Open in Just Over 24 Hours.) Florian Schmaus
2023-06-30  8:22         ` Sam James
2023-07-03 10:17           ` Florian Schmaus
2023-07-03 11:12             ` [gentoo-dev] EGO_SUM Ulrich Mueller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=770cb2e8-9475-5137-4979-50396e4996a9@gentoo.org \
    --to=flow@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox