[pdm-devel] [PATCH datacenter-manager 2/2] api types: node url: validate hostname

Shannon Sterz s.sterz at proxmox.com
Fri Dec 19 13:37:58 CET 2025


otherwise, it is possible to set values via the api when updating a
remote that won't work. for example, adding a protocol like "https://"
to the beginning of a remote's hostname will break attempts at
connecting to it.

Signed-off-by: Shannon Sterz <s.sterz at proxmox.com>
---
 lib/pdm-api-types/src/remotes.rs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/pdm-api-types/src/remotes.rs b/lib/pdm-api-types/src/remotes.rs
index f69609c..b226d19 100644
--- a/lib/pdm-api-types/src/remotes.rs
+++ b/lib/pdm-api-types/src/remotes.rs
@@ -8,7 +8,7 @@ use proxmox_schema::{api, ApiType, Schema, StringSchema, Updater};
 use proxmox_section_config::typed::ApiSectionDataEntry;
 use proxmox_section_config::{SectionConfig, SectionConfigPlugin};
 
-use crate::Authid;
+use crate::{Authid, HOST_OPTIONAL_PORT_FORMAT};
 
 pub const REMOTE_ID_SCHEMA: Schema = StringSchema::new("Remote ID.")
     .format(&crate::PROXMOX_SAFE_ID_FORMAT)
@@ -18,6 +18,9 @@ pub const REMOTE_ID_SCHEMA: Schema = StringSchema::new("Remote ID.")
 
 #[api(
     properties: {
+        hostname: {
+            format: &HOST_OPTIONAL_PORT_FORMAT,
+        },
         "fingerprint": {
             type: String,
             format: &crate::FINGERPRINT_SHA256_FORMAT,
-- 
2.47.3





More information about the pdm-devel mailing list