Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tjDcA-007Oae-Jy for pgsql-hackers@arkaria.postgresql.org; Sat, 15 Feb 2025 08:33:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tjDc8-00HawD-6S for pgsql-hackers@arkaria.postgresql.org; Sat, 15 Feb 2025 08:33:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tjDc7-00Haw5-RT for pgsql-hackers@lists.postgresql.org; Sat, 15 Feb 2025 08:33:27 +0000 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tjDc4-000xFj-2s for pgsql-hackers@postgresql.org; Sat, 15 Feb 2025 08:33:27 +0000 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5de4d3bbc76so4543049a12.3 for ; Sat, 15 Feb 2025 00:33:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1739608404; x=1740213204; darn=postgresql.org; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=rBYQWDn1WunJuC3UZT5iz6bdFiU9t393UMb6MY/AhlI=; b=saw9T2TuXEmwQrfd5VNtlJasIpmGpFunji4Kg0rUoZ7jQCguAtXWAqPx3KPTX6oC6f 6SDWudR64E8ifKxqy3OoUZaXH9jvEtzWsdq8DETVAffpRvqFSrpzWmcQI7GuwNRETDLw 87RddQeYJnn6U7MKxb0UlzTZfNu4VnooR5cqbu7AvpfuZ6eaHc42aVTTgbe7DkBU+ZdV 4a2bWFr9zZ+HyLqOB9nzzx7doxvqn9T0HT4dBEFiE+tCbwCDjk6F1tMvbA9ytV1H8cBK 4AA6Ux2meBtssnxa7KlkcotpDMwDHhwpv6SPJOTfnBLME0pN/vl2VuhhC/QOf4mOIBow tIEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739608404; x=1740213204; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=rBYQWDn1WunJuC3UZT5iz6bdFiU9t393UMb6MY/AhlI=; b=w6qdGcKBBuy50hyZVBG5JiD7ZkpTNRTsrXM1QZGl8RKBOlZ8i3MBXH9Iq5fi7hnVnd XJNlj2xiATYtNISQK78FqtGIuBMs5AR6mnDwpmnbKUouI0bkedRJ3G9iJ59jkW8UjcSm nk3JhUXYjZievcTrdSQaETElKr4u0snm9a07MC6YpegV6PTawOOXV3G6Py5/HgMaiRro 2kPYHSrm39mxLwI+cVz3Wp2wl4QLiG1P/WDwslpgmynEAASKvRSXDmL/YVgL+52jNDsY JmVJzpLssHnBp9kTYrzekO55t9e1EPFMcOFFPJFF2l1Pp5EOBWO6zgjWr3lZV48uK7FE WtkQ== X-Forwarded-Encrypted: i=1; AJvYcCVX6JC2g2YgodzuLxqxnqFORzAD5hm2mMb2+SVKLSZY/PoNemoy1k67hAls6dqh252uX+qiUmW6H1fN5S4o@postgresql.org X-Gm-Message-State: AOJu0Yzn/hnVg1yfAHNXZENojDfBPgqSctp2GUSw+nmaXJytw2sq2Qf0 aAv2Fv7qdnnIa2PzBSA1aq9RS+1FmVkTYcwmjZmvOwRcZyw0E+nQa9DFLPrlkm+9I4K0RT4i8zl gcFTuifKiaG+J6TnU7oRKThezKL4JSIsGHRsl/Diw/6E2lbCU4tGI0rrS X-Gm-Gg: ASbGncteYQq7R0Lt2BTZf3CNYNuKJ6y8/IN5nLuDBbKkJ7zp1PMLR5eI7JqsiolQAFf vwxbfk9LBo/9NG+WlOKJ6LqZKfI4N9k/tv0XVKb0AyRNVOYbj/W7xbEaf4LBzPduhe4/YSFVEyg zKWzgJSpxDIvkyOL6GofwqOYCFBBuiCbG7lrWKto0vf7TZ+0CWBsF47TDq+ft7v1uds90ju6LW8 WdS6XZ6CJprfbp8PNv6vp2pCJwYDJ3/NJfsWD5IpddxP8OCsJc+xmLCoZS2dGodsmUdwlihtqNX TrvwjVAXHRjySb7NV7k4PdGiWpqzmzeb7I4/ X-Google-Smtp-Source: AGHT+IFjs3HS/GjnLQwhZYaEVmS0HBGTiZhROZw6e1ZM2pvhS5e3uW0n3KtWKfQEIvvsJrqFJAPMQA== X-Received: by 2002:a05:6402:34cc:b0:5dc:90e7:d30 with SMTP id 4fb4d7f45d1cf-5e0362381acmr2546341a12.30.1739608403566; Sat, 15 Feb 2025 00:33:23 -0800 (PST) Received: from localhost.localdomain ([2001:871:255:52d3:3ac8:61ab:b634:342]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5dece270cbcsm4329948a12.49.2025.02.15.00.33.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Feb 2025 00:33:23 -0800 (PST) Message-ID: Subject: Re: Decision by Monday: PQescapeString() vs. encoding violation From: Laurenz Albe To: Noah Misch , pgsql-hackers@postgresql.org Cc: andres@anarazel.de, pgsql@j-davis.com, tgl@sss.pgh.pa.us Date: Sat, 15 Feb 2025 09:33:21 +0100 In-Reply-To: <20250215012712.45@rfd.leadboat.com> References: <20250215012712.45@rfd.leadboat.com> User-Agent: Evolution 3.54.3 (3.54.3-1.fc41) MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2025-02-14 at 17:27 -0800, Noah Misch wrote: > Commit 5dc1e42b4fa6a4434afa7d7cdcf0291351a7b873 for this week's CVE-2025-= 1094 > changed how PQescapeString()[1] reacts to input that is not valid in the > client encoding.=C2=A0 Before that commit, the function would ignore enco= ding > problems except at the end of the string.=C2=A0 Now, it replaces the bad = sequence > up to the length implied by the first byte.=C2=A0 For example, if UTF8 in= put has > 0xc2 followed by an ASCII byte, the function removes both bytes. >=20 > Jeff Davis reported to the security team that > http://www.unicode.org/reports/tr36/#Ill-Formed_Subsequences=C2=A0forbids= something > like this, saying a UTF-8 converter "must not consume the [second byte] i= f it > continues".=C2=A0 (That's my summary, not his.=C2=A0 He might reply to ad= d color here.) > While PQescapeString() is not a UTF-8 converter, that standard still felt= to > multiple security team members like a decent argument for removing only t= he > invalid 0xc2, not the byte following it. >=20 > Security team members disagreed on whether next week's releases are the l= ast > reasonable chance to change this, or whether changing it in e.g. May woul= d be > reasonable.=C2=A0 If applications make changes to cope with the new behav= ior, that > could be an argument against further change. >=20 > Question for all: would you switch to the "remove fewer bytes" behavior i= n > next week's releases, switch later, or switch never?=C2=A0 Why so?=C2=A0 = Please answer > in the next 24hr if possible, given the little time until we wrap next we= ek's > releases on Monday.=C2=A0 I regret the late notice. I don't have a very strong opinion, but I'm leaning towards removing fewer = bytes. My reasoning is that most encoding confusion comes from Microsoft's tenacio= us clinging to non-Unicode encodings, and in my part of the world single-byte encodings are prevalent on Windows systems. Removing more bytes from the s= tring would mean removing more characters, which would mutilate the string more t= han necessary. About when to make that change: having fewer backward-incompatible behavior changes is desirable, which would speak for doing it now. If you feel that= the short time frame is long enough for you to write good, reliable code, great= . If you feel that it would be better for the quality of the code to have mor= e time, take the time. Better one more subtle change than another security b= ug. Yours, Laurenz Albe --=20 *E-Mail Disclaimer* Der Inhalt dieser E-Mail ist ausschliesslich fuer den=20 bezeichneten Adressaten bestimmt. Wenn Sie nicht der vorgesehene Adressat= =20 dieser E-Mail oder dessen Vertreter sein sollten, so beachten Sie bitte,=20 dass jede Form der Kenntnisnahme, Veroeffentlichung, Vervielfaeltigung oder= =20 Weitergabe des Inhalts dieser E-Mail unzulaessig ist. Wir bitten Sie, sich= =20 in diesem Fall mit dem Absender der E-Mail in Verbindung zu setzen. *CONFIDENTIALITY NOTICE & DISCLAIMER *This message and any attachment are=20 confidential and may be privileged or otherwise protected from disclosure= =20 and solely for the use of the person(s) or entity to whom it is intended.= =20 If you have received this message in error and are not the intended=20 recipient, please notify the sender immediately and delete this message and= =20 any attachment from your system. If you are not the intended recipient, be= =20 advised that any use of this message is prohibited and may be unlawful, and= =20 you must not copy this message or attachment or disclose the contents to=20 any other person.