Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force tags as strings #206

Merged
merged 3 commits into from
May 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions elastalert/alerters/thehive.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ def load_tags(self, tag_names: list, match: dict):
tag_value = self.lookup_field(match, tag, tag)
if isinstance(tag_value, list):
for sub_tag in tag_value:
tag_values.add(sub_tag)
tag_values.add(str(sub_tag))
else:
tag_values.add(tag_value)
tag_values.add(str(tag_value))

return tag_values

Expand Down
7 changes: 4 additions & 3 deletions tests/alerters/thehive_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_thehive_alerter():
'severity': 2,
'source': 'elastalert',
'status': 'New',
'tags': ['test.ip'],
'tags': ['test.port'],
'tlp': 3,
'type': 'external'},
'hive_connection': {'hive_apikey': '',
Expand All @@ -33,7 +33,8 @@ def test_thehive_alerter():
alert = HiveAlerter(rule)
match = {
"test": {
"ip": "127.0.0.1"
"ip": "127.0.0.1",
"port": 9876
},
"@timestamp": "2021-05-09T14:43:30",
}
Expand Down Expand Up @@ -62,7 +63,7 @@ def test_thehive_alerter():
"source": "elastalert",
"status": "New",
"tags": [
"127.0.0.1"
"9876"
],
"title": "test-thehive",
"tlp": 3,
Expand Down