public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: Wolfgang Bumiller <w.bumiller@proxmox.com>
Cc: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH storage 1/2] don't bail on whitespaces in backing devices
Date: Tue, 30 Apr 2024 11:13:02 +0200	[thread overview]
Message-ID: <21017c63-9c3c-48ea-8152-df5c66fa1a0c@proxmox.com> (raw)
In-Reply-To: <4qssgd7wmmrlahcxe5j6tqmfonvv3a4ye3tnebrkyegmk77n55@3gxmtkrgghip>

Am 30.04.24 um 10:38 schrieb Wolfgang Bumiller:
> On Tue, Apr 30, 2024 at 10:14:13AM +0200, Fiona Ebner wrote:
>>
>> So the returned $parent will now just be undef if it contains
>> whitespaces, even though there is a parent. Can't that cause issues
>> further down the line? If it's fine, a comment with the rationale would
>> be nice.
>>
>> Or should we rather allow whitespaces while matching and return it
>> properly? Or are there any issues with proper escaping then?
> 
> I was a bit too quick on the send trigger there, but it should be fine
> IMO:
> 
> - where we do run into this issue, we never use/need/care about the parent

Maybe this part of the function could be guarded by wantarray already,
so callers caring only about the size don't even get there? But I
suppose we do notice other unexpected things earlier by always doing the
additional checks, so maybe it's better like it is right now.

> - the parent info of file_size_info is usually discarded, or checked
>   against whether the disk is a "base volume" according to the storage's
>   idea of how such a volume has to be named (as in, it's created/managed
>   by pve)
>   or, eg. in Plugin.pm's `list_images` the parent is then checked
>   against a more specific regex and if it does not matched it is simply
>   discarded as if it was `undef`... (so we already have some logic
>   around backing-devices which "discards" unexpected values...)

Hmm, okay.

> - technically users could add a disk with a "bad" parent to a storage
>   *manually*, but given the list_images mentioned above, I'd argue the
>   situation isn't really getting worse, as values that *do* match `\S+`
>   don't necessarily match the regexes used *later* on the parent
>   *anyway*...
> 

CC Dominik

Thinking in the context of uploading OVAs (or uploading disk images), I
guess we need a check against arbitrary backing file paths in uploaded
qcow2/vmdk images (or do we already have that)?

> So we could also just untaint with /^(.+)$/, since IMO if we end up with
> actual whitespace issues anywhere *else*, then *that* could is the
> broken one, not this one...
> 
> 🤷

Fine by me, but after what you wrote, so is the current approach :)


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

  reply	other threads:[~2024-04-30  9:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30  7:53 Wolfgang Bumiller
2024-04-30  7:53 ` [pve-devel] [PATCH storage 2/2] fixup error messages in file_size_info Wolfgang Bumiller
2024-04-30  8:14 ` [pve-devel] [PATCH storage 1/2] don't bail on whitespaces in backing devices Fiona Ebner
2024-04-30  8:38   ` Wolfgang Bumiller
2024-04-30  9:13     ` Fiona Ebner [this message]
2024-04-30  9:23       ` Wolfgang Bumiller
2024-04-30  9:45       ` Dominik Csapak
2024-04-30  8:22 ` [pve-devel] applied-series: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=21017c63-9c3c-48ea-8152-df5c66fa1a0c@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=w.bumiller@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal