Skip to content

Commit 33583e0

Browse files
committed
Add secrets-realtime command and corresponding scan results method
1 parent e8a3005 commit 33583e0

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

src/main/wrapper/CxConstants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export enum CxConstants {
7373
SOURCE_FILE = "--file-source",
7474
ASCA_UPDATE_VERSION = "--asca-latest-version",
7575
CMD_OSS = "oss-realtime",
76+
CMD_SECRETS = "secrets-realtime",
7677
PROJECT_ID = "--project-id",
7778
SIMILARITY_ID = "--similarity-id",
7879
QUERY_ID = "--query-id",

src/main/wrapper/CxWrapper.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@ 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];
154+
commands.push(...this.initializeCommands(false));
155+
const exec = new ExecutionService();
156+
return await exec.executeCommands(this.config.pathToExecutable, commands, CxConstants.SCAN_OSS);
157+
}
158+
159+
async secretsScanResults(sourceFile: string): Promise<CxCommandOutput> {
153160
const commands: string[] = [CxConstants.CMD_SCAN, CxConstants.CMD_OSS, CxConstants.SOURCE, sourceFile];
154161
commands.push(...this.initializeCommands(false));
155162
const exec = new ExecutionService();

src/tests/ScanTest.test.ts

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

185+
it.skip('ScanSecrets Successful case', async () => {
186+
const wrapper = new CxWrapper(cxScanConfig);
187+
const cxCommandOutput: CxCommandOutput = await wrapper.secretsScanResults("tsc/tests/data/package.json");
188+
console.log("Json object from scanOSS successful case: " + JSON.stringify(cxCommandOutput));
189+
expect(cxCommandOutput.payload).toBeDefined();
190+
expect(cxCommandOutput.exitCode).toBe(0);
191+
});
192+
185193
});

0 commit comments

Comments
 (0)