-
Notifications
You must be signed in to change notification settings - Fork 232
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
Reaqta various mapping fixes #1683
Conversation
Signed-off-by: DerekRushton <[email protected]>
Signed-off-by: DerekRushton <[email protected]>
Signed-off-by: DerekRushton <[email protected]>
Signed-off-by: DerekRushton <[email protected]>
Signed-off-by: DerekRushton <[email protected]>
Signed-off-by: DerekRushton <[email protected]>
Signed-off-by: DerekRushton <[email protected]>
Explaining the changes :
There were two possible solutions, we either map on the technique and change tactic_name to represent all the tactics, or we can create multiple mitre objects for each tactic. I've opted for the later to adhere to the extensions requirements. Hence I've transformed the array into a dict object where each object has the technique, tactic_name (using the map from reaqta UI) and the tactic_number as an extension. Then the TTP references are grouped up for each tactic. |
Explaining the changes :
Thus, I've added x-ibm-finding results for the policy_id (using it as the name of the alert) and either remapped the other references to x-reaqta or event objects, or removed them completely if the didn't fit. To my knowledge, there is no loss of information as all of it should be available in other objects. |
Explaining the changes :
I've changed this to no longer have that asset and instead map those fields to a reaqta extension object. There were other asset objects that made more sense. |
stix_shifter_modules/reaqta/test/stix_translation/test_reaqta_json_to_stix.py
Show resolved
Hide resolved
dict_list = [] | ||
for tactic in tactic_list: | ||
|
||
if (f"{tactic}" in TACTIC_NAME_MAPPING): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TACTIC_NAME_MAPPING.get(tactic)
more readable?
maybe you wanna change the dictionary name to simple lowercase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a better way to indicate that a field should not be modified? That field (TACTIC_NAME_MAPPING) should not change during run-time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can save it in stix_shifter_modules/reaqta/stix_translation/json
and read it from there. but that would be a overkill. this is already hard coded in the code. so no one will be able to change it anyway. you can probably add a debug log and add something in the comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll just modify it to use the lower case. There is already a comment describing it's purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tactic_name_mapping.get(tactic)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's what I've left it as.
Signed-off-by: DerekRushton <[email protected]>
if (f"{tactic}" in TACTIC_NAME_MAPPING): | ||
dict_list.append({"tactic_number": tactic, "tactic_name": TACTIC_NAME_MAPPING.get(f"{tactic}"), "technique":technique}) | ||
if (f"{tactic}" in tactic_name_mapping): | ||
dict_list.append({"tactic_number": tactic, "tactic_name": tactic_name_mapping.get(f"{tactic}"), "technique":technique}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason you need to f'string the tactic value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mapping was in string, but the values were int. I've changed the mapping to match what the API responds with (int) so I won't need the f string.
No description provided.