From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 4EBD51FF2AD for ; Thu, 4 Jul 2024 10:58:43 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 77E111EB62; Thu, 4 Jul 2024 10:58:59 +0200 (CEST) MIME-Version: 1.0 In-Reply-To: <20240528111002.2655756-1-d.csapak@proxmox.com> References: <20240528111002.2655756-1-d.csapak@proxmox.com> From: Fabian =?utf-8?q?Gr=C3=BCnbichler?= To: Proxmox VE development discussion Date: Thu, 04 Jul 2024 10:58:16 +0200 Message-ID: <172008349683.63060.7373969550523363330@yuna.proxmox.com> User-Agent: alot/0.10 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.050 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] applied: [PATCH common] fix #5486: tools: encode_text: add '%' to list of encoded characters X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Quoting Dominik Csapak (2024-05-28 13:10:02) > all text that is going through encode_text will at a later point be > decoded by 'decode_text'. The latter is decoding all percent encoded > characters, even those not originally encoded by 'encode_text'. > > This means, to preserve the original data, we first have to at least > percent encode the '%' itself, otherwise it's impossible to properly > store e.g. '%20' there. > > It would get saved as '%20' directly, but on the next read, it gets > decoded to ' ', which is not the original data. instead we have to save > it as '%2520', which gets then correctly decoded to '%20' again > > This is especially important for the vm/ct/node description, as there > users can store external links, which already include percent encoded > characters. > > Signed-off-by: Dominik Csapak > --- > AFAICS, we only use this for comment fields + first/lastname in > access-control, so we should be ok here and also for the worker ID for download-from-url workers, which should be fine as well. > src/PVE/Tools.pm | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm > index 766c809..59cc5c9 100644 > --- a/src/PVE/Tools.pm > +++ b/src/PVE/Tools.pm > @@ -1246,8 +1246,8 @@ sub upid_normalize_status_type { > sub encode_text { > my ($text) = @_; > > - # all control and hi-bit characters, and ':' > - my $unsafe = "^\x20-\x39\x3b-\x7e"; > + # all control and hi-bit characters, ':' and '%' > + my $unsafe = "^\x20-\x24\x26-\x39\x3b-\x7e"; > return uri_escape(Encode::encode("utf8", $text), $unsafe); > } > > -- > 2.39.2 > > > > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel > > _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel