@@ -246,17 +246,24 @@ def start_pov():
246246 pc_api .adoptionadvisor_report_create (report_to_add = body_params )
247247 logging .info ("API - Created Cloud Security Report" )
248248
249+ enforcement_rules = pc_api .enforcement_rules_read ()
250+
251+ # Extract the id where mainRule is True
252+ main_rule_id = next ((rule ["id" ] for rule in enforcement_rules ["rules" ] if rule .get ("mainRule" )), None )
253+
254+ logging .info (f"API - Enforcement rules - Main Rule ID: { main_rule_id } " )
249255 # Prepare the body parameters for the update
250256 body_params = {
251- "id" : "8d57f69b-fbe6-4749-b53c-1e0f0881ad3d " ,
257+ "id" : f" { main_rule_id } " ,
252258 "name" : "Security default findings" ,
253259 "repositories" : [],
260+ "labels" : [],
254261 "codeCategories" : {
255- "LICENSES" : {"softFailThreshold" : "LOW" , "hardFailThreshold" : "OFF" , "commentsBotThreshold" : "LOW " },
256- "VULNERABILITIES" : {"softFailThreshold" : "LOW" , "hardFailThreshold" : "OFF" , "commentsBotThreshold" : "LOW " },
262+ "LICENSES" : {"softFailThreshold" : "LOW" , "hardFailThreshold" : "OFF" , "commentsBotThreshold" : "HIGH " },
263+ "VULNERABILITIES" : {"softFailThreshold" : "LOW" , "hardFailThreshold" : "OFF" , "commentsBotThreshold" : "HIGH " },
257264 "IAC" : {"softFailThreshold" : "INFO" , "hardFailThreshold" : "OFF" , "commentsBotThreshold" : "INFO" },
258265 "WEAKNESSES" : {"softFailThreshold" : "OFF" , "hardFailThreshold" : "OFF" , "commentsBotThreshold" : "OFF" },
259- "SECRETS" : {"softFailThreshold" : "LOW" , "hardFailThreshold" : "OFF" , "commentsBotThreshold" : "LOW " },
266+ "SECRETS" : {"softFailThreshold" : "LOW" , "hardFailThreshold" : "OFF" , "commentsBotThreshold" : "HIGH " },
260267 "BUILD_INTEGRITY" : {"softFailThreshold" : "OFF" , "hardFailThreshold" : "OFF" , "commentsBotThreshold" : "OFF" },
261268 },
262269 }
0 commit comments