@@ -255,6 +255,12 @@ def __repr__(self) -> str:
255
255
)
256
256
257
257
258
+ class DiffKinds (str , Enum ):
259
+ ADDITION = "addition"
260
+ DELETION = "deletion"
261
+ CONTEXT = "context"
262
+
263
+
258
264
class PolicyBreakSchema (BaseSchema ):
259
265
break_type = fields .String (data_key = "type" , required = True )
260
266
policy = fields .String (required = True )
@@ -264,6 +270,9 @@ class PolicyBreakSchema(BaseSchema):
264
270
matches = fields .List (fields .Nested (MatchSchema ), required = True )
265
271
is_excluded = fields .Boolean (required = False , load_default = False , dump_default = False )
266
272
exclude_reason = fields .String (required = False , load_default = None , dump_default = None )
273
+ diff_kind = fields .Enum (
274
+ DiffKinds , by_value = True , required = False , load_default = None , dump_default = None
275
+ )
267
276
268
277
@post_load
269
278
def make_policy_break (self , data : Dict [str , Any ], ** kwargs : Any ) -> "PolicyBreak" :
@@ -290,6 +299,7 @@ def __init__(
290
299
incident_url : Optional [str ] = None ,
291
300
is_excluded : bool = False ,
292
301
exclude_reason : Optional [str ] = None ,
302
+ diff_kind : Optional [DiffKinds ] = None ,
293
303
** kwargs : Any ,
294
304
) -> None :
295
305
super ().__init__ ()
@@ -301,6 +311,7 @@ def __init__(
301
311
self .matches = matches
302
312
self .is_excluded = is_excluded
303
313
self .exclude_reason = exclude_reason
314
+ self .diff_kind = diff_kind
304
315
305
316
@property
306
317
def is_secret (self ) -> bool :
@@ -318,6 +329,7 @@ class ScanResultSchema(BaseSchema):
318
329
policy_break_count = fields .Integer (required = True )
319
330
policies = fields .List (fields .String (), required = True )
320
331
policy_breaks = fields .List (fields .Nested (PolicyBreakSchema ), required = True )
332
+ is_diff = fields .Boolean (required = False , load_default = False , dump_default = None )
321
333
322
334
@post_load
323
335
def make_scan_result (self , data : Dict [str , Any ], ** kwargs : Any ) -> "ScanResult" :
@@ -341,6 +353,7 @@ def __init__(
341
353
policy_break_count : int ,
342
354
policy_breaks : List [PolicyBreak ],
343
355
policies : List [str ],
356
+ is_diff : bool ,
344
357
** kwargs : Any ,
345
358
) -> None :
346
359
"""
@@ -350,11 +363,14 @@ def __init__(
350
363
:type policy_breaks: List
351
364
:param policies: string list of policies evaluated
352
365
:type policies: List[str]
366
+ :param is_diff: true if the document scanned is a diff
367
+ :type is_diff: bool
353
368
"""
354
369
super ().__init__ ()
355
370
self .policy_break_count = policy_break_count
356
371
self .policies = policies
357
372
self .policy_breaks = policy_breaks
373
+ self .is_diff = is_diff
358
374
359
375
@property
360
376
def has_policy_breaks (self ) -> bool :
0 commit comments