Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mclfU-0001it-BH for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Oct 2021 09:44:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mclfS-0000xn-NW for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Oct 2021 09:44:22 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mclfS-0000xd-Eq for pgsql-hackers@lists.postgresql.org; Tue, 19 Oct 2021 09:44:22 +0000 Received: from outgoing-auth-1.mit.edu ([18.9.28.11] helo=outgoing.mit.edu) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mclfL-0006A0-J7 for pgsql-hackers@lists.postgresql.org; Tue, 19 Oct 2021 09:44:21 +0000 Received: from [192.168.9.206] (198-27-191-186.fiber.dynamic.sonic.net [198.27.191.186]) (authenticated bits=0) (User authenticated as andersk@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 19J9i3XF004164 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 19 Oct 2021 05:44:09 -0400 Message-ID: <5d675cbe-7837-e9ae-961d-be7d03201f3b@mit.edu> Date: Tue, 19 Oct 2021 02:44:03 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.2 Subject: Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory Content-Language: en-US To: Kyotaro Horiguchi , alvherre@alvh.no-ip.org Cc: pgsql-hackers@lists.postgresql.org References: <1634252654444.90107@mit.edu> <202110182223.zeze33l55qa5@alvherre.pgsql> <20211019.173422.706584612464055211.horikyota.ntt@gmail.com> From: Anders Kaseorg In-Reply-To: <20211019.173422.706584612464055211.horikyota.ntt@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10/19/21 01:34, Kyotaro Horiguchi wrote: > I tend to agree to this, but seeing ssh ignoring $HOME, I'm not sure > it's safe that we follow the variable at least when accessing > confidentiality(?) files. Since I don't understand the exact > reasoning for the ssh's behavior so it's just my humbole opinion. According to https://bugzilla.mindrot.org/show_bug.cgi?id=3048#c1, it used to be supported to install the ssh binary as setuid. A setuid/setgid binary needs to treat all environment variables with suspicion: if it can be convinced to write a file to $HOME with root privileges, then a user who modifies $HOME before invoking the binary could cause it to write to a file that the user normally couldn’t. There’s no such concern for a binary that isn’t setuid/setgid. Anyone with the ability to modify $HOME can be assumed to already have full control of the user account. Anders