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 9065F1FF178 for ; Mon, 1 Dec 2025 11:39:28 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D332D18770; Mon, 1 Dec 2025 11:39:50 +0100 (CET) From: Dominik Csapak To: pdm-devel@lists.proxmox.com Date: Mon, 1 Dec 2025 11:39:04 +0100 Message-ID: <20251201103917.1357369-5-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251201103917.1357369-1-d.csapak@proxmox.com> References: <20251201103917.1357369-1-d.csapak@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.029 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: [pdm-devel] [PATCH datacenter-manager 2/8] server: api: subscription: include basic info about remotes without permissions X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" to enable a global permission check that reaches over all remotes, we have to return (very basic) info about remotes even when the user don't have permissions for these remotes. In that case, only return the subscription state, but not the remote name or node details. Signed-off-by: Dominik Csapak --- alternatively, we could try to return a different structure with just, counts, but this would achieve the same effect, but we'd need to handle two different api calls/return values, this way it's always the same, and the remote names aren't interesting to us for the checks anyway server/src/api/resources.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs index 22871362..6fd96b64 100644 --- a/server/src/api/resources.rs +++ b/server/src/api/resources.rs @@ -608,7 +608,7 @@ pub async fn get_subscription_status( let view = views::get_optional_view(view.as_deref())?; - let check_priv = |remote_name: &str| -> bool { + let check_priv = move |remote_name: &str| -> bool { user_info .check_privs( &auth_id, @@ -624,11 +624,10 @@ pub async fn get_subscription_status( if view.can_skip_remote(&remote_name) { continue; } - } else if !allow_all && !check_priv(&remote_name) { - continue; } let view = view.clone(); + let check_priv = check_priv.clone(); let future = async move { let (node_status, error) = @@ -664,6 +663,13 @@ pub async fn get_subscription_status( RemoteSubscriptionState::Unknown }; + let (remote_name, verbose) = if !allow_all && !check_priv(&remote_name) { + // prevent info leak + ("".to_string(), false) + } else { + (remote_name, verbose) + }; + Some(RemoteSubscriptions { remote: remote_name, error, -- 2.47.3 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel