Skip to content

Commit 664b3ed

Browse files
authored
Add secretValue to CxSecretsResult and update related tests (#881)
1 parent 2833ad9 commit 664b3ed

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/main/secrets/CxSecrets.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {CxRealtimeEngineStatus} from "../oss/CxRealtimeEngineStatus";
33
export default class CxSecretsResult {
44
title: string;
55
description: string;
6+
secretValue: string;
67
filepath: string;
78
severity: CxRealtimeEngineStatus;
89
locations: { line: number, startIndex: number, endIndex: number }[];
@@ -14,6 +15,7 @@ export default class CxSecretsResult {
1415
const secretsResult = new CxSecretsResult();
1516
secretsResult.title = member.Title;
1617
secretsResult.description = member.Description;
18+
secretsResult.secretValue = member.SecretValue;
1719
secretsResult.filepath = member.FilePath;
1820
secretsResult.severity = member.Severity as CxRealtimeEngineStatus;
1921
secretsResult.locations = Array.isArray(member.Locations)

src/tests/ScanTest.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ describe("ScanCreate cases", () => {
183183
expect(cxCommandOutput.exitCode).toBe(0);
184184
});
185185

186-
it.skip('ScanOss with ignored package should filter results', async () => {
186+
it('ScanOss with ignored package should filter results', async () => {
187187
const wrapper = new CxWrapper(cxScanConfig);
188188
const sourceFile = "tsc/tests/data/package.json";
189189
const ignoredFile = "tsc/tests/data/checkmarxIgnoredTempFile.json";
@@ -213,7 +213,7 @@ describe("ScanCreate cases", () => {
213213
expect(cxCommandOutput.exitCode).toBe(0);
214214
});
215215

216-
it.skip('ScanSecrets with ignore file filters the result', async () => {
216+
it('ScanSecrets with ignore file filters the result', async () => {
217217
const wrapper = new CxWrapper(cxScanConfig);
218218
const cxCommandOutput: CxCommandOutput = await wrapper.secretsScanResults(
219219
"src/tests/data/secret-exposed.txt",
@@ -223,7 +223,7 @@ describe("ScanCreate cases", () => {
223223
console.log("Json object from scanSecrets with ignore file: " + JSON.stringify(cxCommandOutput));
224224
expect(cxCommandOutput.payload).toBeDefined();
225225
expect(Array.isArray(cxCommandOutput.payload)).toBe(true);
226-
expect(cxCommandOutput.payload.length).toBe(0);
226+
expect(cxCommandOutput.payload.pop().length).toBe(0);
227227
expect(cxCommandOutput.exitCode).toBe(0);
228228
});
229229

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
{
33
"Title": "github-pat",
4-
"FilePath": "/Users/itaypaz/Library/CloudStorage/OneDrive-Checkmarx/Documents/jswrapper/ast-cli-javascript-wrapper/src/tests/data/secret-exposed.txt",
4+
"FilePath": "src/tests/data/secret-exposed.txt",
55
"Line": 3
66
}
77
]

0 commit comments

Comments
 (0)