From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 246B11FF146 for ; Tue, 26 May 2026 15:31:06 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0F23015D; Tue, 26 May 2026 15:31:02 +0200 (CEST) From: Lukas Wagner To: pdm-devel@lists.proxmox.com Subject: [PATCH datacenter-manager] api: autoinstaller: token: enforce token schema constraints Date: Tue, 26 May 2026 15:30:56 +0200 Message-ID: <20260526133056.334639-1-l.wagner@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1779802233453 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.053 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 Message-ID-Hash: FRRQ7QVWUCSMEMNFTRRVMBDWIBJGGGN7 X-Message-ID-Hash: FRRQ7QVWUCSMEMNFTRRVMBDWIBJGGGN7 X-MailFrom: l.wagner@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 Datacenter Manager development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The PROXMOX_TOKEN_NAME schema is already used internally in the id property of the AnswerToken type, so it makes sense to propagate the schema to the API handler as well. Signed-off-by: Lukas Wagner --- server/src/api/auto_installer/mod.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/server/src/api/auto_installer/mod.rs b/server/src/api/auto_installer/mod.rs index 11054963..8c40c82e 100644 --- a/server/src/api/auto_installer/mod.rs +++ b/server/src/api/auto_installer/mod.rs @@ -4,6 +4,7 @@ use anyhow::{anyhow, Context, Result}; use http::StatusCode; use std::collections::{BTreeMap, HashMap}; +use pdm_api_types::PROXMOX_TOKEN_NAME_SCHEMA; use pdm_api_types::{ auto_installer::{ AnswerToken, AnswerTokenCreateResult, AnswerTokenUpdateResult, AnswerTokenUpdater, @@ -870,8 +871,7 @@ async fn list_tokens(rpcenv: &mut dyn RpcEnvironment) -> Result input: { properties: { id: { - type: String, - description: "Token ID.", + schema: PROXMOX_TOKEN_NAME_SCHEMA, }, comment: { schema: COMMENT_SCHEMA, @@ -939,8 +939,7 @@ fn create_token( input: { properties: { id: { - type: String, - description: "Token ID.", + schema: PROXMOX_TOKEN_NAME_SCHEMA, }, update: { type: AnswerTokenUpdater, @@ -1047,8 +1046,7 @@ async fn update_token( input: { properties: { id: { - type: String, - description: "Token ID.", + schema: PROXMOX_TOKEN_NAME_SCHEMA, }, }, }, -- 2.47.3