From 26d8400cddf9aa4fa11d1813141b93d7e517bf98 Mon Sep 17 00:00:00 2001 From: Trezy Date: Mon, 23 Feb 2026 20:08:31 -0600 Subject: [PATCH] fix: prevent rogue records from being stored --- src/tap.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/tap.rs b/src/tap.rs index e2229bc..3b5e130 100644 --- a/src/tap.rs +++ b/src/tap.rs @@ -6,7 +6,7 @@ use tokio::sync::watch; use tokio_tungstenite::tungstenite::Message; use tokio_tungstenite::tungstenite::client::IntoClientRequest; -use crate::lexicon::{LexiconRegistry, ParsedLexicon, ProcedureAction}; +use crate::lexicon::{LexiconRegistry, LexiconType, ParsedLexicon, ProcedureAction}; // --------------------------------------------------------------------------- // Tap event types (matches Tap's outbox JSON format) @@ -395,6 +395,20 @@ async fn handle_record_event( return; } + // Skip records whose collection is not tracked by a registered record-type lexicon. + let is_tracked = lexicons + .get(&record.collection) + .await + .is_some_and(|lex| lex.lexicon_type == LexiconType::Record); + + if !is_tracked { + tracing::debug!( + collection = %record.collection, + "skipping record for untracked collection" + ); + return; + } + match record.action.as_str() { "create" | "update" => { let rec = match &record.record { -- 2.54.0