public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
To: Thomas Lamprecht <t.lamprecht@proxmox.com>
Cc: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH pve-network 1/2] fix #7077: Improve error messages for ID length mismatch
Date: Fri, 30 Jan 2026 09:23:44 +0100	[thread overview]
Message-ID: <fgyjvqlrljjo2xnungujc32vtmntrkk7pegmxmtfvlsfsr6avb@j4dqylko37m4> (raw)
In-Reply-To: <b0e4fcd6-1c9a-43c1-a0c3-0dc517f107f5@proxmox.com>

On Thu, Jan 29, 2026 at 06:38:50PM +0100, Thomas Lamprecht wrote:
> Am 21.01.26 um 11:34 schrieb Arthur Bied-Charreton:
> > Add explicit length checks to ID validation functions to provide clearer
> > error messages in case of length mismatches
> 
> A few of these checks might be also done by setting the "maxLength" and/or the
> "minLength" property in the matching "register_standard_option" schema definition.
> Could you check that? Would be IMO better to reuse the schema capabillities, and
> that way, this limits would be also visible in the api schema directly.
> 
> 
Hey Thomas, thanks for the feedback, I did not think about that. 

After looking into this, it seems like we could get rid of most of the parse_*_id functions
(and probably others as well), but this would require changing PVE::JSONSchema::check_format
to check in the following order: 

`length -> pattern -> custom format fn`

as opposed to currently:

`custom format fn -> pattern -> length`

In the JSON Schema validation's current implementation, the length parameters are effectively ignored 
due to the pattern/format function being checked beforehand. Do you see any issue with changing the 
validation order?




  reply	other threads:[~2026-01-30  8:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-21 10:32 [pve-devel] [PATCH 0/5] fix #7077: Improve ID validation error messages Arthur Bied-Charreton
2026-01-21 10:32 ` [pve-devel] [PATCH pve-common] fix #7077: Improve error message for IDs shorter than 2 characters Arthur Bied-Charreton
2026-01-21 18:00   ` [pve-devel] applied: " Thomas Lamprecht
2026-01-21 10:32 ` [pve-devel] [PATCH pve-storage] fix #7077: Improve error message for IDS " Arthur Bied-Charreton
2026-01-21 10:32 ` [pve-devel] [PATCH proxmox] fix #7077: Improve error message for SDN IDs " Arthur Bied-Charreton
2026-01-21 10:32 ` [pve-devel] [PATCH pve-network 1/2] fix #7077: Improve error messages for ID length mismatch Arthur Bied-Charreton
2026-01-29 17:38   ` Thomas Lamprecht
2026-01-30  8:23     ` Arthur Bied-Charreton [this message]
2026-01-21 10:32 ` [pve-devel] [PATCH pve-network 2/2] fix #7077: Respect noerr flag in SDN ID validation Arthur Bied-Charreton

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=fgyjvqlrljjo2xnungujc32vtmntrkk7pegmxmtfvlsfsr6avb@j4dqylko37m4 \
    --to=a.bied-charreton@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=t.lamprecht@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