From 56512302c47a678a67f2dc4ca45b8245f3c48fa3 Mon Sep 17 00:00:00 2001 From: NoamSDahan Date: Sun, 3 Sep 2023 10:57:23 +0300 Subject: [PATCH] Add KSPM module support in CLI and parsing --- README.md | 2 +- cmd/commands/common/command.go | 2 +- scenario.go | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6b2e761..4f92fdb 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ cnappgoat provision #### Flags: -- `--module` - Filters scenarios by module (e.g. CSPM, CIEM, CWPP, DSPM, etc.) +- `--module` - Filters scenarios by module (e.g. CSPM, CIEM, CWPP, DSPM, KSPM etc.) - `--platform` - Filters scenarios by platform (e.g. AWS, Azure, GCP) - `--force` - Enables force mode (unlock locked stacks with pulumi cancel) - `--debug` - Enables debug logging. diff --git a/cmd/commands/common/command.go b/cmd/commands/common/command.go index ce98823..8840621 100644 --- a/cmd/commands/common/command.go +++ b/cmd/commands/common/command.go @@ -66,7 +66,7 @@ func CommandFlags() []cli.Flag { }, &cli.StringFlag{ Name: "module", - Usage: "CNAPPgoat module to operate on, e.g. 'CIEM, 'CSPM', 'CWPP', 'DSPM', 'IAC'", + Usage: "CNAPPgoat module to operate on, e.g. 'CIEM, 'CSPM', 'CWPP', 'DSPM', 'KSPM'", Aliases: []string{"m"}, }, &cli.StringFlag{ diff --git a/scenario.go b/scenario.go index 2194d20..3da4d91 100644 --- a/scenario.go +++ b/scenario.go @@ -53,6 +53,7 @@ const ( CWPP Module = "CWPP" DSPM Module = "DSPM" IAC Module = "IAC" + KSPM Module = "KSPM" ) type Platform string @@ -83,6 +84,8 @@ func (m Module) String() string { return "DSPM" case IAC: return "IAC" + case KSPM: + return "KSPM" default: return "" } @@ -171,6 +174,8 @@ func ModuleFromString(name string) (Module, error) { return DSPM, nil case strings.ToLower(IAC.String()): return IAC, nil + case strings.ToLower(KSPM.String()): + return KSPM, nil default: return "", errors.New("unknown module name: " + name) }