From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 8A6601FF0AF for ; Thu, 22 Oct 2026 11:27:45 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 130F421638; Thu, 22 Oct 2026 11:27:42 +0200 (CEST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 22 Oct 2026 11:27:38 +0200 Message-Id: Subject: Re: [PATCH proxmox v4 12/39] notify: matcher: add expression support From: "Lukas Wagner" To: =?utf-8?q?Michael_K=C3=B6ppl?= , "Lukas Wagner" , , X-Mailer: aerc 0.21.0-0-g5549850facc2-dirty References: <20261012131413.314088-1-l.wagner@proxmox.com> <20261012131413.314088-13-l.wagner@proxmox.com> In-Reply-To: X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1792661258813 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.128 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) POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes 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 Message-ID-Hash: ABHQIDECJGFVEQ3AFPFA4CQ4KGZA5F2I X-Message-ID-Hash: ABHQIDECJGFVEQ3AFPFA4CQ4KGZA5F2I 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 VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Wed Oct 21, 2026 at 4:39 PM CEST, Michael K=C3=B6ppl wrote: > On Mon Oct 12, 2026 at 3:13 PM CEST, Lukas Wagner wrote: > > [snip] > >> diff --git a/proxmox-notify/src/matcher/field.rs b/proxmox-notify/src/ma= tcher/field.rs >> index ad04b388..fd25939c 100644 >> --- a/proxmox-notify/src/matcher/field.rs >> +++ b/proxmox-notify/src/matcher/field.rs >> @@ -6,6 +6,7 @@ use regex::Regex; >> use proxmox_schema::{ >> ApiStringFormat, Schema, StringSchema, api_types::SAFE_ID_REGEX_STR= , const_regex, >> }; >> +use serde::{Deserialize, Serialize}; >> >> use crate::{Error, Notification}; >> >> @@ -30,42 +31,38 @@ pub const MATCH_FIELD_ENTRY_SCHEMA: Schema =3D Strin= gSchema::new("Match metadata f >> .schema(); >> >> /// Check if the notification metadata fields match >> -#[derive(Clone, Debug)] >> +#[derive(Clone, Debug, Serialize, Deserialize)] >> +#[serde(rename_all =3D "kebab-case", untagged)] > > Via the API or CLI, I can supply an expression with keys that are > AFAIU mutually exclusive: > > ``` > pvesh create /cluster/notifications/matchers \ > --name notsupposedtowork \ > --target mail-to-root \ > --expression \ > '{"match":{"type":"field","field":"type","values":["vzdump"],"regex":"^r= eplication$"}}' > ``` > > This will be accepted, but the config will only contain this: > > ``` > matcher: notsupposedtowork > expression {"match":{"type":"field","field":"type","values":["vzdump"]}} > target mail-to-root > ``` > > So it silently drops the second key. I think this should probably be > rejected, no? I think adding `deny_unknown_fields` should resolve this. > Because then, if the field matcher has the form > `{"field": "...", "values": [...]}`, "regex" will be unknown. > Analogously if the field matcher is the regex form, then "values" will > be unknown. > > Wouldn't see this as a blocker, though. Could also be resolved as a > follow-up IMO. > Was easy enough to fix, so I'll just include that in v5. Thanks a lot!