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 27AEF1FF143 for ; Sat, 23 May 2026 23:30:44 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E1B2B1C254; Sat, 23 May 2026 23:29:44 +0200 (CEST) From: Thomas Lamprecht To: Proxmox VE development discussion , Mira Limbeck Subject: Re: [PATCH v2 storage 10/15] api: add mapping support Date: Sat, 23 May 2026 23:26:13 +0200 Message-ID: <20260523212856.2822353-8-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260430173220.441001-11-m.limbeck@proxmox.com> References: <20260430173220.441001-1-m.limbeck@proxmox.com> <20260430173220.441001-11-m.limbeck@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1779571725664 X-SPAM-LEVEL: Spam detection results: 0 AWL -1.195 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 KAM_MAILER 2 Automated Mailer Tag Left in Email POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes PROLO_LEO1 0.1 Meta Catches all Leo drug variations so far SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: EE6LWQ3DTP55OFCVEUSVHAO5WY6ISFWI X-Message-ID-Hash: EE6LWQ3DTP55OFCVEUSVHAO5WY6ISFWI X-MailFrom: t.lamprecht@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu, 30 Apr 2026 19:27:08 +0200, Mira Limbeck wrote:=0D > diff --git a/src/PVE/API2/Storage/Mapping.pm b/src/PVE/API2/Storage/Mappi= ng.pm=0D > @@ -0,0 +1,213 @@=0D > + next=0D > + if !$rpcenv->check_any($authuser, "/mapping/storage/$typ= e/$id", $mapping_privs, 1);=0D =0D /mapping/storage// is three levels below /mapping, but=0D PVE::AccessControl::check_path() allows at most two:=0D |/mapping=0D |/mapping/[[:alnum:]\.\-\_]+=0D |/mapping/[[:alnum:]\.\-\_]+/[[:alnum:]\.\-\_]+=0D so currently no ACL entry can be created at that path and per-mapping=0D read delegation is not possible. PCI/USB use /mapping//=0D because is fixed.=0D =0D It is also inconsistent with the create/update/delete methods in this same= =0D patch, which key on:=0D =0D > + check =3D> ['perm', '/mapping/storage/', ['Mapping.Modify']],=0D > + check =3D> ['perm', '/mapping/storage/{id}', ['Mapping.Modify']]= ,=0D > + check =3D> ['perm', '/mapping/storage', ['Mapping.Modify']],=0D =0D read keys on .../storage//, writes on .../storage[/] - two AC= L=0D namespaces for one object. Keying uniformly on /mapping/storage/ (id is= =0D already globally unique via pve-storage-id) matches PCI/USB and check_path.= =0D =0D We can do what (IIRC) sdn did and merge one with a - or _ separator, like= =0D /mapping/storage/$type-$id but that naturally is not great. We could also=0D look into allowing a further level below, which might be worth it.=0D =0D Minor, separate: this new module calls into PVE::RPCEnvironment,=0D PVE::SectionConfig and PVE::Storage::Mapping::Plugin (lookup_types() even a= t=0D load time) but only `use`s PVE::RESTHandler and PVE::Tools. It compiles onl= y=0D if those happen to be loaded (and registered) already - worth adding the=0D explicit `use`s.=0D