Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #181
Browse files Browse the repository at this point in the history
Use orgc_id instead of org_id for MISP filtering
  • Loading branch information
dominiklohmann authored Dec 15, 2021
2 parents 2097e28 + 2b81341 commit 56818e1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Every entry has a category for which we use the following visual abbreviations:

## Unreleased

- ⚠️ The `orgs` filter option in the MISP plugin now refers to the creator org
(`orgc_id`) instead of the owner org (`org_id`) of incoming MISP events.

- 🎁 Added a new field `%matchtype` to the `transform_context` setting of
`vast-threatbus` that can be used to distinguish between live and retro
matches.
Expand Down
6 changes: 3 additions & 3 deletions plugins/apps/threatbus_misp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ plugins:
ssl: false
key: MISP_API_KEY
filter: # filter are optional. you can omit the entire section.
- orgs: # org IDs must be strings: https://github.com/MISP/PyMISP/blob/main/pymisp/data/schema.json
- orgs: # creator org IDs must be strings: https://github.com/MISP/PyMISP/blob/main/pymisp/data/schema.json
- "1"
- "25"
tags:
Expand Down Expand Up @@ -112,8 +112,8 @@ The plugin can be configured with a list of filters. Every filter describes a
whitelist for MISP attributes (IoCs). The MISP plugin will only forward IoCs to
Threat Bus if the whitelisted properties are present.

A filter consists of three sub-whitelists for organizations, types, and tags.
To pass through the filter, an attribute must provide at least one of the
A filter consists of three sub-whitelists for creator organizations, types, and
tags. To pass through the filter, an attribute must provide at least one of the
whitelisted properties of each of the whitelists. More precisely, entries of
each whitelist are linked by an `"or"`-function, the whitelists themselves are
linked by an `"and"`-function, as follows:
Expand Down
8 changes: 4 additions & 4 deletions plugins/apps/threatbus_misp/threatbus_misp/message_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ def is_whitelisted(misp_msg: dict, filter_config: List[Dict]):
attr = misp_msg.get("Attribute", None)
if not event or not attr:
return False
org_id = event.get("org_id", None)
orgc_id = event.get("orgc_id", None)
intel_type = attr.get("type", None)
tags = get_tags(attr)
if not org_id or not intel_type:
if not orgc_id or not intel_type:
return False
if not filter_config:
# no whitelist = allow all
Expand All @@ -197,8 +197,8 @@ def is_whitelisted(misp_msg: dict, filter_config: List[Dict]):
# we check int(org_id) as well because MISP can give us strings
# for numeric org IDs
not fil.get("orgs", None)
or org_id in fil["orgs"]
or int(org_id) in fil["orgs"]
or orgc_id in fil["orgs"]
or int(orgc_id) in fil["orgs"]
)
and (not fil.get("types", None) or intel_type in fil["types"])
and (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def setUp(self):
"published": false,
"analysis": "0",
"threat_level_id": "1",
"org_id": "1",
"org_id": "3",
"orgc_id": "1",
"distribution": "1",
"sharing_group_id": "0",
Expand Down

0 comments on commit 56818e1

Please sign in to comment.