-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for xsoar 8/xsiam configuration #53
Merged
ilaner
merged 9 commits into
master
from
ciac-6603/adapt-xsoar-coonnection-config-dialog-to-select-xsoar-version
Apr 11, 2024
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
aa448df
Support for xsoar 8/xsiam configuration
barryyosi-panw bbbf010
typo
barryyosi-panw 7f7f79e
maintain comments in dotenv file
barryyosi-panw ad9a5c8
typo
barryyosi-panw e30f9bb
lint
barryyosi-panw 2487e10
ignoreFocusOut
barryyosi-panw c89a1bc
linter ignores
barryyosi-panw a2ffc18
reference envfile parsing & stringifying functions
barryyosi-panw 80af68e
changelog update
barryyosi-panw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,12 @@ import JSON5 from "json5"; | |
import * as dsdk from "./demistoSDKWrapper"; | ||
import * as fs from "fs-extra"; | ||
import { spawn } from "child_process"; | ||
import { parse, stringify } from "envfile"; | ||
import { getContentPath } from "./tools"; | ||
import { getContentPath, parse, stringify } from "./tools"; | ||
|
||
enum Platform { | ||
XSOAR6 = 'XSOAR 6', | ||
XSOAR8_XSIAM = 'XSOAR 8/XSIAM' | ||
} | ||
|
||
export async function installDevEnv(): Promise<void> { | ||
const workspaces = vscode.workspace.workspaceFolders; | ||
|
@@ -239,6 +242,7 @@ export async function developDemistoSDK(): Promise<void> { | |
|
||
export async function configureDemistoVars(): Promise<void> { | ||
const workspaces = vscode.workspace.workspaceFolders; | ||
|
||
if (!workspaces) { | ||
vscode.window.showErrorMessage("Could not find a valid workspace"); | ||
return; | ||
|
@@ -256,6 +260,16 @@ export async function configureDemistoVars(): Promise<void> { | |
if (!env) { | ||
env = {}; | ||
} | ||
|
||
// Select configured platform | ||
const configuredPlatform = await vscode.window | ||
.showQuickPick([Platform.XSOAR6, Platform.XSOAR8_XSIAM], { | ||
title: "Platform", | ||
placeHolder: "Select configured platform", | ||
ignoreFocusOut: true, | ||
}) ?? Platform.XSOAR6; | ||
|
||
// XSOAR url | ||
await vscode.window | ||
.showInputBox({ | ||
title: "XSOAR URL", | ||
|
@@ -270,6 +284,8 @@ export async function configureDemistoVars(): Promise<void> { | |
vscode.window.showInformationMessage( | ||
"Enter either XSOAR username and password, or an API key" | ||
); | ||
|
||
// XSOAR username | ||
await vscode.window | ||
.showInputBox({ | ||
title: "XSOAR username (optional)", | ||
|
@@ -281,6 +297,8 @@ export async function configureDemistoVars(): Promise<void> { | |
env["DEMISTO_USERNAME"] = username; | ||
} | ||
}); | ||
|
||
// XSOAR password | ||
await vscode.window | ||
.showInputBox({ | ||
title: "XSOAR password (optional)", | ||
|
@@ -294,6 +312,7 @@ export async function configureDemistoVars(): Promise<void> { | |
} | ||
}); | ||
|
||
// XSOAR API Key | ||
await vscode.window | ||
.showInputBox({ | ||
title: "XSOAR API key (optional)", | ||
|
@@ -306,10 +325,31 @@ export async function configureDemistoVars(): Promise<void> { | |
env["DEMISTO_API_KEY"] = apiKey; | ||
} | ||
}); | ||
|
||
// XSIAM Auth ID | ||
if (configuredPlatform === Platform.XSOAR8_XSIAM){ | ||
await vscode.window | ||
.showInputBox({ | ||
title: "XSIAM Auth ID", | ||
ignoreFocusOut: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you add ignorefocusout to all input boxes here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
}).then((authId) => { | ||
if (authId){ | ||
env["XSIAM_AUTH_ID"] = authId; | ||
} | ||
}) | ||
} else { | ||
// Commenting XSIAM_AUTH_ID if exist. | ||
if (env["XSIAM_AUTH_ID"]) | ||
env["# XSIAM_AUTH_ID"] = `${env["XSIAM_AUTH_ID"]}`; | ||
delete env["XSIAM_AUTH_ID"]; | ||
} | ||
|
||
// Verify SSL | ||
await vscode.window | ||
.showQuickPick(["true", "false"], { | ||
title: "XSOAR SSL verification", | ||
placeHolder: "Should XSOAR SSL verification be enabled?", | ||
ignoreFocusOut: true, | ||
}) | ||
.then((verifySSL) => { | ||
if (verifySSL) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch