33
44
55class Detection (Schema ):
6- def __init__ (self , detection_type_id : str , type : str , message : str , detection_details : dict , detection_rule_id : str ):
6+ def __init__ (self , detection_type_id : str , type : str , message : str , detection_details : dict ,
7+ detection_rule_id : str , severity : Optional [str ] = None ):
78 super ().__init__ ()
89 self .message = message
910 self .type = type
11+ self .severity = severity
1012 self .detection_type_id = detection_type_id
1113 self .detection_details = detection_details
1214 self .detection_rule_id = detection_rule_id
1315
1416 def __repr__ (self ) -> str :
15- return (
16- "type:{0}, "
17- "message:{1}, "
18- "detection_details: {2}"
19- "detection_rule_id:{3}" .format (self .type , self .message , repr (self .detection_details ),
20- self .detection_rule_id )
21- )
17+ return f'type:{ self .type } , ' \
18+ f'severity:{ self .severity } , ' \
19+ f'message:{ self .message } , ' \
20+ f'detection_details:{ repr (self .detection_details )} , ' \
21+ f'detection_rule_id:{ self .detection_rule_id } '
2222
2323
2424class DetectionSchema (Schema ):
@@ -27,6 +27,8 @@ class Meta:
2727
2828 message = fields .String ()
2929 type = fields .String ()
30+ severity = fields .String (missing = 'High' )
31+ # TODO(MarshalX): Remove "missing" arg when IaC and Secrets scans will have classifications
3032 detection_type_id = fields .String ()
3133 detection_details = fields .Dict ()
3234 detection_rule_id = fields .String ()
0 commit comments