@@ -263,11 +263,11 @@ def test_get_all_topics():
263
263
create_user (USER2 )
264
264
create_pteam (USER1 , PTEAM1 )
265
265
266
- topic1 = create_topic (USER1 , {** TOPIC1 , "threat_impact " : 1 }, actions = [ACTION1 , ACTION2 ])
267
- topic2 = create_topic (USER1 , {** TOPIC2 , "threat_impact " : 2 }, actions = [ACTION3 ])
268
- topic3 = create_topic (USER1 , {** TOPIC3 , "threat_impact " : 3 })
269
- topic4 = create_topic (USER1 , {** TOPIC4 , "threat_impact " : 2 })
270
- topic5 = create_topic (USER2 , {** TOPIC1 , "threat_impact " : 1 , "topic_id" : str (uuid4 ())})
266
+ topic1 = create_topic (USER1 , {** TOPIC1 , "cvss_v3_score " : 10 }, actions = [ACTION1 , ACTION2 ])
267
+ topic2 = create_topic (USER1 , {** TOPIC2 , "cvss_v3_score " : 2 }, actions = [ACTION3 ])
268
+ topic3 = create_topic (USER1 , {** TOPIC3 , "cvss_v3_score " : None })
269
+ topic4 = create_topic (USER1 , {** TOPIC4 , "cvss_v3_score " : 2 })
270
+ topic5 = create_topic (USER2 , {** TOPIC1 , "cvss_v3_score " : 10 , "topic_id" : str (uuid4 ())})
271
271
272
272
data = assert_200 (client .get ("/topics" , headers = headers (USER1 )))
273
273
assert len (data ) == 5
@@ -985,6 +985,7 @@ def create_minimal_topic(user: dict, params: dict) -> schemas.TopicCreateRespons
985
985
"title" : "" ,
986
986
"abstract" : "" ,
987
987
"threat_impact" : 1 ,
988
+ "cvss_v3_score" : 10.0 ,
988
989
** params ,
989
990
"exploitation" : "active" ,
990
991
"automatable" : "yes" ,
@@ -1464,16 +1465,16 @@ def try_search_topics(user, topics_dict, search_params, expected):
1464
1465
class TestSearchResultSlice (ExtCommonForResultSlice_ ):
1465
1466
@pytest .fixture (scope = "function" , autouse = True )
1466
1467
def setup_for_result_slice (self ):
1467
- self .topic1 = self .create_minimal_topic (USER1 , {"threat_impact " : 1 })
1468
- self .topic2 = self .create_minimal_topic (USER1 , {"threat_impact " : 2 })
1469
- self .topic3 = self .create_minimal_topic (USER1 , {"threat_impact " : 3 })
1470
- self .topic4 = self .create_minimal_topic (USER1 , {"threat_impact " : 4 })
1471
- self .topic5 = self .create_minimal_topic (USER1 , {"threat_impact " : 1 })
1472
- self .topic6 = self .create_minimal_topic (USER1 , {"threat_impact " : 2 })
1473
- self .topic7 = self .create_minimal_topic (USER1 , {"threat_impact " : 3 })
1474
- update_topic (USER1 , self .topic5 , {"threat_impact " : 2 })
1475
- update_topic (USER1 , self .topic2 , {"threat_impact " : 1 })
1476
- update_topic (USER1 , self .topic6 , {"threat_impact " : 3 })
1468
+ self .topic1 = self .create_minimal_topic (USER1 , {"cvss_v3_score " : 10 })
1469
+ self .topic2 = self .create_minimal_topic (USER1 , {"cvss_v3_score " : 8 })
1470
+ self .topic3 = self .create_minimal_topic (USER1 , {"cvss_v3_score " : 3 })
1471
+ self .topic4 = self .create_minimal_topic (USER1 , {"cvss_v3_score " : None })
1472
+ self .topic5 = self .create_minimal_topic (USER1 , {"cvss_v3_score " : 10 })
1473
+ self .topic6 = self .create_minimal_topic (USER1 , {"cvss_v3_score " : 8 })
1474
+ self .topic7 = self .create_minimal_topic (USER1 , {"cvss_v3_score " : 3 })
1475
+ update_topic (USER1 , self .topic5 , {"cvss_v3_score " : 8 })
1476
+ update_topic (USER1 , self .topic2 , {"cvss_v3_score " : 10 })
1477
+ update_topic (USER1 , self .topic6 , {"cvss_v3_score " : 3 })
1477
1478
self .topics = {
1478
1479
1 : self .topic1 ,
1479
1480
2 : self .topic2 ,
@@ -1496,16 +1497,16 @@ def setup_for_result_slice(self):
1496
1497
# sort_key
1497
1498
(
1498
1499
(None , None , None ), # check defaults
1499
- ([2 , 1 , 5 , 6 , 7 , 3 , 4 ], 7 , 0 , 10 , "threat_impact " ),
1500
+ ([2 , 1 , 5 , 6 , 7 , 3 , 4 ], 7 , 0 , 10 , "cvss_v3_score_desc " ),
1500
1501
),
1501
1502
((None , None , "my_sort_key" ), "422: Unprocessable Entity: " ),
1502
1503
(
1503
- (None , None , "threat_impact " ), # implicit 2nd key is updated_at_desc
1504
- ([2 , 1 , 5 , 6 , 7 , 3 , 4 ], 7 , 0 , 10 , "threat_impact " ),
1504
+ (None , None , "cvss_v3_score_desc " ), # implicit 2nd key is updated_at_desc
1505
+ ([2 , 1 , 5 , 6 , 7 , 3 , 4 ], 7 , 0 , 10 , "cvss_v3_score_desc " ),
1505
1506
),
1506
1507
(
1507
- (None , None , "threat_impact_desc " ), # implicit 2nd key is updated_at_desc
1508
- ([4 , 6 , 7 , 3 , 5 , 2 , 1 ], 7 , 0 , 10 , "threat_impact_desc " ),
1508
+ (None , None , "cvss_v3_score " ), # implicit 2nd key is updated_at_desc
1509
+ ([4 , 6 , 7 , 3 , 5 , 2 , 1 ], 7 , 0 , 10 , "cvss_v3_score " ),
1509
1510
),
1510
1511
(
1511
1512
(None , None , "updated_at" ), # implicit 2nd key is threat_impact
@@ -1518,29 +1519,29 @@ def setup_for_result_slice(self):
1518
1519
# offset
1519
1520
(
1520
1521
(0 , None , None ),
1521
- ([2 , 1 , 5 , 6 , 7 , 3 , 4 ], 7 , 0 , 10 , "threat_impact " ),
1522
+ ([2 , 1 , 5 , 6 , 7 , 3 , 4 ], 7 , 0 , 10 , "cvss_v3_score_desc " ),
1522
1523
),
1523
1524
(("xxx" , None , None ), "422: Unprocessable Entity: " ),
1524
1525
((- 1 , None , None ), "422: Unprocessable Entity: " ), # offset should be >=0
1525
1526
(
1526
1527
(5 , None , None ),
1527
- ([3 , 4 ], 7 , 5 , 10 , "threat_impact " ),
1528
+ ([3 , 4 ], 7 , 5 , 10 , "cvss_v3_score_desc " ),
1528
1529
),
1529
1530
(
1530
1531
(10 , None , None ),
1531
- ([], 7 , 10 , 10 , "threat_impact " ),
1532
+ ([], 7 , 10 , 10 , "cvss_v3_score_desc " ),
1532
1533
),
1533
1534
# limit
1534
1535
(
1535
1536
(None , 10 , None ),
1536
- ([2 , 1 , 5 , 6 , 7 , 3 , 4 ], 7 , 0 , 10 , "threat_impact " ),
1537
+ ([2 , 1 , 5 , 6 , 7 , 3 , 4 ], 7 , 0 , 10 , "cvss_v3_score_desc " ),
1537
1538
),
1538
1539
((None , "xxx" , None ), "422: Unprocessable Entity: " ),
1539
1540
((None , 0 , None ), "422: Unprocessable Entity: " ), # limit should be >= 1
1540
1541
((None , 101 , None ), "422: Unprocessable Entity: " ), # limit should be <= 100
1541
1542
(
1542
1543
(None , 5 , None ),
1543
- ([2 , 1 , 5 , 6 , 7 ], 7 , 0 , 5 , "threat_impact " ),
1544
+ ([2 , 1 , 5 , 6 , 7 ], 7 , 0 , 5 , "cvss_v3_score_desc " ),
1544
1545
),
1545
1546
# complex
1546
1547
(
0 commit comments