Skip to content

Commit ac938ed

Browse files
committed
Fix command constants in ossScanResults and secretsScanResults methods; update test case for secrets scanning
1 parent 34d0cf2 commit ac938ed

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/main/wrapper/CxWrapper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,14 @@ export class CxWrapper {
150150
}
151151

152152
async ossScanResults(sourceFile: string): Promise<CxCommandOutput> {
153-
const commands: string[] = [CxConstants.CMD_SCAN, CxConstants.CMD_SECRETS, CxConstants.SOURCE, sourceFile];
153+
const commands: string[] = [CxConstants.CMD_SCAN, CxConstants.CMD_OSS, CxConstants.SOURCE, sourceFile];
154154
commands.push(...this.initializeCommands(false));
155155
const exec = new ExecutionService();
156156
return await exec.executeCommands(this.config.pathToExecutable, commands, CxConstants.SCAN_OSS);
157157
}
158158

159159
async secretsScanResults(sourceFile: string): Promise<CxCommandOutput> {
160-
const commands: string[] = [CxConstants.CMD_SCAN, CxConstants.CMD_OSS, CxConstants.SOURCE, sourceFile];
160+
const commands: string[] = [CxConstants.CMD_SCAN, CxConstants.CMD_SECRETS, CxConstants.SOURCE, sourceFile];
161161
commands.push(...this.initializeCommands(false));
162162
const exec = new ExecutionService();
163163
return await exec.executeCommands(this.config.pathToExecutable, commands, CxConstants.SCAN_SECRETS);

src/tests/ScanTest.test.ts

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

185-
it.skip('ScanSecrets Successful case', async () => {
185+
it('ScanSecrets Successful case', async () => {
186186
const wrapper = new CxWrapper(cxScanConfig);
187-
const cxCommandOutput: CxCommandOutput = await wrapper.secretsScanResults("tsc/tests/data/package.json");
187+
const cxCommandOutput: CxCommandOutput = await wrapper.secretsScanResults("tsc/tests/data/secret-exposed.txt");
188188
console.log("Json object from scanOSS successful case: " + JSON.stringify(cxCommandOutput));
189189
expect(cxCommandOutput.payload).toBeDefined();
190190
expect(cxCommandOutput.exitCode).toBe(0);

src/tests/data/secret-exposed.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package data
2+
3+
const (
4+
pat = "ghp_1234567890abcdef1234567890abcdef12345678"
5+
)

0 commit comments

Comments
 (0)