private static Audit getSecurityAudit ( JSONArray jsonArray , JSONArray global ) { LOGGER . info ( "NFRR Audit Collector auditing STATIC_SECURITY_ANALYSIS" ) ; Audit audit = new Audit ( ) ; audit . setType ( AuditType . STATIC_SECURITY_ANALYSIS ) ; Audit basicAudit ; if ( ( basicAudit = doBasicAuditCheck ( jsonArray , global , AuditType . STATIC_SECURITY_ANALYSIS ) ) != null ) { return basicAudit ; } Set < String > auditStatuses ; for ( Object o : jsonArray ) { JSONArray auditJO = ( JSONArray ) ( ( JSONObject ) o ) . get ( STR_AUDITSTATUSES ) ; Optional < Object > urlOptObj = Optional . ofNullable ( ( ( JSONObject ) o ) . get ( STR_URL ) ) ; urlOptObj . ifPresent ( urlObj -> audit . getUrl ( ) . add ( urlOptObj . get ( ) . toString ( ) ) ) ; auditJO . stream ( ) . forEach ( status -> audit . getAuditStatusCodes ( ) . add ( ( String ) status ) ) ; } auditStatuses = audit . getAuditStatusCodes ( ) ; if ( auditStatuses . contains ( CodeQualityAuditStatus . STATIC_SECURITY_SCAN_FAIL . name ( ) ) || auditStatuses . contains ( CodeQualityAuditStatus . STATIC_SECURITY_SCAN_FOUND_HIGH . name ( ) ) || auditStatuses . contains ( CodeQualityAuditStatus . STATIC_SECURITY_SCAN_FOUND_CRITICAL . name ( ) ) ) { audit . setAuditStatus ( AuditStatus . FAIL ) ; audit . setDataStatus ( DataStatus . OK ) ; } else if ( auditStatuses . contains ( CodeQualityAuditStatus . STATIC_SECURITY_SCAN_OK . name ( ) ) ) { audit . setAuditStatus ( AuditStatus . OK ) ; audit . setDataStatus ( DataStatus . OK ) ; } else { audit . setAuditStatus ( AuditStatus . NA ) ; audit . setDataStatus ( DataStatus . NO_DATA ) ; } return audit ; }
Get security audit results