From a6bd89bb7e5f6fea7c226b744491458512e052b3 Mon Sep 17 00:00:00 2001 From: Lyncoln Date: Wed, 28 Oct 2026 21:23:02 -0400 Subject: [PATCH] Updated apply conditions to handle more firewall rules --- core/runtime/applyconditions.py | 8 ++++++-- core/runtime/firewall.py | 9 --------- plugins/rmass/listeners/synapselistener.py | 9 ++++++++- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/core/runtime/applyconditions.py b/core/runtime/applyconditions.py index fc9ede1..b773bb4 100644 --- a/core/runtime/applyconditions.py +++ b/core/runtime/applyconditions.py @@ -49,8 +49,12 @@ def applyConditions(definition, dictionary, outputs): return True, filter if filter["operator"] == "in": - if filtervalue in dictionary: - return True, filter + if filter["filterkey"] == "called_dictionary": + if filtervalue in dictionary: + return True, filter + else: + if filtervalue in dictionary.get(filter["filterkey"], {}): + return True, filter if filter["operator"] == "is": if resolvedvalue is filtervalue: diff --git a/core/runtime/firewall.py b/core/runtime/firewall.py index aadecd9..189f852 100644 --- a/core/runtime/firewall.py +++ b/core/runtime/firewall.py @@ -20,15 +20,6 @@ def buildFirewall(listener, outputs): logging.info(f"Returning status_code: {status_code}") continue - #This needs to be moved into definitions but until logic is put in place it lives here. - if "com.loxthelion.rmass_message_id" in item.get("content", {}): - status_code = 200 - if firewall_log: - logging.info("Excluding previously imported items") - logging.info(f"Returning status_code: {status_code}") - - continue - outputs["firewall_allowed"].append(item) if outputs["firewall_allowed"] != []: diff --git a/plugins/rmass/listeners/synapselistener.py b/plugins/rmass/listeners/synapselistener.py index ee5dfdc..bf69e5b 100644 --- a/plugins/rmass/listeners/synapselistener.py +++ b/plugins/rmass/listeners/synapselistener.py @@ -20,7 +20,7 @@ execute = rmassmessagepush filters = [ { - "filterkey": "event", + "filterkey": "called_dictionary", "operator": "in", "filtervalue": "state_key", "print": "Excluding state.key event", @@ -40,6 +40,13 @@ filters = [ "print": "Excluding non-room message event", "status_code": 200, }, + { + "filterkey": "content", + "operator": "in", + "filtervalue": "com.loxthelion.rmass_message_id", + "print": "Excluding imported message loop item", + "status_code": 200, + }, ]