From e465477f640d0b53a32acaf85b9fcd10fcfb8cad Mon Sep 17 00:00:00 2001 From: DhavalPatelPersistent <93903969+DhavalPatelPersistent@users.noreply.github.com> Date: Mon, 14 Feb 2022 17:12:57 +0530 Subject: [PATCH] [JIRA CXFLW-100] Update CodeBashing API and documentation in Wiki (#927) * [JIRA CXFLW-100] Update CodeBashing API and documentation in Wiki [JIRA CXFLW-100] Update CodeBashing API and documentation in Wiki * Update CodeBashing.md --- docs/CodeBashing.md | 13 +++++++------ .../com/checkmarx/flow/service/JiraService.java | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/CodeBashing.md b/docs/CodeBashing.md index 821a2a3e1..9637db4a5 100644 --- a/docs/CodeBashing.md +++ b/docs/CodeBashing.md @@ -8,21 +8,22 @@ The link to CodeBashing is added under '**Training**' in the ticket recommendati By default CxFlow puts codebashing-url value in the link url ``` cx-flow: - codebash-url: https:... + codebash-url: https://api.codebashing.com/lessons ``` Now each customer (CodeBashing tenant), can use CxFlow to add training link to his tickets - with direct link to relevant course per language and CWE! The link will direct to the specific lesson under the customer CodeBashing account. -for example: (https://cxflow-account.codebashing.com/courses/backend_java/lessons/sql_injection) +for example: (https://{tenant}.codebashing.com/courses/backend_java/lessons/sql_injection) -To get direct CodeBashing integration and connect it to your own tenant, add the following section to CxFlow configuration: +To get direct CodeBashing integration you need your own tenant specific url for organization and secret. +Here, secret is the x-api-key of the codebashing application, provided on tenant creation. ``` codebashing: - codebashingApiUrl: https://api.codebashing.com/lessons - tenantBaseUrl: https://xxxxx.codebashing.com - apiSecret: SECRET + codebashing-api-url: https://api.codebashing.com/lessons + tenant-base-url: https://{tenant}.codebashing.com + api-secret: {SECRET} ``` diff --git a/src/main/java/com/checkmarx/flow/service/JiraService.java b/src/main/java/com/checkmarx/flow/service/JiraService.java index 7b0769155..85710d8f7 100644 --- a/src/main/java/com/checkmarx/flow/service/JiraService.java +++ b/src/main/java/com/checkmarx/flow/service/JiraService.java @@ -564,7 +564,7 @@ private void mapCustomFields(ScanRequest request, ScanResults.XIssue issue, Issu recommendation.append("Mitre Details: ").append(String.format(flowProperties.getMitreUrl(), issue.getCwe())).append(HTMLHelper.CRLF); } if (!ScanUtils.empty(flowProperties.getCodebashUrl())) { - recommendation.append("Training: ").append(flowProperties.getCodebashUrl()).append(HTMLHelper.CRLF); + recommendation.append("Training: ").append(issue.getAdditionalDetails().get(FlowConstants.CODE_BASHING_LESSON)).append(HTMLHelper.CRLF); } if (!ScanUtils.empty(flowProperties.getWikiUrl())) { recommendation.append("Guidance: ").append(flowProperties.getWikiUrl()).append(HTMLHelper.CRLF);