From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 8A7561FF0A7 for ; Wed, 02 Sep 2026 17:00:39 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 7C7BD2163F; Wed, 02 Sep 2026 17:00:11 +0200 (CEST) From: Shan Shaji To: pve-devel@lists.proxmox.com Subject: [PATCH proxmox v2 5/6] pve-api-types: register missing pve-fw-comment-spec verify function Date: Wed, 2 Sep 2026 16:59:43 +0200 Message-ID: <20260902145944.365185-6-s.shaji@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260902145944.365185-1-s.shaji@proxmox.com> References: <20260902145944.365185-1-s.shaji@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1788361194525 X-SPAM-LEVEL: Spam detection results: 0 AWL -1.067 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLACK 3 Contains an URL listed in the URIBL blacklist [types.rs] URIBL_CSS_A 0.1 Contains URL's A record listed in the Spamhaus CSS blocklist [34.117.176.22] Message-ID-Hash: NPK4VIAEPVKBBQO5U35JIFXQCU4OA25U X-Message-ID-Hash: NPK4VIAEPVKBBQO5U35JIFXQCU4OA25U X-MailFrom: s.shaji@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: Earlier, `make all` failed to regenerate the types due to missing registration of pve-fw-comment-spec format function. Resolved it by registering it. Signed-off-by: Shan Shaji --- pve-api-types/generate.pl | 2 +- pve-api-types/pve-api.json | 25 +++++++++++++++++++++++++ pve-api-types/src/generated/types.rs | 8 ++++++++ pve-api-types/src/types/verifiers.rs | 9 +++++++++ 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/pve-api-types/generate.pl b/pve-api-types/generate.pl index 927c822b..26d1b842 100755 --- a/pve-api-types/generate.pl +++ b/pve-api-types/generate.pl @@ -124,7 +124,7 @@ Schema2Rust::register_format('pve-sdn-controller-id' => { code => 'verifiers::ve Schema2Rust::register_format('pve-sdn-isis-net' => { regex => '^[a-fA-F0-9]{2}(\.[a-fA-F0-9]{4}){3,9}\.[a-fA-F0-9]{2}$' }); Schema2Rust::register_format('pve-sdn-fabric-id' => { code => 'verifiers::verify_sdn_id' }); Schema2Rust::register_format('pve-sdn-route-map-id' => { code => 'verifiers::verify_sdn_route_map_id' }); - +Schema2Rust::register_format('pve-fw-comment-spec' => { code => 'verifiers::verify_fw_comment_spec' }); # This is used as both a task status and guest status. Schema2Rust::generate_enum('IsRunning', { type => 'string', diff --git a/pve-api-types/pve-api.json b/pve-api-types/pve-api.json index 36ba0b07..1006538e 100644 --- a/pve-api-types/pve-api.json +++ b/pve-api-types/pve-api.json @@ -143,6 +143,7 @@ "pve-day-of-week": ("Code")[], "pve-dir-override": ("Code")[], "pve-fw-addr-spec": ("Code")[], + "pve-fw-comment-spec": ("Code")[], "pve-fw-conntrack-helper": ("Code")[], "pve-fw-dport-spec": ("Code")[], "pve-fw-icmp-type-spec": ("Code")[], @@ -5290,6 +5291,7 @@ }, "comment": { "description": "Descriptive comment.", + "format": "pve-fw-comment-spec", "optional": 1, "type": "string" }, @@ -5496,6 +5498,7 @@ }, "comment": { "description": "Descriptive comment.", + "format": "pve-fw-comment-spec", "optional": 1, "type": "string" }, @@ -5622,6 +5625,7 @@ "items": { "properties": { "comment": { + "description": "Optional comment or description.", "optional": 1, "type": "string" }, @@ -5659,6 +5663,7 @@ "additionalProperties": 0, "properties": { "comment": { + "format": "pve-fw-comment-spec", "optional": 1, "type": "string" }, @@ -5784,6 +5789,7 @@ }, "comment": { "description": "Descriptive comment.", + "format": "pve-fw-comment-spec", "optional": 1, "type": "string" }, @@ -5951,6 +5957,7 @@ }, "comment": { "description": "Descriptive comment.", + "format": "pve-fw-comment-spec", "optional": 1, "type": "string" }, @@ -6142,6 +6149,7 @@ "properties": { "cidr": ("Ref")["/root/0/children/5/children/2/children/0/children/0/info/DELETE/parameters/properties/cidr"], "comment": { + "format": "pve-fw-comment-spec", "optional": 1, "type": "string" }, @@ -6361,6 +6369,7 @@ "additionalProperties": 0, "properties": { "comment": { + "format": "pve-fw-comment-spec", "optional": 1, "type": "string" }, @@ -6485,6 +6494,7 @@ "type": "string" }, "comment": { + "format": "pve-fw-comment-spec", "optional": 1, "type": "string" }, @@ -6818,19 +6828,24 @@ "items": { "properties": { "comment": { + "description": "Optional comment or description.", "optional": 1, "type": "string" }, "name": { + "description": "The name of the alias or ipset.", "type": "string" }, "ref": { + "description": "The reference string used in firewall rules.", "type": "string" }, "scope": { + "description": "The scope of the reference (e.g., SDN).", "type": "string" }, "type": { + "description": "The type of reference (alias or ipset).", "enum": [ "alias", "ipset" @@ -12176,6 +12191,7 @@ }, "comment": { "description": "Descriptive comment.", + "format": "pve-fw-comment-spec", "optional": 1, "type": "string" }, @@ -12336,6 +12352,7 @@ }, "comment": { "description": "Descriptive comment.", + "format": "pve-fw-comment-spec", "optional": 1, "type": "string" }, @@ -20702,6 +20719,7 @@ }, "comment": { "description": "Descriptive comment.", + "format": "pve-fw-comment-spec", "optional": 1, "type": "string" }, @@ -20874,6 +20892,7 @@ }, "comment": { "description": "Descriptive comment.", + "format": "pve-fw-comment-spec", "optional": 1, "type": "string" }, @@ -21507,6 +21526,7 @@ "additionalProperties": 0, "properties": { "comment": { + "format": "pve-fw-comment-spec", "optional": 1, "type": "string" }, @@ -39456,6 +39476,7 @@ }, "comment": { "description": "Descriptive comment.", + "format": "pve-fw-comment-spec", "optional": 1, "type": "string" }, @@ -39628,6 +39649,7 @@ }, "comment": { "description": "Descriptive comment.", + "format": "pve-fw-comment-spec", "optional": 1, "type": "string" }, @@ -40261,6 +40283,7 @@ "additionalProperties": 0, "properties": { "comment": { + "format": "pve-fw-comment-spec", "optional": 1, "type": "string" }, @@ -53768,6 +53791,7 @@ }, "comment": { "description": "Descriptive comment.", + "format": "pve-fw-comment-spec", "optional": 1, "type": "string" }, @@ -53938,6 +53962,7 @@ }, "comment": { "description": "Descriptive comment.", + "format": "pve-fw-comment-spec", "optional": 1, "type": "string" }, diff --git a/pve-api-types/src/generated/types.rs b/pve-api-types/src/generated/types.rs index 6efedbff..129f82ed 100644 --- a/pve-api-types/src/generated/types.rs +++ b/pve-api-types/src/generated/types.rs @@ -3955,6 +3955,7 @@ pub struct CreateController { type: String, }, comment: { + format: &ApiStringFormat::VerifyFn(verifiers::verify_fw_comment_spec), optional: true, type: String, description: "Descriptive comment", @@ -3987,6 +3988,7 @@ pub struct CreateFirewallAlias { description: "CIDR address", }, comment: { + format: &ApiStringFormat::VerifyFn(verifiers::verify_fw_comment_spec), optional: true, type: String, description: "Descriptive comment", @@ -4996,14 +4998,18 @@ pub struct FirewallMacro { /// Object. #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)] pub struct FirewallRef { + /// Optional comment or description. #[serde(default, skip_serializing_if = "Option::is_none")] pub comment: Option, + /// The name of the alias or ipset. pub name: String, + /// The reference string used in firewall rules. #[serde(rename = "ref")] pub r#ref: String, + /// The scope of the reference (e.g., SDN). pub scope: String, #[serde(rename = "type")] @@ -21996,6 +22002,7 @@ pub struct UpdateClusterOptions { type: String, }, comment: { + format: &ApiStringFormat::VerifyFn(verifiers::verify_fw_comment_spec), optional: true, type: String, description: "Descriptive comment", @@ -22035,6 +22042,7 @@ pub struct UpdateFirewallAlias { #[api( properties: { comment: { + format: &ApiStringFormat::VerifyFn(verifiers::verify_fw_comment_spec), optional: true, type: String, description: "Descriptive comment", diff --git a/pve-api-types/src/types/verifiers.rs b/pve-api-types/src/types/verifiers.rs index c377c4a0..b0ebaba4 100644 --- a/pve-api-types/src/types/verifiers.rs +++ b/pve-api-types/src/types/verifiers.rs @@ -61,6 +61,7 @@ pub SDN_ROUTE_MAP_ID_RESERVED = r##"^(pve_.*|MAP_VTEP_IN|MAP_VTEP_OUT|correct_sr pub SCOPED_IP_ALIAS_RE = r##"^(dc/|guest/)?([A-Za-z][A-Za-z0-9\-\_]+)$"##; +pub LINE_FEED_RE = r##"[\n\r]"##; } pub fn verify_volume_id(s: &str) -> Result<(), Error> { @@ -346,3 +347,11 @@ pub fn verify_pve_acme_alias(s: &str) -> Result<(), Error> { bail!("not a valid acme alias"); } } + +pub fn verify_fw_comment_spec(s: &str) -> Result<(), Error> { + if LINE_FEED_RE.is_match(s) { + bail!("comment must not contain a line feed"); + } + + Ok(()) +} -- 2.47.3