@@ -172,23 +171,31 @@ const TestEditorFileExplorer = ({addCustomTest}) => {
Custom
+
+ {customItems.count.toString()}
+
{/* addCustomTest(e)}>
*/}
- {showCustom ? : null}
+ {showCustom ? : null}
- {showAkto ? : null}
+ {showAkto ? : null}
diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/components/editor_config/keywords.js b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/components/editor_config/keywords.js
index 61e6bb94cb..4b6271e482 100644
--- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/components/editor_config/keywords.js
+++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/components/editor_config/keywords.js
@@ -12,7 +12,7 @@ const keywords = [
"api_selection_filters", "execute", "type", "auth", "validate", "authenticated",
"private_variable_context", "param_context", "endpoint_in_traffic_context",
"sample_request_payload", "sample_response_payload", "sample_request_headers", "sample_response_headers",
- "test_request_payload", "test_response_payload", "test_request_headers", "test_response_headers", "cwe"
+ "test_request_payload", "test_response_payload", "test_request_headers", "test_response_headers", "cwe", "cve"
]
export default keywords
\ No newline at end of file
diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/transform.js b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/transform.js
index 5fbae5f9a7..ae455bd2ed 100644
--- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/transform.js
+++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/transform.js
@@ -57,6 +57,7 @@ const convertFunc = {
getNavigationItems(testObj,param,selectedFunc){
let arr = []
+ let count = 0;
if(param === 'CUSTOM'){
for(const key in testObj?.customTests){
if(testObj.customTests.hasOwnProperty(key)){
@@ -86,6 +87,7 @@ const convertFunc = {
}
}
}
+ count = testObj?.totalCustomTests;
}else{
for(const key in testObj?.aktoTests){
if(testObj.aktoTests.hasOwnProperty(key)){
@@ -115,8 +117,9 @@ const convertFunc = {
}
}
}
+ count = testObj?.totalAktoTests;
}
- return arr
+ return {items: arr, count: count}
},
mapVulnerableRequests(vulnerableRequests){
diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/ExportHtml/ExportHtml.jsx b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/ExportHtml/ExportHtml.jsx
index 5f69572f69..7b30503376 100644
--- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/ExportHtml/ExportHtml.jsx
+++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/ExportHtml/ExportHtml.jsx
@@ -4,7 +4,7 @@ import issuesApi from '../../issues/api';
import api from '../api';
import PersistStore from '../../../../main/PersistStore';
import { Avatar, Box, Button,Frame, HorizontalGrid, HorizontalStack, LegacyCard, Text, TopBar, VerticalStack, Icon, Badge, List, Link } from '@shopify/polaris'
-import {FlagMajor, CollectionsMajor, ResourcesMajor, InfoMinor, CreditCardSecureMajor} from "@shopify/polaris-icons"
+import {FlagMajor, CollectionsMajor, ResourcesMajor, InfoMinor, CreditCardSecureMajor, FraudProtectMajor} from "@shopify/polaris-icons"
import func from '@/util/func'
import './styles.css'
import transform from '../transform';
@@ -34,6 +34,11 @@ function ExportHtml() {
title: "CWE",
content: ""
},
+ {
+ icon: FraudProtectMajor,
+ title: "CVE",
+ content: ""
+ },
{
icon: ResourcesMajor,
title: "References",
@@ -183,85 +188,7 @@ function ExportHtml() {
}
const fillContent = (item) => {
- let filledSection = []
- moreInfoSections.forEach((section) => {
- let sectionLocal = {}
- sectionLocal.icon = section.icon
- sectionLocal.title = section.title
- switch(section.title) {
- case "Description":
- sectionLocal.content = (
-
- {replaceTags(item.category.issueDetails, item.category.vulnerableTestingRunResults) || "No impact found"}
-
- )
- break;
- case "Impact":
- sectionLocal.content = (
-
- {item.category.issueImpact || "No impact found"}
-
- )
- break;
- case "Tags":
- sectionLocal.content = (
-
- {
- item?.category?.issueTags?.map((tag, index) => {
- return (
- {tag}
- )
- })
- }
-
- )
-
- break;
- case "CWE":
- sectionLocal.content = (
-
- {
- transform.tagList(item?.category?.cwe, true)
- }
-
- )
- break;
- case "References":
- sectionLocal.content = (
-
- {
- item?.category?.references?.map((reference) => {
- return (
-
-
-
- {reference}
-
-
-
- )
- })
- }
-
- )
- break;
- }
- filledSection.push(sectionLocal)
- })
- return filledSection
- }
-
- const replaceTags = (details, vulnerableRequests) => {
- let percentageMatch = 0;
- vulnerableRequests?.forEach((request) => {
- let testRun = request['testResults']
- testRun?.forEach((runResult) => {
- if (percentageMatch < runResult.percentageMatch) {
- percentageMatch = runResult.percentageMatch
- }
- })
- })
- return details.replace(/{{percentageMatch}}/g, func.prettifyShort(percentageMatch))
+ return transform.fillMoreInformation(item.category, moreInfoSections);
}
diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/TestRunResultPage/TestRunResultPage.jsx b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/TestRunResultPage/TestRunResultPage.jsx
index 6bca26bcbc..dc1fe85b43 100644
--- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/TestRunResultPage/TestRunResultPage.jsx
+++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/TestRunResultPage/TestRunResultPage.jsx
@@ -7,7 +7,8 @@ import {
CollectionsMajor,
FlagMajor,
CreditCardSecureMajor,
- MarketingMajor} from '@shopify/polaris-icons';
+ MarketingMajor,
+ FraudProtectMajor} from '@shopify/polaris-icons';
import {
Text,
Button,
@@ -83,6 +84,11 @@ let moreInfoSections = [
title: "CWE",
content: ""
},
+ {
+ icon: FraudProtectMajor,
+ title: "CVE",
+ content: ""
+ },
{
icon: MarketingMajor,
title: "API endpoints affected",
@@ -185,7 +191,7 @@ function TestRunResultPage(props) {
await api.fetchAffectedEndpoints(runIssues.id).then((resp1) => {
runIssuesArr = resp1['similarlyAffectedIssues'];
})
- setInfoState(transform.fillMoreInformation(runIssues, runIssuesArr,subCategoryMap, moreInfoSections))
+ setInfoState(transform.fillMoreInformation(subCategoryMap[runIssues?.id?.testSubCategory],moreInfoSections, runIssuesArr))
} else {
setIssueDetails(...[{}]);
}
@@ -211,6 +217,18 @@ function TestRunResultPage(props) {
fetchData();
}, [subCategoryMap, subCategoryFromSourceConfigMap, props])
+ const testErrorComponent = (
+
+ {
+ selectedTestRunResult?.errors?.map((error, i) => {
+ return (
+ {error}
+ )
+ })
+ }
+
+ )
+
const components = loading ? [
] : [
issueDetails.id &&
@@ -220,6 +238,7 @@ function TestRunResultPage(props) {
,
+ ( selectedTestRunResult.errors && selectedTestRunResult.errors.length > 0 ) ? testErrorComponent : <>>,
selectedTestRunResult.testResults &&
{
+ tagList : (list, linkType) => {
let ret = list?.map((tag, index) => {
let linkUrl = ""
- if(cweLink){
- let cwe = tag.split("-")
- if(cwe[1]){
- linkUrl = `https://cwe.mitre.org/data/definitions/${cwe[1]}.html`
- }
+ switch(linkType){
+ case "CWE":
+ linkUrl = getCweLink(tag)
+ break;
+ case "CVE":
+ linkUrl = getCveLink(tag)
+ break;
}
return (
@@ -209,11 +224,14 @@ const transform = {
obj['categoryFilter'] = [obj['testCategory']]
obj['testFilter'] = [obj['name']]
obj['testResults'] = data['testResults'] || []
+ obj['errors'] = obj['testResults'].filter((res) => (res.errors && res.errors.length > 0)).map((res) => res.errors.join(", "))
obj['singleTypeInfos'] = data['singleTypeInfos'] || []
obj['vulnerable'] = data['vulnerable'] || false
obj['nextUrl'] = "/dashboard/testing/"+ hexId + "/result/" + data.hexId;
obj['cwe'] = subCategoryMap[data.testSubType]?.cwe ? subCategoryMap[data.testSubType]?.cwe : []
obj['cweDisplay'] = minimizeTagList(obj['cwe'])
+ obj['cve'] = subCategoryMap[data.testSubType]?.cve ? subCategoryMap[data.testSubType]?.cve : []
+ obj['cveDisplay'] = minimizeTagList(obj['cve'])
return obj;
},
prepareTestRunResults : (hexId, testingRunResults, subCategoryMap, subCategoryFromSourceConfigMap) => {
@@ -256,58 +274,140 @@ const transform = {
}
return []
},
- fillMoreInformation(runIssues, runIssuesArr, subCategoryMap, moreInfoSections){
- moreInfoSections[0].content = (
-
- {subCategoryMap[runIssues.id?.testSubCategory]?.issueImpact || "No impact found"}
-
- )
- moreInfoSections[1].content = (
-
- {
- transform.tagList(subCategoryMap[runIssues.id.testSubCategory]?.issueTags)
+
+ replaceTags(details, vulnerableRequests) {
+ let percentageMatch = 0;
+ vulnerableRequests?.forEach((request) => {
+ let testRun = request['testResults']
+ testRun?.forEach((runResult) => {
+ if (percentageMatch < runResult.percentageMatch) {
+ percentageMatch = runResult.percentageMatch
+ }
+ })
+ })
+ return details.replace(/{{percentageMatch}}/g, func.prettifyShort(percentageMatch))
+ },
+
+ fillMoreInformation(category, moreInfoSections, affectedEndpoints) {
+
+ let filledSection = []
+ moreInfoSections.forEach((section) => {
+ let sectionLocal = {}
+ sectionLocal.icon = section.icon
+ sectionLocal.title = section.title
+ switch (section.title) {
+ case "Description":
+
+ if(category?.issueDetails == null || category?.issueDetails == undefined){
+ return;
+ }
+
+ sectionLocal.content = (
+
+ {transform.replaceTags(category?.issueDetails, category?.vulnerableTestingRunResults) || "No impact found"}
+
+ )
+ break;
+ case "Impact":
+
+ if(category?.issueImpact == null || category?.issueImpact == undefined){
+ return;
}
-
- )
- moreInfoSections[2].content = (
-
- {
- transform.tagList(subCategoryMap[runIssues.id.testSubCategory]?.cwe, true)
+
+ sectionLocal.content = (
+
+ {category?.issueImpact || "No impact found"}
+
+ )
+ break;
+ case "Tags":
+ if (category?.issueTags == null || category?.issueTags == undefined || category?.issueTags.length == 0) {
+ return;
}
-
- )
- moreInfoSections[4].content = (
-
- {
- subCategoryMap[runIssues.id?.testSubCategory]?.references?.map((reference) => {
- return (
-
-
-
- {reference}
-
-
-
- )
- })
+
+ sectionLocal.content = (
+
+ {
+ transform.tagList(category?.issueTags)
+ }
+
+ )
+
+ break;
+ case "CWE":
+ if (category?.cwe == null || category?.cwe == undefined || category?.cwe.length == 0) {
+ return;
}
-
- )
- moreInfoSections[3].content = (
-
- {
- runIssuesArr?.map((item, index) => {
- return (
-
-
- {item.id.apiInfoKey.method} {item.id.apiInfoKey.url}
-
- )
- })
- }
-
- )
- return moreInfoSections;
+ sectionLocal.content = (
+
+ {
+ transform.tagList(category?.cwe, "CWE")
+ }
+
+ )
+ break;
+ case "CVE":
+ if (category?.cve == null || category?.cve == undefined || category?.cve.length == 0) {
+ return;
+ }
+ sectionLocal.content = (
+
+ {
+ transform.tagList(category?.cve, "CVE")
+ }
+
+ )
+ break;
+ case "References":
+
+ if (category?.references == null || category?.references == undefined || category?.references.length == 0) {
+ return;
+ }
+
+ sectionLocal.content = (
+
+ {
+ category?.references?.map((reference) => {
+ return (
+
+
+
+ {reference}
+
+
+
+ )
+ })
+ }
+
+ )
+ break;
+ case "API endpoints affected":
+
+ if (affectedEndpoints == null || affectedEndpoints == undefined || affectedEndpoints.length == 0) {
+ return;
+ }
+
+ sectionLocal.content = (
+
+ {
+ affectedEndpoints?.map((item, index) => {
+ return (
+
+
+ {item.id.apiInfoKey.method} {item.id.apiInfoKey.url}
+
+ )
+ })
+ }
+
+ )
+ break;
+ }
+ filledSection.push(sectionLocal)
+ })
+
+ return filledSection;
},
filterContainsConditions(conditions, operator) { //operator is string as 'OR' or 'AND'
diff --git a/apps/dashboard/web/polaris_web/web/src/util/func.js b/apps/dashboard/web/polaris_web/web/src/util/func.js
index 8e902ff39a..7e818977cb 100644
--- a/apps/dashboard/web/polaris_web/web/src/util/func.js
+++ b/apps/dashboard/web/polaris_web/web/src/util/func.js
@@ -1067,6 +1067,13 @@ getSizeOfFile(bytes) {
}
return duration.trim();
},
+ handleKeyPress (event, funcToCall) {
+ const enterKeyPressed = event.keyCode === 13;
+ if (enterKeyPressed) {
+ event.preventDefault();
+ funcToCall();
+ }
+ }
}
export default func
\ No newline at end of file
diff --git a/apps/dashboard/web/src/apps/dashboard/tools/TextEditor.vue b/apps/dashboard/web/src/apps/dashboard/tools/TextEditor.vue
index 83927bf7c4..4931f4b7a0 100644
--- a/apps/dashboard/web/src/apps/dashboard/tools/TextEditor.vue
+++ b/apps/dashboard/web/src/apps/dashboard/tools/TextEditor.vue
@@ -330,7 +330,7 @@ export default {
"api_selection_filters", "execute", "type", "auth", "validate", "authenticated",
"private_variable_context", "param_context", "endpoint_in_traffic_context",
"sample_request_payload", "sample_response_payload", "sample_request_headers", "sample_response_headers",
- "test_request_payload", "test_response_payload", "test_request_headers", "test_response_headers", "cwe"
+ "test_request_payload", "test_response_payload", "test_request_headers", "test_response_headers", "cwe", "cve"
],
textEditor: null,
testCategories: [],
diff --git a/apps/dashboard/web/src/apps/dashboard/views/testing/components/PDFExportHTML.vue b/apps/dashboard/web/src/apps/dashboard/views/testing/components/PDFExportHTML.vue
index 50bc1f3edb..89363d47f8 100644
--- a/apps/dashboard/web/src/apps/dashboard/views/testing/components/PDFExportHTML.vue
+++ b/apps/dashboard/web/src/apps/dashboard/views/testing/components/PDFExportHTML.vue
@@ -76,6 +76,20 @@
+
+
+ CVE
+
+
+
+ {{ chipItem }}
+
+
+
diff --git a/apps/dashboard/web/src/apps/dashboard/views/testing/components/TestResultsDialog.vue b/apps/dashboard/web/src/apps/dashboard/views/testing/components/TestResultsDialog.vue
index 36fe681636..1d0f401f01 100644
--- a/apps/dashboard/web/src/apps/dashboard/views/testing/components/TestResultsDialog.vue
+++ b/apps/dashboard/web/src/apps/dashboard/views/testing/components/TestResultsDialog.vue
@@ -40,7 +40,13 @@