Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jobs:
CX_CLIENT_ID: ${{ secrets.CX_CLIENT_ID}}
CX_CLIENT_SECRET: ${{ secrets.CX_CLIENT_SECRET}}
CX_BASE_URI: ${{ secrets.CX_BASE_URI }}
CX_BASE_AUTH_URI: ${{ secrets.CX_BASE_AUTH_URI }}
CX_TENANT: ${{ secrets.CX_TENANT }}
CX_APIKEY: ${{ secrets.CX_APIKEY }}
run: npm test
10 changes: 5 additions & 5 deletions checkmarx-ast-cli.checksums
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"windows_x64": "210d85d34d29fad7b8e9932aafac5d65303a2f1af8b15dc4c29f03a85cdfa248",
"darwin_x64": "4492e953be85c342004f8d8a27440d31c0d6d11b37ecd0bbd3db5c614ce625d1",
"linux_x64": "ac974d10aab9843f6035f0d82ee4184b4311916930e682f3a7ef28c87e7ee547",
"linux_arm64": "254888d1a3eae8e188143cf1a15f5cc333a368811c35432ca3ffbf43f6398553",
"linux_armv6": "bfae583968e4d76fdc48630d28c06aaea62d15c29e9dfcd443e3d384d8fc9d00"
"windows_x64": "8bca820b5acd09e6846c43d4840bcedf2f4696958d8c19ff76722fd92e6249bc",
"darwin_x64": "3f956fd60e6fce5db5d9492b39df3510bad6171bb0d917d49b988d292c6cfeab",
"linux_x64": "311f67b21cd0f7c65f10439cc3a3517e8f8457f2fcac3340dd92f9cf07a73789",
"linux_arm64": "456fec50d0627eef730af4d13731785a8d7e242875bab8d09a717d8efd821180",
"linux_armv6": "2b99853303b53459bacec055dd34956c82ea0ff8a528438b4f3457ef1d9ae384"
}
2 changes: 1 addition & 1 deletion checkmarx-ast-cli.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.60
2.3.65
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@Checkmarx/ast-cli-javascript-wrapper-runtime-cli",
"version": "1.0.40",
"version": "1.0.41",
"description": "AST CLI Javascript wrapper runtime CLI",
"main": "dist/main/wrapper/CxWrapper.js",
"typings": "dist/main/wrapper/CxWrapper.d.ts",
Expand Down Expand Up @@ -56,6 +56,7 @@
"typescript": "^5.6.3"
},
"overrides": {
"adm-zip": "0.6.1",
"bluebird": "3.7.2",
"browserslist": "4.28.7",
"flatted": "^3.4.2",
Expand All @@ -65,6 +66,7 @@
"underscore": "^1.13.8",
"picomatch": "^2.3.2",
"brace-expansion": "^2.1.4",
"qs": "6.16.0",
"uuid": "^3.3.2"

},
Expand Down
46 changes: 28 additions & 18 deletions src/tests/PredicateTest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,45 @@ const cxWrapperFactory = new CxWrapperFactory();
describe("Triage cases", () => {
const cxScanConfig = new BaseTest();

it('Triage Successful case', async () => {
const auth = await cxWrapperFactory.createWrapper(cxScanConfig);

const getScanAndResult = async (auth: any): Promise<{ scan: any, result: CxResult }> => {
const scanList: CxCommandOutput = await auth.scanList("statuses=Completed,limit=100");
let result: CxResult;
let scan, output;
while (!output && scanList && scanList.payload && scanList.payload.length > 0) {
scan = scanList.payload.pop()
console.log("Triage Successful case - ScanId " + scan.id)
output = await auth.getResultsList(scan.id)
if (output.status == "Error in the json file.") {
let scan, output, result;

while (!output && scanList?.payload?.length > 0) {
scan = scanList.payload.pop();
output = await auth.getResultsList(scan.id);
if (output?.status === "Error in the json file.") {
output = undefined;
} else {
result = output.payload.find(res => res.type == CxConstants.SAST)
if (!result || !result.similarityId) {
result = output?.payload?.find((res: CxResult) => res.type === CxConstants.SAST);
if (!result?.similarityId) {
output = undefined;
}
}
}

const cxShow: CxCommandOutput = await auth.triageShow(scan.projectID, result.similarityId, result.type);
if (!scan) {
const scanShow = await auth.scanShow("d4354650-4ee1-4e10-9b1d-0feaf6c187a7");
scan = scanShow?.payload?.pop();
output = await auth.getResultsList(scan.id);
result = output?.payload?.find((res: CxResult) => res.type === CxConstants.SAST);
}

expect(cxShow.exitCode).toEqual(0);
return { scan, result };
};

it('Triage Successful case', async () => {
const auth = await cxWrapperFactory.createWrapper(cxScanConfig);
const { scan, result } = await getScanAndResult(auth);

const cxUpdate: CxCommandOutput = await
auth.triageUpdate(scan.projectID, result.similarityId, result.type, result.state,
"Edited via JavascriptWrapper",
result.severity.toLowerCase() == "high" ? CxConstants.SEVERITY_MEDIUM : CxConstants.SEVERITY_HIGH);
const cxShow: CxCommandOutput = await auth.triageShow(scan.projectID, result.similarityId, result.type);
expect(cxShow.exitCode).toEqual(0);

const cxUpdate: CxCommandOutput = await auth.triageUpdate(
scan.projectID, result.similarityId, result.type, result.state,
"Edited via JavascriptWrapper",
result.severity.toLowerCase() === "high" ? CxConstants.SEVERITY_MEDIUM : CxConstants.SEVERITY_HIGH
);
expect(cxUpdate.exitCode).toEqual(0);
});
});
Loading