Skip to content

Commit f712bc6

Browse files
authored
Merge pull request #2575 from kamil-certat/severity
Severity field in IDF
2 parents 481006b + fb97534 commit f712bc6

File tree

7 files changed

+27
-15
lines changed

7 files changed

+27
-15
lines changed

.github/workflows/debian-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
run: bash .github/workflows/scripts/debian-package.sh ${{ matrix.codename }}
3434

3535
- name: Test packages installation
36-
run: sudo apt install ~/artifacts/*.deb
36+
run: sudo apt-get update && DEBIAN_FRONTEND="noninteractive" sudo apt-get install ~/artifacts/*.deb
3737

3838
- name: Upload artifact
3939
if: ${{ github.event_name == 'push' }}

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ Please refer to the [NEWS](NEWS.md) for a list of changes which have an affect o
2828
### Development
2929

3030
### Data Format
31-
3231
- Implementing [IEP009](https://github.com/certtools/ieps/tree/main/009) introducing fields to
3332
identify products and vulnerabilities: `product.full_name`, `product.name`, `product.vendor`,
3433
`product.version`, `product.vulnerabilities`. To store in existing PostgreSQL instances, a following
@@ -40,6 +39,8 @@ Please refer to the [NEWS](NEWS.md) for a list of changes which have an affect o
4039
ALTER TABLE events ADD "product.version" text;
4140
ALTER TABLE events ADD "product.vulnerabilities" text;
4241
```
42+
- added `severity` field to help with triaging received events (PR#2575 by Kamil Mańkowski).
43+
To allow saving the field in PostgreSQL database in existing installations, the following schema update is necessary: `ALTER TABLE events ADD severity varchar(10);`.
4344

4445
### Bots
4546
#### Collectors

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ ALTER TABLE events ADD "product.name" text;
2727
ALTER TABLE events ADD "product.vendor" text;
2828
ALTER TABLE events ADD "product.version" text;
2929
ALTER TABLE events ADD "product.vulnerabilities" text;
30+
ALTER TABLE events ADD severity varchar(10);
3031
```
3132

3233
### Configuration

intelmq/etc/harmonization.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,12 @@
253253
"description": "Some source may report URLs related to a an image generated of a resource without any metadata. Or an URL pointing to resource, which has been rendered into a webshot, e.g. a PNG image and the relevant metadata related to its retrieval/generation.",
254254
"type": "URL"
255255
},
256+
"severity": {
257+
"description": "Severity of the event, based on the information from the source, and eventually modified by IntelMQ during processing. Meaning of the levels may differ based on the event source. Allowed values: critical (highly critical vulnerabilities being actively exploited and pose a very high likelihood of compromise. For example, RCEs, sensitive data access), high (end of life systems, accessible internal systems that should not be exposed, risk of data leaks, malware drone and sinkhole events), medium (DDoS-amplifiers, unencrypted services requiring login, vulnerabilities requiring MITM to exploit, attacks need prior knowledge), low (deviation from best practice, little to no practical way to exploit, but setup is not ideal), info (informational only, no known risk), undefined (unknown or undetermined)",
258+
"length": 10,
259+
"regex": "^(critical|high|medium|low|info|undefined)$",
260+
"type": "LowercaseString"
261+
},
256262
"source.abuse_contact": {
257263
"description": "Abuse contact for source address. A comma separated list.",
258264
"type": "LowercaseString"

intelmq/lib/upgrades.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
'v322_url_replacement',
4343
'v322_removed_feeds_and_bots',
4444
'v340_deprecations',
45-
'v341_blueliv_removal',
46-
'v342_new_fields'
45+
'v350_blueliv_removal',
46+
'v350_new_fields',
4747
]
4848

4949

@@ -976,7 +976,7 @@ def v340_deprecations(configuration, harmonization, dry_run, **kwargs):
976976
return message or changed, configuration, harmonization
977977

978978

979-
def v341_blueliv_removal(configuration, harmonization, dry_run, **kwargs):
979+
def v350_blueliv_removal(configuration, harmonization, dry_run, **kwargs):
980980
"""
981981
Remove blueliv collector and parser
982982
"""
@@ -999,7 +999,7 @@ def v341_blueliv_removal(configuration, harmonization, dry_run, **kwargs):
999999
return message, configuration, harmonization
10001000

10011001

1002-
def v342_new_fields(configuration, harmonization, dry_run, **kwargs):
1002+
def v350_new_fields(configuration, harmonization, dry_run, **kwargs):
10031003
"""
10041004
Add new fields to IntelMQ Data Format
10051005
"""
@@ -1011,6 +1011,7 @@ def v342_new_fields(configuration, harmonization, dry_run, **kwargs):
10111011
resource_filename("intelmq", "etc/harmonization.conf")
10121012
)
10131013
for field in [
1014+
"severity",
10141015
"product.full_name",
10151016
"product.name",
10161017
"product.vendor",
@@ -1056,8 +1057,7 @@ def v342_new_fields(configuration, harmonization, dry_run, **kwargs):
10561057
((3, 3, 0), ()),
10571058
((3, 3, 1), ()),
10581059
((3, 4, 0), (v340_deprecations, )),
1059-
((3, 4, 1), (v341_blueliv_removal, )),
1060-
((3, 4, 2), (v342_new_fields, )),
1060+
((3, 5, 0), (v350_blueliv_removal, v350_new_fields)),
10611061
])
10621062

10631063
ALWAYS = (harmonization,)

intelmq/tests/bin/initdb.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ CREATE TABLE events (
5757
"raw" text,
5858
"rtir_id" integer,
5959
"screenshot_url" text,
60+
"severity" varchar(10),
6061
"source.abuse_contact" text,
6162
"source.account" text,
6263
"source.allocated" timestamp with time zone,

intelmq/tests/lib/test_upgrades.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@
616616
"module": "intelmq.bots.collectors.twitter.collector",
617617
},
618618
}
619-
V341_BLUELIV_REMOVAL = {
619+
V350_BLUELIV_REMOVAL = {
620620
"global": {},
621621
"blueliv-collector": {
622622
"module": "intelmq.bots.collectors.blueliv.collector_crimeserver"
@@ -865,23 +865,26 @@ def test_v340_twitter_collector(self):
865865
self.assertIn('twitter-collector', result[0])
866866
self.assertEqual(V340_TWITTER_COLLECTOR_IN, result[1])
867867

868-
def test_v341_blueliv_removal(self):
869-
""" Test v341_blueliv_removal deprecation warning """
870-
result = upgrades.v341_blueliv_removal(V341_BLUELIV_REMOVAL, {}, False)
868+
def test_v350_blueliv_removal(self):
869+
""" Test v350_blueliv_removal deprecation warning """
870+
result = upgrades.v350_blueliv_removal(V350_BLUELIV_REMOVAL, {}, False)
871871
self.assertIn('blueliv-collector', result[0])
872872
self.assertIn('blueliv-parser', result[0])
873-
self.assertEqual(V341_BLUELIV_REMOVAL, result[1])
873+
self.assertEqual(V350_BLUELIV_REMOVAL, result[1])
874874

875-
def test_v342_new_fields(self):
875+
def test_v350_new_fields(self):
876876
""" Test adding new harmonisation fields """
877-
result = upgrades.v342_new_fields({}, {"event": {"old-field": "must stay"}}, False)
877+
result = upgrades.v350_new_fields({}, {"event": {"old-field": "must stay"}}, False)
878878
self.assertTrue(result[0])
879879
self.assertIn("old-field", result[2]["event"])
880880
self.assertIn("product.full_name", result[2]["event"])
881881
self.assertIn("product.name", result[2]["event"])
882882
self.assertIn("product.vendor", result[2]["event"])
883883
self.assertIn("product.version", result[2]["event"])
884884
self.assertIn("product.vulnerabilities", result[2]["event"])
885+
self.assertIn("old-field", result[2]["event"])
886+
self.assertIn("severity", result[2]["event"])
887+
885888

886889
for name in upgrades.__all__:
887890
setattr(TestUpgradeLib, 'test_function_%s' % name,

0 commit comments

Comments
 (0)