From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id GP7aE9lpWGF5DQEAgWs5BA (envelope-from ) for ; Sat, 02 Oct 2021 16:16:57 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id u1pUD9lpWGEKKAAAbx9fmQ (envelope-from ) for ; Sat, 02 Oct 2021 14:16:57 +0000 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 999002E937 for ; Sat, 2 Oct 2021 16:16:56 +0200 (CEST) Received: from localhost ([::1]:57556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWfot-0006ol-Qt for larch@yhetil.org; Sat, 02 Oct 2021 10:16:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45464) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWfo3-0005PP-9J for guix-patches@gnu.org; Sat, 02 Oct 2021 10:16:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48600) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWfo3-0003k4-24 for guix-patches@gnu.org; Sat, 02 Oct 2021 10:16:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mWfo2-00049s-TO for guix-patches@gnu.org; Sat, 02 Oct 2021 10:16:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50960] [PATCH 04/10] DRAFT shell: By default load the local 'guix.scm' or 'manifest.scm' file. Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 02 Oct 2021 14:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50960 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= , 50960@debbugs.gnu.org Received: via spool by 50960-submit@debbugs.gnu.org id=B50960.163318413315917 (code B ref 50960); Sat, 02 Oct 2021 14:16:02 +0000 Received: (at 50960) by debbugs.gnu.org; 2 Oct 2021 14:15:33 +0000 Received: from localhost ([127.0.0.1]:60141 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mWfnZ-00048f-3Y for submit@debbugs.gnu.org; Sat, 02 Oct 2021 10:15:33 -0400 Received: from xavier.telenet-ops.be ([195.130.132.52]:52424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mWfnW-00048V-6S for 50960@debbugs.gnu.org; Sat, 02 Oct 2021 10:15:31 -0400 Received: from ptr-bvsjgyjmffd7q9timvx.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:aaf1:9810:a0b8:a55d]) by xavier.telenet-ops.be with bizsmtp id 12FU2600P0mfAB4012FUvH; Sat, 02 Oct 2021 16:15:28 +0200 Message-ID: <80360a349abc0eb00a8645fe3e7b5f8008f33ec8.camel@telenet.be> From: Maxime Devos Date: Sat, 02 Oct 2021 16:15:21 +0200 In-Reply-To: <20211002102240.27815-4-ludo@gnu.org> References: <20211002102240.27815-1-ludo@gnu.org> <20211002102240.27815-4-ludo@gnu.org> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-ETpBKpGpOGG12vovG6wO" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21; t=1633184128; bh=MkvVs+r4JczBvz3OyueRDXwbNaT/0HhiBGaaSzWBMts=; h=Subject:From:To:Date:In-Reply-To:References; b=XGdaUDo0bC21qqyRPHFM0x3BkiNdrvWWR4OyRvGLOtZnfPXVSa7HWkH5AL7x4y8uX kEsU9QvtkS/7V9OkTGbex80/C5CmWfsxa2dzCO5prJoh94RbPLu1P5vVCO3YTUW47U cyPzP5NMfkZ1Bz4v/zI+4ueVAE+WfKGZcv/2zP/HVEwqhoBENnSPdtgDYijaosrT7G HHfFWH+xHM6XJ/aqJjgu2D7VtviHL1qEVaxqyAD+1qeb5YmSxUFzTsSANztU//glni ps4CbtY5Xag1l779kVU0kyGZlaM2Muh1b0wTomUFjjkjndWdrt3gzVLZKq/5qrEXa8 GUI9eT4DiTCSw== 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1633184216; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: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=MkvVs+r4JczBvz3OyueRDXwbNaT/0HhiBGaaSzWBMts=; b=BzUEo9S4xc04phFddZpE+pEHCStfczTgo9Q2C11idVCfyRFFBSqvhFVNxaCVVc4ssNd1PG JR6XdscVWF7+4Y7Nh169v3qtT8jxtes/hpAHypobUsG7FQXjVfGLW+h5UVJNWwV33jpjW8 3/KclSV5kMuUQ7rARZxSTX7GPH4CXUeO4j0lfAapUwIjYjSMH6E17hB9xcVyQMLqujeCW9 URKEFuDc//u3XNCpzmAnvAYkNOzpIAt6tVgqzDrLTW8rk+ffMJ7jLYBU46DFGQgF39P5Gn zx1sD+c7q4rxWdcq42xaWVsKk+Uy5JhsmJ/0tK9EdmSZkkwkZDnnjCu+TyQjnQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1633184216; a=rsa-sha256; cv=none; b=nXTPLbpY3J5/58tTqq+/lLblUI3fY8OhR0rdeGZBNQYOpvHcsvhEd1AJxTTXrbhlPEZdrK L9FWpzlHW2HPJjSE6fBkOj/l82C1gD+keuM8yTjngfO58xa6DMvmEG3IZvv9300CLY9FuF z3WYzgBH6dYRvVAz4TUrBR76VEyxUZqvty2ciVBHBdJ9heh+EY8q7meMI8K1z6hkp5Bif3 Q7LI91ra82iHrUGZy15OkrVMdHnXYa5v9qetGSKLzc4SlILGdUbrv+mzECCxrujOUN3T3b peGFFlva7Lg73r2O+FDyeLseB9JumIzE5LeKxZSveDaopnoxC35I6BAhy4BMdQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=XGdaUDo0; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -3.40 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=XGdaUDo0; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 999002E937 X-Spam-Score: -3.40 X-Migadu-Scanner: scn0.migadu.com X-TUID: Kc9G4XvKQnID --=-ETpBKpGpOGG12vovG6wO Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s schreef op za 02-10-2021 om 12:22 [+0200]: > +(define (find-file-in-parent-directories candidates) > + "Find one of CANDIDATES in the current directory or one of its ancesto= rs." > + (let loop ((directory (getcwd))) > + (and (=3D (stat:uid (stat directory)) (getuid)) > + (or (any (lambda (candidate) > + (let ((candidate (string-append directory "/" candid= ate))) > + (and (file-exists? candidate) candidate))) > + candidates) > + (loop (string-append directory "/..")))))) ;Unix ".." resol= ution I do not recommend this. What would happen if someone creates a temporary = directory "/tmp/stuff" do things in to throw away later (setting permissions appropri= ately), tries to create a guix.scm in that directory but misspells it as, say, guix= .sm, and runs "guix shell" from within /tmp/stuff? Then find-file-in-parent-directories = would load /tmp/guix.scm (possibly created by a local attacker, assuming a multi-= user system), -- if it weren't for the (=3D (stat:uid (stat directory)) (getuid)). Because of the (=3D (stat:uid ...) (getuid)), this attack method is not pos= sible. However, it causes other issues. Now it isn't possible for two users (that= trust each other), to set up a directory writable by both (e.g. with ACLs, or by = making the directory group-writable and placing the two users in the same group), = for working together, with a guix.scm usable by both. These can be two users on the same machine, or remotely via something like = NFS, or a single person having multiple user accounts used for different purpose= s. (I once created multiple user accounts on Debian: one regular purpose, one = for reading and games, and one for school, and made the =E2=80=98for-reading=E2=80=99 a= nd =E2=80=98school=E2=80=99 home directory readable by the =E2=80=98regular-purpose=E2=80=99 account. It was occasion= ally useful.) Greetings, Maxime. --=-ETpBKpGpOGG12vovG6wO Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYVhpehccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7h14AP4oGokYlwTAj7FIFC7JO93S/qm/ bYoetp8tXwpua6omJwEA4mbiRD/NwWir0VBFRneNqIBtnDu3yqHhHXCNtX2CewI= =9g2s -----END PGP SIGNATURE----- --=-ETpBKpGpOGG12vovG6wO--