From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 4BD5D93404 for ; Mon, 19 Feb 2024 18:14:54 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 2501533713 for ; Mon, 19 Feb 2024 18:14:24 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 19 Feb 2024 18:14:23 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 1327943AA1 for ; Mon, 19 Feb 2024 18:14:23 +0100 (CET) From: Thomas Lamprecht To: pve-devel@lists.proxmox.com Date: Mon, 19 Feb 2024 18:14:11 +0100 Message-Id: <20240219171412.1576651-4-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240219171412.1576651-1-t.lamprecht@proxmox.com> References: <20240219171412.1576651-1-t.lamprecht@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.057 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 T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH manager 1/2] api: nodes: allow usage of query url metadata with Sys.AccessNetwork 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: , X-List-Received-Date: Mon, 19 Feb 2024 17:14:54 -0000 This was restricted to Sys.Modify + Sys.Audit on the whole cluster to ensure that only trusted users get access to a method that can scan the (local) network from the POV of the Proxmox VE node, even if only through HTTP HEAD requests. Nowadays there's enough user interest [0] to warrant a separate access privilege to cover such an use case, and while most of the requests are for the download-url storage API endpoint, this method here is not only a bit less powerful than the storage one, it's rather tied to the latter anyway (e.g. for querying the metadata of a URL in the web UI for name and size before downloading it to a storage). For backwards compatibility keep the old check and add the new privilege as alternative to fulfill the permission requirements of that API endpoint. [0]: https://bugzilla.proxmox.com/show_bug.cgi?id=5254 Signed-off-by: Thomas Lamprecht --- PVE/API2/Nodes.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm index 3619190d..5d9bae39 100644 --- a/PVE/API2/Nodes.pm +++ b/PVE/API2/Nodes.pm @@ -1581,7 +1581,10 @@ __PACKAGE__->register_method({ description => "Query metadata of an URL: file size, file name and mime type.", proxyto => 'node', permissions => { - check => ['perm', '/', [ 'Sys.Audit', 'Sys.Modify' ]], + check => ['or', + ['perm', '/', [ 'Sys.Audit', 'Sys.Modify' ]], + ['perm', '/nodes/{node}', [ 'Sys.AccessNetwork' ]], + ], }, parameters => { additionalProperties => 0, -- 2.39.2