From 25b4523ff11bed6531cf225686e2e09a64ad8e87 Mon Sep 17 00:00:00 2001 From: Ronit Steinberg Date: Mon, 12 Jan 2026 14:33:54 +0200 Subject: [PATCH 1/3] getLicenseDetails --- src/main/license/JwtClaims.ts | 25 +++++++++++++++++++++++++ src/main/wrapper/CxConstants.ts | 1 + src/main/wrapper/CxWrapper.ts | 26 +++++++++++++++++++++++++- 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 src/main/license/JwtClaims.ts diff --git a/src/main/license/JwtClaims.ts b/src/main/license/JwtClaims.ts new file mode 100644 index 0000000..0ca5e79 --- /dev/null +++ b/src/main/license/JwtClaims.ts @@ -0,0 +1,25 @@ +/** + * Represents license-related information extracted from the JWT token + */ +export class JwtClaims { + tenantName: string; + dastEnabled: boolean; + allowedEngines: string[]; + + constructor(tenantName: string, dastEnabled: boolean, allowedEngines: string[]) { + this.tenantName = tenantName; + this.dastEnabled = dastEnabled; + this.allowedEngines = allowedEngines; + } + + /** + * Creates a JwtClaims instance from a JSON object + */ + static fromJson(json: any): JwtClaims { + return new JwtClaims( + json.tenantName || '', + json.dastEnabled || false, + json.allowedEngines || [] + ); + } +} diff --git a/src/main/wrapper/CxConstants.ts b/src/main/wrapper/CxConstants.ts index 3f9450f..1896af0 100644 --- a/src/main/wrapper/CxConstants.ts +++ b/src/main/wrapper/CxConstants.ts @@ -21,6 +21,7 @@ export enum CxConstants { CMD_REMEDIATION = "remediation", SUB_CMD_REMEDIATION_SCA = "sca", SUB_CMD_TENANT = "tenant", + SUB_CMD_LICENSE = "license", KICS_REMEDIATION_RESULTS_FILE = "--results-file", KICS_REMEDIATION_KICS_FILE = "--kics-files", KICS_REMEDIATION_SIMILARITY_IDS = "--similarity-ids", diff --git a/src/main/wrapper/CxWrapper.ts b/src/main/wrapper/CxWrapper.ts index c271e18..7560b90 100644 --- a/src/main/wrapper/CxWrapper.ts +++ b/src/main/wrapper/CxWrapper.ts @@ -9,6 +9,9 @@ import * as os from "os"; import CxBFL from "../bfl/CxBFL"; import path = require('path'); import { getTrimmedMapValue } from "./utils"; +import { JwtClaims } from "../license/JwtClaims"; + +export { JwtClaims } from "../license/JwtClaims"; type ParamTypeMap = Map; @@ -651,4 +654,25 @@ export class CxWrapper { } return r; } -} \ No newline at end of file + + /** + * Gets license details from the JWT token + */ + async getLicenseDetails(): Promise { + const commands: string[] = [ + CxConstants.CMD_UTILS, + CxConstants.SUB_CMD_LICENSE, + CxConstants.FORMAT, + CxConstants.FORMAT_JSON + ]; + commands.push(...this.initializeCommands(false)); + + const exec = new ExecutionService(); + const output = await exec.executeCommands(this.config.pathToExecutable, commands); + + if (output.exitCode === 0 && output.payload) { + return JwtClaims.fromJson(output.payload); + } + return null; + } +} From 7ae77cd51c0f686c437d860a942d9d2b6b119dc4 Mon Sep 17 00:00:00 2001 From: Ronit Steinberg Date: Mon, 12 Jan 2026 15:41:13 +0200 Subject: [PATCH 2/3] remove unused export --- src/main/wrapper/CxWrapper.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/wrapper/CxWrapper.ts b/src/main/wrapper/CxWrapper.ts index 7560b90..332884c 100644 --- a/src/main/wrapper/CxWrapper.ts +++ b/src/main/wrapper/CxWrapper.ts @@ -11,8 +11,6 @@ import path = require('path'); import { getTrimmedMapValue } from "./utils"; import { JwtClaims } from "../license/JwtClaims"; -export { JwtClaims } from "../license/JwtClaims"; - type ParamTypeMap = Map; export class CxWrapper { From 0f70cfda1b15ddead0786bf6c368b353d4ae4893 Mon Sep 17 00:00:00 2001 From: Ronit Steinberg Date: Tue, 13 Jan 2026 11:11:02 +0200 Subject: [PATCH 3/3] Use dastEnabled --- src/main/license/JwtClaims.ts | 25 ------------------------- src/main/wrapper/CxConstants.ts | 2 +- src/main/wrapper/CxWrapper.ts | 33 +++++++++++---------------------- 3 files changed, 12 insertions(+), 48 deletions(-) delete mode 100644 src/main/license/JwtClaims.ts diff --git a/src/main/license/JwtClaims.ts b/src/main/license/JwtClaims.ts deleted file mode 100644 index 0ca5e79..0000000 --- a/src/main/license/JwtClaims.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Represents license-related information extracted from the JWT token - */ -export class JwtClaims { - tenantName: string; - dastEnabled: boolean; - allowedEngines: string[]; - - constructor(tenantName: string, dastEnabled: boolean, allowedEngines: string[]) { - this.tenantName = tenantName; - this.dastEnabled = dastEnabled; - this.allowedEngines = allowedEngines; - } - - /** - * Creates a JwtClaims instance from a JSON object - */ - static fromJson(json: any): JwtClaims { - return new JwtClaims( - json.tenantName || '', - json.dastEnabled || false, - json.allowedEngines || [] - ); - } -} diff --git a/src/main/wrapper/CxConstants.ts b/src/main/wrapper/CxConstants.ts index 1896af0..cdc8d35 100644 --- a/src/main/wrapper/CxConstants.ts +++ b/src/main/wrapper/CxConstants.ts @@ -21,7 +21,6 @@ export enum CxConstants { CMD_REMEDIATION = "remediation", SUB_CMD_REMEDIATION_SCA = "sca", SUB_CMD_TENANT = "tenant", - SUB_CMD_LICENSE = "license", KICS_REMEDIATION_RESULTS_FILE = "--results-file", KICS_REMEDIATION_KICS_FILE = "--kics-files", KICS_REMEDIATION_SIMILARITY_IDS = "--similarity-ids", @@ -120,6 +119,7 @@ export enum CxConstants { AI_GUIDED_REMEDIATION_KEY = "scan.config.plugins.aiGuidedRemediation", STANDALONE_KEY = "scan.config.plugins.cxdevassist", ASSIST_KEY = "scan.config.plugins.cxoneassist", + DAST_ENABLED_KEY = "scan.config.plugins.dastenabled", AI_MCP_SERVER_KEY = "scan.config.plugins.aiMcpServer", TELEMETRY = "telemetry", SUB_CMD_TELEMETRY_AI = "ai", diff --git a/src/main/wrapper/CxWrapper.ts b/src/main/wrapper/CxWrapper.ts index 332884c..2725051 100644 --- a/src/main/wrapper/CxWrapper.ts +++ b/src/main/wrapper/CxWrapper.ts @@ -9,7 +9,6 @@ import * as os from "os"; import CxBFL from "../bfl/CxBFL"; import path = require('path'); import { getTrimmedMapValue } from "./utils"; -import { JwtClaims } from "../license/JwtClaims"; type ParamTypeMap = Map; @@ -513,6 +512,17 @@ export class CxWrapper { return value?.toLowerCase() === "true"; } + async dastEnabled(): Promise { + const commands: string[] = [CxConstants.CMD_UTILS, CxConstants.SUB_CMD_TENANT]; + commands.push(...this.initializeCommands(false)); + + const exec = new ExecutionService(); + const output = await exec.executeMapTenantOutputCommands(this.config.pathToExecutable, commands); + + const value = getTrimmedMapValue(output, CxConstants.DAST_ENABLED_KEY); + return value?.toLowerCase() === "true"; + } + async aiMcpServerEnabled(): Promise { const commands: string[] = [CxConstants.CMD_UTILS, CxConstants.SUB_CMD_TENANT]; commands.push(...this.initializeCommands(false)); @@ -652,25 +662,4 @@ export class CxWrapper { } return r; } - - /** - * Gets license details from the JWT token - */ - async getLicenseDetails(): Promise { - const commands: string[] = [ - CxConstants.CMD_UTILS, - CxConstants.SUB_CMD_LICENSE, - CxConstants.FORMAT, - CxConstants.FORMAT_JSON - ]; - commands.push(...this.initializeCommands(false)); - - const exec = new ExecutionService(); - const output = await exec.executeCommands(this.config.pathToExecutable, commands); - - if (output.exitCode === 0 && output.payload) { - return JwtClaims.fromJson(output.payload); - } - return null; - } }