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 507CF1FF0C0 for ; Wed, 21 Oct 2026 16:40:08 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 45D0521681; Wed, 21 Oct 2026 16:39:51 +0200 (CEST) Content-Type: text/plain; charset=UTF-8 Date: Wed, 21 Oct 2026 16:39:39 +0200 Message-Id: From: =?utf-8?q?Michael_K=C3=B6ppl?= To: "Lukas Wagner" , , Subject: Re: [PATCH proxmox v4 17/39] notify: matcher: don't allow empty field/severity matchers Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 X-Mailer: aerc 0.22.0 References: <20261012131413.314088-1-l.wagner@proxmox.com> <20261012131413.314088-18-l.wagner@proxmox.com> In-Reply-To: <20261012131413.314088-18-l.wagner@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1792593579889 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.236 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 Message-ID-Hash: IXJW4WQBHKNGI5JGV5Q6Z5JMJQHS67RK X-Message-ID-Hash: IXJW4WQBHKNGI5JGV5Q6Z5JMJQHS67RK X-MailFrom: m.koeppl@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 Mon Oct 12, 2026 at 3:13 PM CEST, Lukas Wagner wrote: [snip] > + > #[cfg(test)] > mod test { > use proxmox_match_expression::Expression; > diff --git a/proxmox-notify/src/matcher/field.rs b/proxmox-notify/src/mat= cher/field.rs > index 4a4b2588..cd23ff9c 100644 > --- a/proxmox-notify/src/matcher/field.rs > +++ b/proxmox-notify/src/matcher/field.rs > @@ -53,6 +53,18 @@ impl MatchDirective for FieldMatcher { > } > }) > } > + > + fn validate(&self) -> Result<(), Error> { This does allow empty field names, though. More generally, the old field matcher validated by making sure that the string matches SAFE_ID_REGEX. So compared to the legacy matchers, this would allow spaces, umlauts, line breaks, etc. as well. So perhaps matching against SAFE_ID_REGEX should be performed here again? > + if let FieldMatcher::Exact { values, .. } =3D self { > + if values.is_empty() { > + return Err(Error::Generic( > + "field matcher must contain values to match".to_stri= ng(), > + )); > + } > + } > + > + Ok(()) > + } > } > > #[cfg(feature =3D "legacy-matchers")] > @@ -95,6 +107,10 @@ pub mod inline { > fn matches(&self, notification: &Notification) -> Result { [snip]