Skip to content

Commit 08ffa66

Browse files
committed
merge
2 parents d3048ad + a932aec commit 08ffa66

File tree

16 files changed

+823
-730
lines changed

16 files changed

+823
-730
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
steps:
88
- uses: actions/checkout@v3
99
- name: Use Node.js 14
10-
uses: actions/setup-node@v3.3.0
10+
uses: actions/setup-node@v3.4.1
1111
with:
1212
node-version: 14
1313
registry-url: https://npm.pkg.github.com/

.github/workflows/dependabot-auto-merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
steps:
1212
- name: Dependabot metadata
1313
id: metadata
14-
uses: dependabot/fetch-metadata@v1.3.1
14+
uses: dependabot/fetch-metadata@v1.3.3
1515
with:
1616
github-token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
1717
- name: Enable auto-merge for Dependabot PRs

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
fetch-depth: 0
1515
- name: Set env
1616
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
17-
- uses: actions/setup-node@v3.3.0
17+
- uses: actions/setup-node@v3.4.1
1818
with:
1919
node-version: 10
2020
registry-url: https://npm.pkg.github.com/

checkmarx-ast-cli.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.0.20
1+
2.0.22

package-lock.json

Lines changed: 724 additions & 718 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@CheckmarxDev/ast-cli-javascript-wrapper",
3-
"version": "0.0.54",
3+
"version": "0.0.55",
44
"description": "AST CLI Javascript wrapper",
55
"main": "dist/main/wrapper/CxWrapper.js",
66
"typings": "dist/main/wrapper/CxWrapper.d.ts",
@@ -9,11 +9,11 @@
99
"README.md"
1010
],
1111
"dependencies": {
12-
"log4js": "^6.5.2"
12+
"log4js": "^6.6.1"
1313
},
1414
"scripts": {
1515
"build": "tsc",
16-
"postbuild": "copyfiles -u 1 src/main/wrapper/resources/cx* dist/",
16+
"postbuild": "copyfiles -u 1 src/main/wrapper/resources/cx* dist/;copyfiles -u 1 src/tests/data/* dist/;",
1717
"lint": "eslint . --ext .ts",
1818
"lint-and-fix": "eslint . --ext .ts --fix",
1919
"test": "copyfiles -u 1 src/tests/data/* dist/; tsc && jest --runInBand --coverage"
@@ -27,13 +27,13 @@
2727
"homepage": "https://github.com/CheckmarxDev/ast-cli-javascript-wrapper#readme",
2828
"devDependencies": {
2929
"@types/jest": "^27.5.0",
30-
"@types/node": "^18.0.0",
31-
"@typescript-eslint/eslint-plugin": "^5.29.0",
32-
"@typescript-eslint/parser": "^5.29.0",
30+
"@types/node": "^18.6.3",
31+
"@typescript-eslint/eslint-plugin": "^5.32.0",
32+
"@typescript-eslint/parser": "^5.32.0",
3333
"copyfiles": "^2.4.1",
34-
"eslint": "^8.18.0",
34+
"eslint": "^8.21.0",
3535
"jest": "^26.6.3",
36-
"jest-cli": "28.1.1",
36+
"jest-cli": "28.1.3",
3737
"ts-jest": "^26.0.0",
3838
"typescript": "^4.7.4"
3939
},
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export default class CxKicsRemediation {
2+
availableRemediation: string;
3+
appliedRemediation: string;
4+
5+
constructor(availableRemediation: string,appliedRemediation: string) {
6+
this.availableRemediation = availableRemediation;
7+
this.appliedRemediation = appliedRemediation;
8+
}
9+
10+
static parseKicsRemediation(resultObject: any): CxKicsRemediation {
11+
const output: CxKicsRemediation = new CxKicsRemediation(resultObject.available_remediation_count,resultObject.applied_remediation_count);
12+
return output;
13+
}
14+
}

src/main/wrapper/CxConstants.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ export enum CxConstants {
1515
TENANT = "--tenant",
1616
BASE_URI = "--base-uri",
1717
BASE_AUTH_URI = "--base-auth-uri",
18+
CMD_UTILS = "utils",
19+
CMD_REMEDIATION = "remediation",
20+
SUB_CMD_REMEDIATION_KICS = "kics",
21+
KICS_REMEDIATION_RESULTS_FILE = "--results-file",
22+
KICS_REMEDIATION_KICS_FILE = "--kics-files",
23+
KICS_REMEDIATION_SIMILARITY_IDS = "--similarity-ids",
1824
CMD_AUTH = "auth",
1925
SUB_CMD_VALIDATE = "validate",
2026
CMD_PROJECT = "project",
@@ -56,6 +62,7 @@ export enum CxConstants {
5662
PREDICATE_TYPE = "CxPredicate",
5763
CODE_BASHING_TYPE = "CxCodeBashing",
5864
KICS_REALTIME_TYPE = "CxKicsRealTime",
65+
KICS_REMEDIATION_TYPE = "CxKicsRemediation",
5966
BFL_TYPE = "CxBFL",
6067
SAST = "sast",
6168
LANGUAGE = "--language",

src/main/wrapper/CxWrapper.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,19 @@ export class CxWrapper {
247247
return exec.executeKicsCommands(this.config.pathToExecutable, commands, CxConstants.KICS_REALTIME_TYPE);
248248
}
249249

250+
async kicsRemediation(resultsFile: string, kicsFile:string, engine:string,similarityIds?: string):Promise<[Promise<CxCommandOutput>,any]> {
251+
const commands: string[] = [CxConstants.CMD_UTILS, CxConstants.CMD_REMEDIATION,CxConstants.SUB_CMD_REMEDIATION_KICS,CxConstants.KICS_REMEDIATION_RESULTS_FILE, resultsFile, CxConstants.KICS_REMEDIATION_KICS_FILE, kicsFile];
252+
if(engine.length>0){
253+
commands.push(CxConstants.ENGINE,engine)
254+
}
255+
if(similarityIds){
256+
commands.push(CxConstants.KICS_REMEDIATION_SIMILARITY_IDS,similarityIds)
257+
}
258+
commands.push(...this.initializeCommands(false));
259+
const exec = new ExecutionService();
260+
return exec.executeKicsCommands(this.config.pathToExecutable, commands, CxConstants.KICS_REMEDIATION_TYPE);
261+
}
262+
250263
getIndexOfBflNode(bflNodes: CxBFL[], resultNodes: any[]): number {
251264

252265
const bflNodeNotFound = -1;

src/main/wrapper/ExecutionService.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import CxVulnerabilityDetails from "../results/CxVulnerabilityDetails";
1616
import CxCvss from "../results/CxCvss";
1717
import CxNode from "../results/CxNode";
1818
import CxPackageData from "../results/CxPackageData";
19+
import CxKicsRemediation from "../remediation/CxKicsRemediation";
1920

2021

2122

@@ -146,6 +147,10 @@ export class ExecutionService {
146147
const kicsResults = CxKicsRealTime.parseKicsRealTimeResponse(resultObject);
147148
cxCommandOutput.payload = [kicsResults];
148149
break;
150+
case "CxKicsRemediation":
151+
const kicsRemediationOutput = CxKicsRemediation.parseKicsRemediation(resultObject)
152+
cxCommandOutput.payload = [kicsRemediationOutput]
153+
break;
149154
default:
150155
cxCommandOutput.payload = resultObject;
151156
}

0 commit comments

Comments
 (0)