| Modifier and Type | Field and Description |
|---|---|
static String |
ERROR_PROCESSING_RESULTS |
static String |
ERROR_PROCESSING_SCAN_RESULTS |
static String |
ERROR_WITH_XML_REPORT |
static String |
REPORT_LENGTH_MESSAGE |
static Integer |
REPORT_STATUS_CREATED |
| Constructor and Description |
|---|
CxService(CxAuthClient authClient,
CxProperties cxProperties,
CxLegacyService cxLegacyService,
org.springframework.web.client.RestTemplate restTemplate,
ScanSettingsClient scanSettingsClient,
FilterValidator filterValidator) |
| Modifier and Type | Method and Description |
|---|---|
Integer |
branchProject(Integer projectId,
String name)
Branch an existing project
|
void |
cancelScan(Integer scanId) |
Integer |
createProject(String ownerId,
String name)
Creates a CX Project.
|
Integer |
createScan(CxScanParams params,
String comment)
Create a scan based on the CxScanParams and return the scan Id
|
Integer |
createScan(Integer projectId,
boolean incremental,
boolean isPublic,
boolean forceScan,
String comment)
Create Scan for a projectId
|
CxXMLResultsType |
createScanAndReport(CxScanParams params,
String comment)
Create a scan based on the CxScanParams and wait for the scan to complete, returning the result XML Jaxb object
|
ScanResults |
createScanAndReport(CxScanParams params,
String comment,
FilterConfiguration filters)
Create a scan based on the CxScanParams and return the ScanResults object based on filters
|
Integer |
createScanReport(Integer scanId)
Generate a scan report request (xml) based on ScanId
|
Integer |
createScanSetting(Integer projectId,
Integer presetId,
Integer engineConfigId)
Create Scan Settings
|
String |
createTeam(String parentTeamId,
String teamName)
Create team under given parentId - Will use REST API to create team for version 9.0+
|
String |
createTeamWS(String parentTeamId,
String teamName)
Create team under given parentId
|
void |
deleteProject(Integer projectId)
Delete a project by Id
|
void |
deleteScan(Integer scanId) |
void |
deleteTeam(String teamId)
Create team under given parentId - Will use REST API to create team for version 9.0+
|
void |
deleteTeamWS(String teamId)
Delete team based on Id
|
protected Map<String,Object> |
getAdditionalScanDetails(CxXMLResultsType cxResults)
Creates a map of additional scan details, such as scanId, scan start date, scan risk,
scan risk severity, number of failed LOC, etc.
|
Map<String,String> |
getCustomFields(Integer projectId)
Returns custom field values read from a Checkmarx project, based on given projectId.
|
String |
getIssueDescription(Long scanId,
Long pathId) |
LocalDateTime |
getLastScanDate(Integer projectId)
Fetches the Timestamp of the last full scan
|
Integer |
getLastScanId(Integer projectId)
Get the last scan Id of a given project Id
|
CxXMLResultsType |
getLatestScanReport(String teamName,
String projectName)
Create a scan based on the CxScanParams and wait for the scan to complete, returning the result XML Jaxb object
|
ScanResults |
getLatestScanResults(String teamName,
String projectName,
FilterConfiguration filters)
Get the latest scan results by teamName and projectName with filtered results
|
Integer |
getLdapRoleMapId(Integer ldapServerId,
Integer roleId,
String ldapGroupDn)
Retrieve the Id of a role mapping associated with an LDAP Group DN
|
Integer |
getLdapServerId(String serverName) |
Integer |
getLdapTeamMapId(Integer ldapServerId,
String teamId,
String ldapGroupDn) |
ScanResults |
getOsaReportContent(File vulnsFile,
File libsFile,
List<Filter> filter) |
Integer |
getPresetId(String preset)
Fetch the Id of a given preset name
|
String |
getPresetName(Integer presetId)
Get Preset Name based on Id
|
CxProject |
getProject(Integer projectId)
Return Project based on projectId
|
Integer |
getProjectId(String ownerId,
String name)
Get All Projects under a specific team within Checkmarx
|
Integer |
getProjectPresetId(Integer projectId)
Get Preset Id of an existing project
|
List<CxProject> |
getProjects()
Get All Projects in Checkmarx
|
List<CxProject> |
getProjects(String teamId)
Get All Projects in Checkmarx
|
ScanResults |
getReportContent(File file,
FilterConfiguration filter)
Parse CX report file, mapped to ScanResults DTO, applying filtering as requested
|
ScanResults |
getReportContent(Integer reportId,
FilterConfiguration filter)
Retrieve the report by reportId, mapped to ScanResults DTO, applying filtering as requested
|
ScanResults |
getReportContentByScanId(Integer scanId,
FilterConfiguration filter)
Retrieve the report by reportId, mapped to ScanResults DTO, applying filtering as requested
|
Integer |
getReportStatus(Integer reportId)
Get the status of a report being generated by reportId
|
Integer |
getRoleId(String roleName)
Returns the Id of an associated role in Checkmarx
|
List<CxRoleLdap> |
getRoleLdap(Integer ldapServerId)
Retrieve list of Role LDAP mappings associated with an LDAP server Id
|
List<CxRole> |
getRoles()
Returns a list of roles in Checkmarx
|
Integer |
getScanConfiguration(String configuration)
Get scan configuration Id by name.
|
String |
getScanConfigurationName(int configurationId)
Get scan configuration name by Id.
|
org.json.JSONObject |
getScanData(String scanId)
Fetches scan data based on given scan identifier, as a
JSONObject. |
Integer |
getScanIdOfExistingScanIfExists(Integer projectId)
Get ScanId of existing scan if a scan exists for a projectId
|
String |
getScanSetting(Integer projectId)
Get Scan Settings for an existing project.
|
CxScanSettings |
getScanSettingsDto(int projectId) |
Integer |
getScanStatus(Integer scanId)
Get the status of a given scanId
|
CxScanSummary |
getScanSummary(Integer projectId)
Get the scan summary for the latest scan of a given project Id
|
CxScanSummary |
getScanSummary(String teamName,
String projectName)
Get the scan summary for the latest scan of a given team and project name
|
CxScanSummary |
getScanSummaryByScanId(Integer scanId)
Get scan summary for given scanId
|
String |
getStateFullName(String key) |
String |
getTeamId(String teamPath)
Get teamId for given path
|
String |
getTeamId(String parentTeamId,
String teamName)
Get a team Id based on the name and the Parent Team Id
|
List<CxTeamLdap> |
getTeamLdap(Integer ldapServerId)
Retrieve LDAP team mapping associations
|
String |
getTeamName(String teamId)
Get fully qualified team name for a given id
|
List<CxTeam> |
getTeams()
Fetches all teams
|
CxXMLResultsType |
getXmlReportContent(Integer reportId)
Retrieve the report by reportId, mapped to ScanResults DTO, applying filtering as requested
|
void |
mapRoleLdap(Integer ldapServerId,
Integer roleId,
String ldapGroupDn) |
void |
mapTeamLdap(Integer ldapServerId,
String teamId,
String teamName,
String ldapGroupDn)
Adds an LDAP team association - uses SOAP Web Service
|
void |
mapTeamLdapWS(Integer ldapServerId,
String teamId,
String teamName,
String ldapGroupDn)
Adds an LDAP team association - uses SOAP Web Service
|
void |
moveTeam(String teamId,
String newParentTeamId)
Move team to under given newParentId - Will use REST API to create team for version 9.0+
|
void |
moveTeamWS(String teamId,
String newParentTeamId)
Move team under the new parentId using SOAP
|
void |
removeRoleLdap(Integer roleMapId)
Removes a role/ldap mapping association
|
void |
removeRoleLdap(Integer ldapServerId,
Integer roleId,
String ldapGroupDn)
Removes a role/ldap mapping association
|
void |
removeTeamLdap(Integer ldapServerId,
String teamId,
String teamName,
String ldapGroupDn)
Removes an LDAP team association - uses SOAP Web Service
|
void |
removeTeamLdapWS(Integer ldapServerId,
String teamId,
String teamName,
String ldapGroupDn)
Removes an LDAP team association - uses SOAP Web Service
|
void |
renameTeam(String teamId,
String newTeamName)
Rename team (path is unaffected; only the actual name)
|
void |
renameTeamWS(String teamId,
String newTeamName)
Rename team (path is unaffected; only the actual name) using SOAP
|
boolean |
scanExists(Integer projectId)
Check if a scan exists for a projectId
|
void |
setProjectExcludeDetails(Integer projectId,
List<String> excludeFolders,
List<String> excludeFiles) |
void |
setProjectRepositoryDetails(Integer projectId,
String gitUrl,
String branch)
Set Repository details for a project
|
void |
updateProjectDetails(CxProject cxProject)
Update name and/or owning team for a project
|
void |
uploadProjectSource(Integer projectId,
File file)
Upload file (zip of source) for a project
|
void |
waitForScanCompletion(Integer scanId)
Wait for a for a scan with a given scan Id to complete with a finished or failure state
|
public static final Integer REPORT_STATUS_CREATED
public static final String REPORT_LENGTH_MESSAGE
public static final String ERROR_PROCESSING_RESULTS
public static final String ERROR_WITH_XML_REPORT
public static final String ERROR_PROCESSING_SCAN_RESULTS
public CxService(CxAuthClient authClient, CxProperties cxProperties, CxLegacyService cxLegacyService, @Qualifier(value="cxRestTemplate") org.springframework.web.client.RestTemplate restTemplate, ScanSettingsClient scanSettingsClient, FilterValidator filterValidator)
public Integer createScan(Integer projectId, boolean incremental, boolean isPublic, boolean forceScan, String comment)
projectId - incremental - isPublic - forceScan - comment - public Integer getLastScanId(Integer projectId)
CxClientgetLastScanId in interface CxClientprojectId - project Idpublic org.json.JSONObject getScanData(String scanId)
JSONObject.getScanData in interface CxClientscanId - scan ID to useJSONObject if scan data was fetched; empty otherwise.public LocalDateTime getLastScanDate(Integer projectId)
CxClientgetLastScanDate in interface CxClientpublic Integer getScanStatus(Integer scanId)
getScanStatus in interface CxClientscanId - public Integer createScanReport(Integer scanId)
createScanReport in interface CxClientpublic Integer getReportStatus(Integer reportId) throws CheckmarxException
getReportStatus in interface CxClientCheckmarxExceptionpublic ScanResults getReportContentByScanId(Integer scanId, FilterConfiguration filter) throws CheckmarxException
getReportContentByScanId in interface CxClientCheckmarxExceptionpublic ScanResults getReportContent(Integer reportId, FilterConfiguration filter) throws CheckmarxException
getReportContent in interface CxClientCheckmarxExceptionpublic CxXMLResultsType getXmlReportContent(Integer reportId) throws CheckmarxException
getXmlReportContent in interface CxClientCheckmarxExceptionprotected Map<String,Object> getAdditionalScanDetails(CxXMLResultsType cxResults)
cxResults - the source to usepublic Map<String,String> getCustomFields(Integer projectId)
getCustomFields in interface CxClientprojectId - ID of project to lookup from Checkmarxpublic ScanResults getReportContent(File file, FilterConfiguration filter) throws CheckmarxException
getReportContent in interface CxClientCheckmarxExceptionpublic ScanResults getOsaReportContent(File vulnsFile, File libsFile, List<Filter> filter) throws CheckmarxException
getOsaReportContent in interface CxClientCheckmarxExceptionpublic String getIssueDescription(Long scanId, Long pathId)
getIssueDescription in interface CxClientpublic Integer createProject(String ownerId, String name)
Naming convention is namespace-repo-branch
createProject in interface CxClientpublic void deleteProject(Integer projectId)
CxClientdeleteProject in interface CxClientpublic Integer branchProject(Integer projectId, String name)
CxClientbranchProject in interface CxClientprojectId - Id of the existing project to branchname - Name for the new branched projectpublic List<CxProject> getProjects() throws CheckmarxException
getProjects in interface CxClientCheckmarxExceptionpublic List<CxProject> getProjects(String teamId) throws CheckmarxException
getProjects in interface CxClientCheckmarxExceptionpublic Integer getProjectId(String ownerId, String name)
CxClientusing TeamId does not work.
getProjectId in interface CxClientpublic CxProject getProject(Integer projectId)
getProject in interface CxClientpublic boolean scanExists(Integer projectId)
scanExists in interface CxClientprojectId - public Integer getScanIdOfExistingScanIfExists(Integer projectId)
getScanIdOfExistingScanIfExists in interface CxClientprojectId - public Integer createScanSetting(Integer projectId, Integer presetId, Integer engineConfigId)
createScanSetting in interface CxClientpublic String getScanSetting(Integer projectId)
getScanSetting in interface CxClientpublic CxScanSettings getScanSettingsDto(int projectId)
getScanSettingsDto in interface CxClientpublic Integer getProjectPresetId(Integer projectId)
CxClientgetProjectPresetId in interface CxClientpublic String getPresetName(Integer presetId)
CxClientgetPresetName in interface CxClientpublic void setProjectRepositoryDetails(Integer projectId, String gitUrl, String branch) throws CheckmarxException
setProjectRepositoryDetails in interface CxClientprojectId - gitUrl - branch - CheckmarxExceptionpublic void updateProjectDetails(CxProject cxProject) throws CheckmarxException
updateProjectDetails in interface CxClientcxProject - CheckmarxExceptionpublic void uploadProjectSource(Integer projectId, File file) throws CheckmarxException
uploadProjectSource in interface CxClientprojectId - file - CheckmarxExceptionpublic void setProjectExcludeDetails(Integer projectId, List<String> excludeFolders, List<String> excludeFiles)
setProjectExcludeDetails in interface CxClientprojectId - Id of Checkmarx ProjectexcludeFolders - list of folder exclusions to apply to a scanexcludeFiles - list of file exclusions to apply to a scanpublic String getTeamId(String teamPath) throws CheckmarxException
getTeamId in interface CxClientteamPath - Fully qualified name/path of the team to lookupCheckmarxExceptionpublic String getTeamName(String teamId) throws CheckmarxException
teamId - TeamID to lookupCheckmarxExceptionpublic String getTeamId(String parentTeamId, String teamName) throws CheckmarxException
getTeamId in interface CxClientparentTeamId - Parent team's TeamIDteamName - Short name of the team to lookupCheckmarxExceptionpublic String createTeam(String parentTeamId, String teamName) throws CheckmarxException
CxClientcreateTeam in interface CxClientCheckmarxExceptionpublic void deleteTeam(String teamId) throws CheckmarxException
CxClientdeleteTeam in interface CxClientCheckmarxExceptionpublic void moveTeam(String teamId, String newParentTeamId) throws CheckmarxException
CxClientmoveTeam in interface CxClientteamId - - Id of the team to be movednewParentTeamId - - id of the new parent teamCheckmarxExceptionpublic void renameTeam(String teamId, String newTeamName) throws CheckmarxException
CxClientrenameTeam in interface CxClientteamId - - Id of the team to be renamednewTeamName - - new team nameCheckmarxExceptionpublic String createTeamWS(String parentTeamId, String teamName) throws CheckmarxException
createTeamWS in interface CxClientparentTeamId - teamName - CheckmarxExceptionpublic void deleteTeamWS(String teamId) throws CheckmarxException
deleteTeamWS in interface CxClientteamId - CheckmarxExceptionpublic void moveTeamWS(String teamId, String newParentTeamId) throws CheckmarxException
newParentTeamId - Id of the new parent teamteamId - Id of the team to be movedCheckmarxExceptionpublic void renameTeamWS(String teamId, String newTeamName) throws CheckmarxException
teamId - - Id of the team to be renamednewTeamName - - new team nameCheckmarxExceptionpublic Integer getScanConfiguration(String configuration) throws CheckmarxException
getScanConfiguration in interface CxClientconfiguration - configuration nameCheckmarxExceptionpublic String getScanConfigurationName(int configurationId)
CxClientgetScanConfigurationName in interface CxClientpublic Integer getPresetId(String preset) throws CheckmarxException
CxClientgetPresetId in interface CxClientpreset - name of the preset to find the Id forCheckmarxExceptionpublic CxScanSummary getScanSummaryByScanId(Integer scanId) throws CheckmarxException
getScanSummaryByScanId in interface CxClientscanId - CheckmarxExceptionpublic CxScanSummary getScanSummary(Integer projectId) throws CheckmarxException
getScanSummary in interface CxClientprojectId - project Id to retrieve the latest scan summary forCheckmarxExceptionpublic CxScanSummary getScanSummary(String teamName, String projectName) throws CheckmarxException
getScanSummary in interface CxClientteamName - projectName - CheckmarxExceptionpublic Integer createScan(CxScanParams params, String comment) throws CheckmarxException
CxClientcreateScan in interface CxClientparams - attributes used to define the projectCheckmarxExceptionpublic CxXMLResultsType createScanAndReport(CxScanParams params, String comment) throws CheckmarxException
CxClientcreateScanAndReport in interface CxClientparams - attributes used to define the projectcomment - CheckmarxExceptionpublic ScanResults createScanAndReport(CxScanParams params, String comment, FilterConfiguration filters) throws CheckmarxException
CxClientcreateScanAndReport in interface CxClientparams - attributes used to define the projectcomment - filters - filters to apply to the scan result set (severity, category, cwe)CheckmarxExceptionpublic void deleteScan(Integer scanId) throws CheckmarxException
deleteScan in interface CxClientscanId - CheckmarxExceptionpublic void cancelScan(Integer scanId) throws CheckmarxException
cancelScan in interface CxClientscanId - CheckmarxExceptionpublic CxXMLResultsType getLatestScanReport(String teamName, String projectName) throws CheckmarxException
CxClientgetLatestScanReport in interface CxClientteamName - projectName - CheckmarxExceptionpublic ScanResults getLatestScanResults(String teamName, String projectName, FilterConfiguration filters) throws CheckmarxException
getLatestScanResults in interface CxClientteamName - projectName - filters - CheckmarxExceptionpublic List<CxTeam> getTeams() throws CheckmarxException
CxClientgetTeams in interface CxClientCheckmarxExceptionpublic void mapTeamLdap(Integer ldapServerId, String teamId, String teamName, String ldapGroupDn) throws CheckmarxException
CxClientmapTeamLdap in interface CxClientldapServerId - teamId - teamName - not used in 9.0+ldapGroupDn - CheckmarxExceptionpublic List<CxTeamLdap> getTeamLdap(Integer ldapServerId) throws CheckmarxException
CxClientgetTeamLdap in interface CxClientldapServerId - CheckmarxExceptionpublic void removeTeamLdap(Integer ldapServerId, String teamId, String teamName, String ldapGroupDn) throws CheckmarxException
CxClientremoveTeamLdap in interface CxClientteamName - can be null/empty if using 9.0. Only applicable to 8.xCheckmarxExceptionpublic Integer getLdapTeamMapId(Integer ldapServerId, String teamId, String ldapGroupDn) throws CheckmarxException
getLdapTeamMapId in interface CxClientCheckmarxExceptionpublic void mapTeamLdapWS(Integer ldapServerId, String teamId, String teamName, String ldapGroupDn) throws CheckmarxException
CxClientmapTeamLdapWS in interface CxClientCheckmarxExceptionpublic void removeTeamLdapWS(Integer ldapServerId, String teamId, String teamName, String ldapGroupDn) throws CheckmarxException
CxClientremoveTeamLdapWS in interface CxClientCheckmarxExceptionpublic List<CxRole> getRoles() throws CheckmarxException
CxClientgetRoles in interface CxClientCheckmarxExceptionpublic List<CxRoleLdap> getRoleLdap(Integer ldapServerId) throws CheckmarxException
CxClientgetRoleLdap in interface CxClientldapServerId - CheckmarxExceptionpublic Integer getRoleId(String roleName) throws CheckmarxException
CxClientgetRoleId in interface CxClientCheckmarxExceptionpublic void mapRoleLdap(Integer ldapServerId, Integer roleId, String ldapGroupDn) throws CheckmarxException
mapRoleLdap in interface CxClientCheckmarxExceptionpublic void removeRoleLdap(Integer ldapServerId, Integer roleId, String ldapGroupDn) throws CheckmarxException
CxClientremoveRoleLdap in interface CxClientCheckmarxExceptionpublic void removeRoleLdap(Integer roleMapId) throws CheckmarxException
CxClientremoveRoleLdap in interface CxClientCheckmarxExceptionpublic Integer getLdapRoleMapId(Integer ldapServerId, Integer roleId, String ldapGroupDn) throws CheckmarxException
CxClientgetLdapRoleMapId in interface CxClientCheckmarxExceptionpublic Integer getLdapServerId(String serverName) throws CheckmarxException
getLdapServerId in interface CxClientCheckmarxExceptionpublic void waitForScanCompletion(Integer scanId) throws CheckmarxException
waitForScanCompletion in interface CxClientscanId - CheckmarxExceptionCopyright © 2020. All rights reserved.