[TR-82] first cut of validation logic for risk scoring.

This commit is contained in:
jzsplunk
2020-09-01 17:55:14 -07:00
parent 5efea5eb85
commit 0db46f89dc
2 changed files with 31 additions and 0 deletions
+22
View File
@@ -121,6 +121,28 @@ def validate_standard_fields(object, uuids):
except ValueError:
errors.append("ERROR: Incorrect date format, should be YYYY-MM-DD for object: %s" % object['name'])
# logic for handling risk related tags which are a triple of k/v pairs
# risk_object, risk_object_type and risk_score
# the first two fields risk_object, and risk_object_type are an enum of fixed values
# defined by ESCU risk scoring
if 'risk_object' in object:
try:
object['risk_object'].encode('ascii')
except UnicodeEncodeError:
errors.append("ERROR: description not ascii for object: %s" % object['name'])
if 'risk_object_type' in object:
try:
object['risk_object_type'].encode('ascii')
except UnicodeEncodeError:
errors.append("ERROR: description not ascii for object: %s" % object['name'])
if 'risk_object_score' in object:
try:
object['risk_score'].isnumeric()
except UnicodeEncodeError:
errors.append("ERROR: description not numeric value for object: %s" % object['name'])
return errors, uuids
+9
View File
@@ -106,6 +106,15 @@
"examples": [
{
"analytics_story": "credential_dumping",
"kill_chain_phases": "Action on Objectives",
"mitre_attack_id": "T1078.004",
"cis20": "CIS 13",
"nist": "DE.DP",
"security domain": "network",
"asset_type": "AWS Instance",
"risk_object": "user",
"risk_object_type": "network_artifacts",
"risk score": "60",
"custom_key": "custom_value"
}
],