From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id uHpgITwE/WHOZAAAgWs5BA (envelope-from ) for ; Fri, 04 Feb 2022 11:47:24 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id iBnCHjwE/WFCGwEA9RJhRA (envelope-from ) for ; Fri, 04 Feb 2022 11:47:24 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 079EF221D6 for ; Fri, 4 Feb 2022 11:47:24 +0100 (CET) Received: from localhost ([::1]:36200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nFw7e-0003qw-KR for larch@yhetil.org; Fri, 04 Feb 2022 05:47:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48806) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nFw7L-0003qC-3G for guix-patches@gnu.org; Fri, 04 Feb 2022 05:47:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:36717) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nFw7K-0000c0-Co for guix-patches@gnu.org; Fri, 04 Feb 2022 05:47:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nFw7K-0007SJ-9f for guix-patches@gnu.org; Fri, 04 Feb 2022 05:47:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#52555] [RFC PATCH v2 0/5] Decentralized substitute distribution with ERIS Resent-From: pukkamustard Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 04 Feb 2022 10:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52555 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxime Devos Cc: ~pukkamustard/eris@lists.sr.ht, 52555@debbugs.gnu.org Received: via spool by 52555-submit@debbugs.gnu.org id=B52555.164397156928588 (code B ref 52555); Fri, 04 Feb 2022 10:47:02 +0000 Received: (at 52555) by debbugs.gnu.org; 4 Feb 2022 10:46:09 +0000 Received: from localhost ([127.0.0.1]:58847 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nFw6T-0007R2-IO for submit@debbugs.gnu.org; Fri, 04 Feb 2022 05:46:09 -0500 Received: from mout02.posteo.de ([185.67.36.66]:45099) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nFw6R-0007QE-DJ for 52555@debbugs.gnu.org; Fri, 04 Feb 2022 05:46:08 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 1602F240101 for <52555@debbugs.gnu.org>; Fri, 4 Feb 2022 11:46:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1643971561; bh=X6buIRvbJu84QfIOpDjucqmsl2Df+cPh49PLjEf/h8Q=; h=From:To:Cc:Subject:Date:From; b=Sgn52/2sfBTItDhIxtTaDjvLmowRqT4DG21+dTkLfwRgB4ebwuNP+K/IVXeVaQqy1 hj7+M1oXN9QPI4jwXlL6hr6JqVmtyv4VKcMjwpcoKUskXaCAzPBH//Mv9Gu6hHVq0m u4Jq/1Kb4t+nFwnaA62MyuCCMHoDtFDgS79W7xepqELyJ5d5ETwmB47A80gcgyqiTa 5voI21KlMZscrw7AJ7fUJq3+yLgQg2kTnWqLAdd0icvbRwZVb8G+N1YWrkz6R+0AbK KqeE0QejHAo/9g9g771JazZoyxxUI4lw8yKHXNnluk6XxXOg3MNmoemSSpsneJ+FOz Fg/7TzmqvQfxg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Jqsdg09b1z6tpX; Fri, 4 Feb 2022 11:45:58 +0100 (CET) References: <20211216161724.547-1-pukkamustard@posteo.net> <20220125192201.7582-1-pukkamustard@posteo.net> <73b50ffdca94407ef9fd7ef4875985a3b1c3c568.camel@telenet.be> <86bkzph5ux.fsf@posteo.net> <52ee517f75c66a8fd9e9823da016b5720b4d5d34.camel@telenet.be> From: pukkamustard Date: Fri, 04 Feb 2022 10:20:18 +0000 In-reply-to: <52ee517f75c66a8fd9e9823da016b5720b4d5d34.camel@telenet.be> Message-ID: <86tudeyknu.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1643971644; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=4fIVSlXkeOeU5u+N02CgLscf27DBrmq4wMiblzWnnF8=; b=ARGknZuC/mFcuWIQ4O29lQjwo5WHY3HdMOnPcPE6r8yraJW0JK0dCcQYDBWZ9F97tQZjiL gO60g97EVKSVOqBR2tbiAcl77LLC+u8sKbkcGfLkZCq2Ft4Pbcp5awoUhRfHvXDX5h119e ER6tqYuQFexmRqsRKuWxyBDW8vfxu5FFmgXMkXKBVPs+S45FwkdYPCM8m4AcxU6Sgs82Pp dsGyjmi7cxS0zyDoWn0EE5x+KQptR3nAUwT8bTLKG81awzmrtoZ2PBzlGPLAfSPhl7A4lK ZplvgrJCMU46Y7HZl1UPnBEoSSmjWB6lYa8qffrAelBbu7rm9Q8jqB3BJiPeog== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1643971644; a=rsa-sha256; cv=none; b=j1V4f8p9+5LyCUFu6B8lAJ7z/FoHfBlaA3JYvrrd5bPCNDiRUkEwPHD4mskPWtNm83jAyf YGgctml8LcJhvMUWrFQl0DtyKVcsFeTXuuIt0xIOYlhprzjRwH/LG55gBhVP+pu7So71XF s2f/MAXhgTiWavAyEpJCa5Oj+YPE7BP+QPb516NMLfmzJSvQbWl75KSaOiUoG51OfSvsRV JD9KrwwmTrCsVHlDHrsH5MY+Z2lSeK+RukcePAtOVH3GLFVPz5Cn8+g74v+MD8nYo7LnnF 2gTzh0DQWVVpySl77BCDLMXSqUw+6f4WcaNGFuETuoOfBGGvIGXaDkovet26eA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=posteo.net header.s=2017 header.b="Sgn52/2s"; dmarc=fail reason="SPF not aligned (strict)" header.from=posteo.net (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.23 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=posteo.net header.s=2017 header.b="Sgn52/2s"; dmarc=fail reason="SPF not aligned (strict)" header.from=posteo.net (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 079EF221D6 X-Spam-Score: -2.23 X-Migadu-Scanner: scn1.migadu.com X-TUID: 2nB3woP13uqr Maxime Devos writes: > pukkamustard schreef op wo 02-02-2022 om 11:10 [+0000]: >> The ERIS URN is only used if the entire narinfo is signed with a >> authorized signature. > > Perhaps I'm missing something here, but in that case, shouldn't "ERIS" > be added to %mandatory-fields in (guix narinfo)? > > Anyway, I don't see what prevents an unauthorised narinfo with a ERIS > URN to be used: the narinfo is chosen with > > (define narinfo > (lookup-narinfo cache-urls store-item > (if (%allow-unauthenticated-substitutes?) > (const #t) > (cut valid-narinfo? <> acl)))) > > where lookup-narinfo is a tiny wrapper around lookup-narinfos/diverse. > lookup-narinfos/diverse considers both unauthorised and authorised > narinfos, and can choose an unauthorised narinfo if it's =E2=80=98equival= ent=E2=80=99 > to an authorised narinfo (using equivalent-narinfo?) > > equivalent-narinfo? only looks at the hash, path, references and size, > and ignores the ERIS. As such, an unauthorised narinfo with a > malicious ERIS URN could be selected. You're right. I was not aware that parts of unauthorized narinfos are used when they are deemed equavelent to authorized narinfos with equivalent-narinfo?. > > However, it turns out that all this doesn't really matter:=C2=A0whether t= he > port returned by 'fetch' in (guix scripts substitute) came from > file://, http://, https:// or ERIS, the file hash is verified later > anyway: > > ;; Compute the actual nar hash as we read it. > ((algorithm expected) > (narinfo-hash-algorithm+value narinfo)) > ((hashed get-hash) > (open-hash-input-port algorithm input))) > > [...] > > ;; Check whether we got the data announced in NARINFO. > (let ((actual (get-hash))) > (if (bytevector=3D? actual expected) > [...] > > False alarm I guess! Yeah, good that the hash is checked. Still, I think we should not even try downloading a ERIS URN that is not authorized. I think adding a check to equivalent-narinfo? that makes sure that the ERIS URNs are equivalent if present would fix this. wdyt? -pukkamustard