Skip to content

Commit b274f7d

Browse files
authored
Merge pull request #1374 from yaksnip425/master
[IRIS] Remove empty IOC in alerts that are not accepted by the API
2 parents 40e830f + eb06fdf commit b274f7d

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- Add workwechat alerter - [#1367](https://github.com/jertel/elastalert2/pull/1367) - @wufeiqun
88

99
## Other changes
10-
- TBD
10+
- [IRIS] Remove empty IOC in alerts that are not accepted by the API - [#1374](https://github.com/jertel/elastalert2/pull/1374) - @yaksnip425
1111

1212
# 2.16.0
1313

elastalert/alerters/iris.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ def make_iocs_records(self, matches):
6565
iocs = []
6666
for record in self.iocs:
6767
record['ioc_value'] = lookup_es_key(matches[0], record['ioc_value'])
68-
iocs.append(record)
68+
if record['ioc_value'] is not None:
69+
iocs.append(record)
6970
return iocs
7071

7172
def make_alert(self, matches):

tests/alerters/iris_test.py

+7
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ def test_iris_make_iocs_records(caplog):
6464
'ioc_tlp_id': 3,
6565
'ioc_type_id': 3,
6666
'ioc_value': 'username'
67+
},
68+
{
69+
'ioc_description': 'empty ioc',
70+
'ioc_tags': 'ioc',
71+
'ioc_tlp_id': 3,
72+
'ioc_type_id': 3,
73+
'ioc_value': 'non_existent_data'
6774
}
6875
],
6976
'alert': []

0 commit comments

Comments
 (0)