Skip to content

Commit

Permalink
Merge pull request #1374 from yaksnip425/master
Browse files Browse the repository at this point in the history
[IRIS] Remove empty IOC in alerts that are not accepted by the API
  • Loading branch information
jertel authored Feb 17, 2024
2 parents 40e830f + eb06fdf commit b274f7d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- Add workwechat alerter - [#1367](https://github.com/jertel/elastalert2/pull/1367) - @wufeiqun

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

# 2.16.0

Expand Down
3 changes: 2 additions & 1 deletion elastalert/alerters/iris.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def make_iocs_records(self, matches):
iocs = []
for record in self.iocs:
record['ioc_value'] = lookup_es_key(matches[0], record['ioc_value'])
iocs.append(record)
if record['ioc_value'] is not None:
iocs.append(record)
return iocs

def make_alert(self, matches):
Expand Down
7 changes: 7 additions & 0 deletions tests/alerters/iris_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ def test_iris_make_iocs_records(caplog):
'ioc_tlp_id': 3,
'ioc_type_id': 3,
'ioc_value': 'username'
},
{
'ioc_description': 'empty ioc',
'ioc_tags': 'ioc',
'ioc_tlp_id': 3,
'ioc_type_id': 3,
'ioc_value': 'non_existent_data'
}
],
'alert': []
Expand Down

0 comments on commit b274f7d

Please sign in to comment.