From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id BB2211FF15F
	for <inbox@lore.proxmox.com>; Mon, 18 Nov 2024 08:42:15 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 085749DF8;
	Mon, 18 Nov 2024 08:42:19 +0100 (CET)
Message-ID: <739df454-8828-4b2e-8c88-3fcb5779cd1f@proxmox.com>
Date: Mon, 18 Nov 2024 08:42:16 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird Beta
To: Thomas Lamprecht <t.lamprecht@proxmox.com>,
 Proxmox VE development discussion <pve-devel@lists.proxmox.com>
References: <20241115151749.633407-1-d.csapak@proxmox.com>
 <20241115151749.633407-13-d.csapak@proxmox.com>
 <b2340950-907b-4a01-96ef-c4c41c187867@proxmox.com>
Content-Language: en-US
From: Dominik Csapak <d.csapak@proxmox.com>
In-Reply-To: <b2340950-907b-4a01-96ef-c4c41c187867@proxmox.com>
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.016 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
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: Re: [pve-devel] [PATCH storage v6 12/12] plugin: file_size_info:
 don't ignore base path with whitespace
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

On 11/17/24 16:16, Thomas Lamprecht wrote:
> Am 15.11.24 um 16:17 schrieb Dominik Csapak:
>> if the base image (parent) of an image contains whitespace in it's path
>> (e.g. a space), the current untainting would not match and it would seem
>> there was no parent.
> 
> do we really want all spaces like newline too? Those sometimes can cause odd
> things when printing to CLI or the like, so maybe just add space explicitly?
> 
> Like with: /^([ \S]+)$/
> 

mhmm i agree that there might be some characters that can make problem.

in that case I'd rather just 'die' if we encounter a base image with problematic characters,
instead of treating it as having no parent?

I can't exactly remember the context of this patch, but we now disallow
base images for imported volumes altogether, so not sure if it is still necessary
to allow such paths for parents
(file based storages can't have a space in the path, and neither can have volume ids
created with our api)

>>
>> Fix that by adapting the untaint regex
>>
>> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
>> ---
>>   src/PVE/Storage/Plugin.pm | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
>> index eed764d..761783f 100644
>> --- a/src/PVE/Storage/Plugin.pm
>> +++ b/src/PVE/Storage/Plugin.pm
>> @@ -1031,7 +1031,7 @@ sub file_size_info {
>>       ($format) = ($format =~ /^(\S+)$/); # untaint
>>       die "format '$format' includes whitespace\n" if !defined($format);
>>       if (defined($parent)) {
>> -	($parent) = ($parent =~ /^(\S+)$/); # untaint
>> +	($parent) = ($parent =~ /^(.*)$/); # untaint
>>       }
>>       return wantarray ? ($size, $format, $used, $parent, $st->ctime) : $size;
>>   }
> 



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel