Skip to content

Commit

Permalink
Fix overwriting certego field
Browse files Browse the repository at this point in the history
  • Loading branch information
Federico Foschini committed Jul 24, 2023
1 parent e64e40e commit 77c1168
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## 1.6.x
### 1.6.3
#### Bugfix
* Fix overwriting of certego field
### 1.6.2
#### Bugfix
* Added filter in routing_filter
Expand All @@ -22,7 +25,7 @@
* Added routing history and loop protection in rule parsing

## 1.4.x
### 1.4.1
### 1.4.1+
#### Bugfix
* Updated *setup.py* to include new dependency *macaddress*
### 1.4.0
Expand Down
8 changes: 6 additions & 2 deletions routingfilter/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ def match(self, event: dict, type_: str = "streams", tag_field_name: str = "tags
:return: A list of dicts containing the matched rules and the outputs in the following format: {"rules": [...], "output": {...}}; an empty list if no rule matched
:rtype: List[dict]
"""
if not event.get("certego", {}).get("routing_history", {}):
event["certego"] = {"routing_history": {}}
# Creating routing_history if not present
if "certego" not in event:
event["certego"] = {}
if "routing_history" not in event["certego"]:
event["certego"]["routing_history"] = {}
# check for rules
if not self.rules:
self.logger.error("'rules_list' must be set before evaluating a match!")
raise ValueError("'rules_list' must be set before evaluating a match!")
Expand Down

0 comments on commit 77c1168

Please sign in to comment.