diff --git a/src/main/java/com/cx/restclient/CxSASTClient.java b/src/main/java/com/cx/restclient/CxSASTClient.java index 2a62cf09..d089fcab 100644 --- a/src/main/java/com/cx/restclient/CxSASTClient.java +++ b/src/main/java/com/cx/restclient/CxSASTClient.java @@ -802,7 +802,8 @@ private boolean isScanWithSettingsSupported() { HashMap swaggerResponse = this.httpClient.getRequest(SWAGGER_LOCATION, CONTENT_TYPE_APPLICATION_JSON, HashMap.class, 200, SAST_SCAN, false); return swaggerResponse.toString().contains("/sast/scanWithSettings"); } catch (Exception e) { - return false; + // Assuming something went wrong but SAST version is greater than 9.x + return true; } } diff --git a/src/main/java/com/cx/restclient/ast/AstScaClient.java b/src/main/java/com/cx/restclient/ast/AstScaClient.java index 79b28a0f..c74a6504 100644 --- a/src/main/java/com/cx/restclient/ast/AstScaClient.java +++ b/src/main/java/com/cx/restclient/ast/AstScaClient.java @@ -921,7 +921,7 @@ private String resolveRiskManagementProject() throws IOException { log.info("Created a project with ID {}", resolvedProjectId); } else { log.info("Project already exists with ID {}", resolvedProjectId); - UpdateRiskManagementProject(resolvedProjectId,projectCustomTag); + UpdateRiskManagementProject(resolvedProjectId,projectCustomTag,assignedTeam); } return resolvedProjectId; } @@ -1040,12 +1040,16 @@ private String createRiskManagementProject(String name, String assignedTeam, Str return newProject.getId(); } - private void UpdateRiskManagementProject(String projectId, String customTags) throws IOException { + private void UpdateRiskManagementProject(String projectId, String customTags, String assignedTeam) throws IOException { Project existingProject = httpClient.getRequest(PROJECTID.replace("id",projectId),ContentType.CONTENT_TYPE_APPLICATION_JSON,Project.class, HttpStatus.SC_OK,"got project details",false); UpdateProjectRequest request = new UpdateProjectRequest(); request.setName(existingProject.getName()); + if (!StringUtils.isEmpty(assignedTeam)) { + request.addAssignedTeams(assignedTeam); + log.info("Team name: {}", assignedTeam); + } log.info("Project level custom tag name: {}",customTags); if(existingProject.getTags()!=null){