File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ export enum CxConstants {
5252 CMD_CHAT_INPUT = "--user-input" ,
5353 CMD_CHAT_CONVERSATION_ID = "--conversation-id" ,
5454 CMD_CHAT_MODEL = "--model" ,
55+ CMD_MASK_SECRETS = "mask" ,
5556 SCAN_INFO_FORMAT = "--scan-info-format" ,
5657 FORMAT = "--format" ,
5758 FORMAT_JSON = "json" ,
@@ -80,6 +81,7 @@ export enum CxConstants {
8081 KICS_REALTIME_TYPE = "CxKicsRealTime" ,
8182 SCA_REALTIME_TYPE = "CxScaRealTime" ,
8283 CHAT_TYPE = "CxChat" ,
84+ MASK_TYPE = "CxMask" ,
8385 LEARN_MORE_DESCRIPTIONS_TYPE = "CxLearnMoreDescriptions" ,
8486 KICS_REMEDIATION_TYPE = "CxKicsRemediation" ,
8587 BFL_TYPE = "CxBFL" ,
Original file line number Diff line number Diff line change @@ -319,6 +319,17 @@ export class CxWrapper {
319319 return new ExecutionService ( ) . executeCommands ( this . config . pathToExecutable , commands , CxConstants . CHAT_TYPE ) ;
320320 }
321321
322+ async maskSecrets ( file : string ) : Promise < CxCommandOutput > {
323+ const commands : string [ ] = [
324+ CxConstants . CMD_UTILS ,
325+ CxConstants . CMD_MASK_SECRETS ,
326+ CxConstants . CMD_CHAT_FILE , file ,
327+ ] ;
328+
329+ commands . push ( ...this . initializeCommands ( false ) ) ;
330+ return new ExecutionService ( ) . executeCommands ( this . config . pathToExecutable , commands , CxConstants . MASK_TYPE ) ;
331+ }
332+
322333 prepareAdditionalParams ( additionalParameters : string ) : string [ ] {
323334 const params : string [ ] = [ ] ;
324335
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import CxPackageData from "../results/CxPackageData";
2121import CxKicsRemediation from "../remediation/CxKicsRemediation" ;
2222import CxScaRealTime from "../scaRealtime/CxScaRealTime" ;
2323import CxChat from "../chat/CxChat" ;
24+ import CxMask from "../mask/CxMask" ;
2425
2526
2627function isJsonString ( s : string ) {
@@ -207,12 +208,16 @@ export class ExecutionService {
207208 cxCommandOutput . payload = learnMore ;
208209 break ;
209210 case CxConstants . KICS_REMEDIATION_TYPE :
210- const kicsRemediationOutput = CxKicsRemediation . parseKicsRemediation ( resultObject )
211- cxCommandOutput . payload = [ kicsRemediationOutput ]
211+ const kicsRemediationOutput = CxKicsRemediation . parseKicsRemediation ( resultObject ) ;
212+ cxCommandOutput . payload = [ kicsRemediationOutput ] ;
212213 break ;
213214 case CxConstants . CHAT_TYPE :
214- const chatOutput = CxChat . parseChat ( resultObject )
215- cxCommandOutput . payload = [ chatOutput ]
215+ const chatOutput = CxChat . parseChat ( resultObject ) ;
216+ cxCommandOutput . payload = [ chatOutput ] ;
217+ break ;
218+ case CxConstants . MASK_TYPE :
219+ const maskOutput = CxMask . parseMask ( resultObject ) ;
220+ cxCommandOutput . payload = [ maskOutput ] ;
216221 break ;
217222 default :
218223 cxCommandOutput . payload = resultObject ;
You can’t perform that action at this time.
0 commit comments