diff --git a/.github/workflows/go-e2e.yaml b/.github/workflows/go-e2e.yaml index 70b129f0fb6..b96af2c57b3 100644 --- a/.github/workflows/go-e2e.yaml +++ b/.github/workflows/go-e2e.yaml @@ -82,7 +82,7 @@ jobs: E2E_KICS_DOCKER: kics:e2e-tests-${{ github.sha }} E2E_KICS_QUERIES_PATH: ${{ steps.getbin.outputs.queries }} run: | - go test -tags dev "github.com/Checkmarx/kics/v2/e2e" -timeout 1500s -json > results.json + go test -tags dev "github.com/Checkmarx/kics/v2/e2e" -timeout 1500s -json - name: Generate E2E Report if: always() env: diff --git a/.github/workflows/kics-gh-action.yaml b/.github/workflows/kics-gh-action.yaml index 87f6be481d3..ec2872113b1 100644 --- a/.github/workflows/kics-gh-action.yaml +++ b/.github/workflows/kics-gh-action.yaml @@ -11,7 +11,7 @@ jobs: steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Run KICS Scan - uses: checkmarx/kics-github-action@252e73959bd4809a14863cbfbb42d7a90d5a4860 # v2.1.1 + uses: checkmarx/kics-github-action@530ac1f8efe6202b0f12c9a6e952597ae707b755 # v2.1.2 with: token: ${{ secrets.GITHUB_TOKEN }} path: "./Dockerfile" diff --git a/Dockerfile b/Dockerfile index 4253f2152eb..8977bb8a849 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,7 +31,7 @@ USER nonroot # Runtime image # Ignore no User Cmd since KICS container is stopped afer scan # kics-scan ignore-line -FROM cgr.dev/chainguard/git@sha256:51620806588a4738b536e1f328206b17ae2a988b2a424a6a37c419041eb2b9a9 +FROM ruigomes99/git-sed:latest ENV TERM xterm-256color diff --git a/e2e/cli_test.go b/e2e/cli_test.go index aba9fd0faa1..0e17faec697 100644 --- a/e2e/cli_test.go +++ b/e2e/cli_test.go @@ -7,7 +7,6 @@ import ( "strings" "testing" "text/template" - "time" "github.com/Checkmarx/kics/v2/e2e/testcases" "github.com/Checkmarx/kics/v2/e2e/utils" @@ -30,7 +29,7 @@ func Test_E2E_CLI(t *testing.T) { } } - scanStartTime := time.Now() + //scanStartTime := time.Now() if testing.Short() { t.Skip("skipping E2E tests in short mode.") @@ -122,13 +121,13 @@ func Test_E2E_CLI(t *testing.T) { t.Cleanup(func() { err := os.RemoveAll("output") if err != nil { - t.Logf("\nError when trying to remove tests output folder %v\n", err) + t.Logf("\nError when trying to remove tests output folder %v\n", err.Error()) } err = os.RemoveAll("tmp-kics-ar") if err != nil { - t.Logf("\nError when trying to remove tmp-kics-ar folder %v\n", err) + t.Logf("\nError when trying to remove tmp-kics-ar folder %v\n", err.Error()) } - t.Logf("E2E tests ::ellapsed time:: %v", time.Since(scanStartTime)) + t.Logf("E2E tests ::ellapsed time:: %v", err.Error()) }) } diff --git a/e2e/testcases/e2e-cli-001_help_text.go b/e2e/testcases/e2e-cli-001_help_text.go deleted file mode 100644 index 985a0d20140..00000000000 --- a/e2e/testcases/e2e-cli-001_help_text.go +++ /dev/null @@ -1,18 +0,0 @@ -package testcases - -// E2E-CLI-001 - KICS command should display a help text in the CLI when provided with the -// --help flag and it should describe the available commands plus the global flags -func init() { //nolint - testSample := TestCase{ - Name: "should display the kics help text [E2E-CLI-001]", - Args: args{ - Args: []cmdArgs{ - []string{"--help"}, - }, - ExpectedOut: []string{"E2E_CLI_001"}, - }, - WantStatus: []int{0}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-002_help_scan.go b/e2e/testcases/e2e-cli-002_help_scan.go deleted file mode 100644 index 13aa400a090..00000000000 --- a/e2e/testcases/e2e-cli-002_help_scan.go +++ /dev/null @@ -1,18 +0,0 @@ -package testcases - -// E2E-CLI-002 - KICS scan command should display a help text in the CLI when provided with the -// --help flag and it should describe the options related with scan plus the global options -func init() { //nolint - testSample := TestCase{ - Name: "should display the kics scan help text [E2E-CLI-002]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--help"}, - }, - ExpectedOut: []string{"E2E_CLI_002"}, - }, - WantStatus: []int{0}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-003_scan_text.go b/e2e/testcases/e2e-cli-003_scan_text.go deleted file mode 100644 index d1741de4468..00000000000 --- a/e2e/testcases/e2e-cli-003_scan_text.go +++ /dev/null @@ -1,18 +0,0 @@ -package testcases - -// E2E-CLI-003 - KICS scan command has a mandatory flag -p. The CLI should exhibit -// an error message and return exit code 126 -func init() { //nolint - testSample := TestCase{ - Name: "should display an error regarding missing -p flag [E2E-CLI-003]", - Args: args{ - Args: []cmdArgs{ - []string{"scan"}, - }, - ExpectedOut: []string{"E2E_CLI_003"}, - }, - WantStatus: []int{126}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-004_invalid_combination.go b/e2e/testcases/e2e-cli-004_invalid_combination.go deleted file mode 100644 index 30abe89aa29..00000000000 --- a/e2e/testcases/e2e-cli-004_invalid_combination.go +++ /dev/null @@ -1,23 +0,0 @@ -package testcases - -// E2E-CLI-004 - KICS has an invalid flag combination -// an error message and return exit code 1 - -func init() { //nolint - testSample := TestCase{ - Name: "should display an error of invalid flag combination [E2E-CLI-004]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--ci", "--verbose"}, - []string{"--ci", "scan", "--verbose"}, - }, - ExpectedOut: []string{ - "E2E_CLI_004", - "E2E_CLI_004", - }, - }, - WantStatus: []int{126, 126}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-005_payload-path.go b/e2e/testcases/e2e-cli-005_payload-path.go deleted file mode 100644 index 8017a59b3f6..00000000000 --- a/e2e/testcases/e2e-cli-005_payload-path.go +++ /dev/null @@ -1,25 +0,0 @@ -package testcases - -// E2E-CLI-005 - KICS scan with -- payload-path flag should create a file with the -// passed name containing the payload of the files scanned - -func init() { //nolint - testSample := TestCase{ - Name: "should create a payload file [E2E-CLI-005]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--silent", "-p", "/path/e2e/fixtures/samples/terraform.tf", - "--payload-path", "/path/e2e/output/E2E_CLI_005_PAYLOAD.json"}, - }, - ExpectedOut: []string{ - "E2E_CLI_005", - }, - ExpectedPayload: []string{ - "E2E_CLI_005_PAYLOAD.json", - }, - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-006_generate-id.go b/e2e/testcases/e2e-cli-006_generate-id.go deleted file mode 100644 index 52aca8b8d79..00000000000 --- a/e2e/testcases/e2e-cli-006_generate-id.go +++ /dev/null @@ -1,24 +0,0 @@ -package testcases - -import "regexp" - -// E2E-CLI-006 - KICS generate-id should exhibit -// a valid UUID in the CLI and return exit code 0 -func init() { //nolint - testSample := TestCase{ - Name: "should generate a valid ID [E2E-CLI-006]", - Args: args{ - Args: []cmdArgs{ - []string{"generate-id"}, - }, - }, - WantStatus: []int{0}, - Validation: func(outputText string) bool { - uuidRegex := "[a-f0-9]{8}-[a-f0-9]{4}-4{1}[a-f0-9]{3}-[89ab]{1}[a-f0-9]{3}-[a-f0-9]{12}" - match, _ := regexp.MatchString(uuidRegex, outputText) - return match - }, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-007_scan.go b/e2e/testcases/e2e-cli-007_scan.go deleted file mode 100644 index d6abc67bba1..00000000000 --- a/e2e/testcases/e2e-cli-007_scan.go +++ /dev/null @@ -1,28 +0,0 @@ -package testcases - -import "regexp" - -// E2E-CLI-007 - the default kics scan must show informations such as 'Files scanned', -// 'Queries loaded', 'Scan Duration', '...' in the CLI -func init() { //nolint - testSample := TestCase{ - Name: "should perform a simple scan [E2E-CLI-007]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-p", "/path/e2e/fixtures/samples/positive.yaml", "-v"}, - }, - }, - WantStatus: []int{50}, - Validation: func(outputText string) bool { - match1, _ := regexp.MatchString(`Scanned Files: \d+`, outputText) - match2, _ := regexp.MatchString(`Parsed Files: \d+`, outputText) - match3, _ := regexp.MatchString(`Queries loaded: \d+`, outputText) - match4, _ := regexp.MatchString(`Queries failed to execute: \d+`, outputText) - match5, _ := regexp.MatchString(`Results Summary:`, outputText) - match6, _ := regexp.MatchString(`Scan duration: \d+(m\d+)?(.\d+)?s`, outputText) - return match1 && match2 && match3 && match4 && match5 && match6 - }, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-008_scan_silent.go b/e2e/testcases/e2e-cli-008_scan_silent.go deleted file mode 100644 index ffb48122da3..00000000000 --- a/e2e/testcases/e2e-cli-008_scan_silent.go +++ /dev/null @@ -1,19 +0,0 @@ -package testcases - -// E2E-CLI-008 - KICS scan with --silent global flag -// should hide all the output text in the CLI (empty output) - -func init() { //nolint - testSample := TestCase{ - Name: "should hide all output text in CLI [E2E-CLI-008]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--silent", "-p", "/path/e2e/fixtures/samples/positive.yaml"}, - }, - ExpectedOut: []string{"E2E_CLI_008"}, - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-009_scan_no-progress.go b/e2e/testcases/e2e-cli-009_scan_no-progress.go deleted file mode 100644 index b9741ba5eb9..00000000000 --- a/e2e/testcases/e2e-cli-009_scan_no-progress.go +++ /dev/null @@ -1,25 +0,0 @@ -package testcases - -import "regexp" - -// E2E-CLI-009 - kics scan with no-progress flag -// should perform a scan without showing progress bar in the CLI -func init() { //nolint - testSample := TestCase{ - Name: "should hide the progress bar in the CLI [E2E-CLI-009]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-p", "/path/e2e/fixtures/samples/positive.dockerfile", "--no-progress"}, - }, - }, - WantStatus: []int{50}, - Validation: func(outputText string) bool { - getProgressRegex := "Executing queries:" - match, _ := regexp.MatchString(getProgressRegex, outputText) - // if not found -> the the test was successful - return !match - }, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-010_scan_invalid_type.go b/e2e/testcases/e2e-cli-010_scan_invalid_type.go deleted file mode 100644 index 7eda4c6d79c..00000000000 --- a/e2e/testcases/e2e-cli-010_scan_invalid_type.go +++ /dev/null @@ -1,24 +0,0 @@ -package testcases - -import "regexp" - -// E2E-CLI-010 - KICS scan with invalid --type flag -// should exhibit an error message and return exit code 1 -func init() { //nolint - testSample := TestCase{ - Name: "should display an error message about unknown argument [E2E-CLI-010]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-p", "/path/e2e/fixtures/samples/terraform.tf", "-t", "xml", "--silent"}, - }, - }, - Validation: func(outputText string) bool { - unknownArgRegex := regexp.MustCompile(`Error: unknown argument\(s\) for --type: xml`) - match := unknownArgRegex.MatchString(outputText) - return match - }, - WantStatus: []int{126}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-011_scan_type.go b/e2e/testcases/e2e-cli-011_scan_type.go deleted file mode 100644 index 627e720487a..00000000000 --- a/e2e/testcases/e2e-cli-011_scan_type.go +++ /dev/null @@ -1,21 +0,0 @@ -package testcases - -// E2E-CLI-011 - KICS scan with a valid case insensitive --type flag -// should perform the scan successfully and return exit code 50 -func init() { //nolint - testSample := TestCase{ - Name: "should perform a valid scan with -t flag [E2E-CLI-011]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-p", "/path/e2e/fixtures/samples/positive.dockerfile", - "-t", "DocKerFiLE", "--silent", "--payload-path", "/path/e2e/output/E2E_CLI_011_PAYLOAD.json"}, - }, - ExpectedPayload: []string{ - "E2E_CLI_011_PAYLOAD.json", - }, - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-012_scan_minimal-ui.go b/e2e/testcases/e2e-cli-012_scan_minimal-ui.go deleted file mode 100644 index 877b3346ceb..00000000000 --- a/e2e/testcases/e2e-cli-012_scan_minimal-ui.go +++ /dev/null @@ -1,25 +0,0 @@ -package testcases - -import "regexp" - -// E2E-CLI-012 - kics scan with minimal-ui flag should perform a scan -// without showing detailed results on each line of code -func init() { //nolint - testSample := TestCase{ - Name: "should display minimal-ui [E2E-CLI-012]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-p", "/path/e2e/fixtures/samples/positive.dockerfile", "--minimal-ui"}, - }, - }, - WantStatus: []int{50}, - Validation: func(outputText string) bool { - match1, _ := regexp.MatchString("Description:", outputText) - match2, _ := regexp.MatchString("Platform:", outputText) - // if not found -> the the test was successful - return !match1 && !match2 - }, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-013_list-platforms.go b/e2e/testcases/e2e-cli-013_list-platforms.go deleted file mode 100644 index 47728b0b392..00000000000 --- a/e2e/testcases/e2e-cli-013_list-platforms.go +++ /dev/null @@ -1,20 +0,0 @@ -package testcases - -// E2E-CLI-013 - KICS root command list-platforms -// should return all the supported platforms in the CLI -func init() { //nolint - testSample := TestCase{ - Name: "should list all supported platforms [E2E-CLI-013]", - Args: args{ - Args: []cmdArgs{ - []string{"list-platforms"}, - }, - ExpectedOut: []string{ - "E2E_CLI_013", - }, - }, - WantStatus: []int{0}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-014_scan_preview-lines.go b/e2e/testcases/e2e-cli-014_scan_preview-lines.go deleted file mode 100644 index 60cb957137d..00000000000 --- a/e2e/testcases/e2e-cli-014_scan_preview-lines.go +++ /dev/null @@ -1,26 +0,0 @@ -package testcases - -import "regexp" - -// E2E-CLI-014 - KICS preview-lines command must delimit the number of -// code lines that are displayed in each scan results code block. -func init() { //nolint - testSample := TestCase{ - Name: "should modify the default preview-lines value [E2E-CLI-014]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--preview-lines", "1", "--no-color", "--no-progress", - "-p", "/path/e2e/fixtures/samples/positive.dockerfile"}, - }, - }, - Validation: func(outputText string) bool { - // only the match1 must be true - match1, _ := regexp.MatchString(`005\: RUN gem install grpc -v \$\{GRPC_RUBY_VERSION\} blunder`, outputText) - match2, _ := regexp.MatchString(`006\: RUN bundle install`, outputText) - return match1 && !match2 - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-015_scan_no-color.go b/e2e/testcases/e2e-cli-015_scan_no-color.go deleted file mode 100644 index 25c7014b945..00000000000 --- a/e2e/testcases/e2e-cli-015_scan_no-color.go +++ /dev/null @@ -1,26 +0,0 @@ -package testcases - -import "regexp" - -// E2E-CLI-015 KICS scan with --no-color flag -// should disable the colored outputs of kics in the CLI -func init() { //nolint - testSample := TestCase{ - Name: "should disable colored output in the CLI [E2E-CLI-015]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--no-color", "-p", "/path/e2e/fixtures/samples/positive.dockerfile"}, - }, - }, - Validation: func(outputText string) bool { - match1, _ := regexp.MatchString(`HIGH: \d+`, outputText) - match2, _ := regexp.MatchString(`MEDIUM: \d+`, outputText) - match3, _ := regexp.MatchString(`LOW: \d+`, outputText) - match4, _ := regexp.MatchString(`INFO: \d+`, outputText) - return match1 && match2 && match3 && match4 - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-016_scan_invalid_flag.go b/e2e/testcases/e2e-cli-016_scan_invalid_flag.go deleted file mode 100644 index f2366485d4d..00000000000 --- a/e2e/testcases/e2e-cli-016_scan_invalid_flag.go +++ /dev/null @@ -1,26 +0,0 @@ -package testcases - -// E2E-CLI-016 - KICS has an invalid flag or invalid command -// an error message and return exit code 1 -func init() { //nolint - testSample := TestCase{ - Name: "should throw error messages for kics' flags [E2E-CLI-016]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--invalid-flag"}, - []string{"--invalid-flag"}, - []string{"invalid"}, - []string{"-i"}, - }, - ExpectedOut: []string{ - "E2E_CLI_016_INVALID_SCAN_FLAG", - "E2E_CLI_016_INVALID_FLAG", - "E2E_CLI_016_INVALID_COMMAND", - "E2E_CLI_016_INVALID_SHOTHAND", - }, - }, - WantStatus: []int{126, 126, 126, 126}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-017_scan_verbose.go b/e2e/testcases/e2e-cli-017_scan_verbose.go deleted file mode 100644 index 25c5aa5e475..00000000000 --- a/e2e/testcases/e2e-cli-017_scan_verbose.go +++ /dev/null @@ -1,25 +0,0 @@ -package testcases - -import "regexp" - -// E2E-CLI-017 - KICS scan command with the -v (--verbose) flag -// should display additional information in the CLI, such as 'Inspector initialized'... - -func init() { //nolint - testSample := TestCase{ - Name: "should display verbose information in the CLI [E2E-CLI-017]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-v", "--no-progress", "-p", "/path/e2e/fixtures/samples/positive.dockerfile"}, - }, - }, - Validation: func(outputText string) bool { - match1, _ := regexp.MatchString(`Inspector initialized, number of queries=\d+`, outputText) - match2, _ := regexp.MatchString(`Inspector stopped`, outputText) - return match1 && match2 - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-018_scan_exclude-categories.go b/e2e/testcases/e2e-cli-018_scan_exclude-categories.go deleted file mode 100644 index 82d76a075c8..00000000000 --- a/e2e/testcases/e2e-cli-018_scan_exclude-categories.go +++ /dev/null @@ -1,18 +0,0 @@ -package testcases - -// E2E-CLI-018 - KICS scan command with --exclude-categories flag -// should not run queries that are part of the provided categories. -func init() { //nolint - testSample := TestCase{ - Name: "should exclude provided categories [E2E-CLI-018]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--exclude-categories", "Observability,Insecure Configurations,Networking and Firewall", "-s", - "-p", "/path/e2e/fixtures/samples/terraform-single.tf"}, - }, - }, - WantStatus: []int{30}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-019_scan_multiple_paths.go b/e2e/testcases/e2e-cli-019_scan_multiple_paths.go deleted file mode 100644 index 9d14dd6b6c4..00000000000 --- a/e2e/testcases/e2e-cli-019_scan_multiple_paths.go +++ /dev/null @@ -1,25 +0,0 @@ -package testcases - -import ( - "regexp" -) - -// E2E-CLI-019 - KICS scan with multiple paths -// should run a scan for all provided paths/files -func init() { //nolint - testSample := TestCase{ - Name: "should run a scan in multiple paths [E2E-CLI-019]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-v", "-p", "/path/e2e/fixtures/samples/positive.dockerfile,/path/e2e/fixtures/samples/positive.yaml"}, - }, - }, - Validation: func(outputText string) bool { - match, _ := regexp.MatchString(`Loading queries of type: (dockerfile|cloudformation), (dockerfile|cloudformation)`, outputText) - return match - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-020_scan_exclude-queries.go b/e2e/testcases/e2e-cli-020_scan_exclude-queries.go deleted file mode 100644 index a877a06dcdd..00000000000 --- a/e2e/testcases/e2e-cli-020_scan_exclude-queries.go +++ /dev/null @@ -1,21 +0,0 @@ -package testcases - -// E2E-CLI-020 - KICS scan with --exclude-queries flag -// should not run queries that was provided in this flag. -func init() { //nolint - testSample := TestCase{ - Name: "should exclude provided queries [E2E-CLI-020]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", - "--exclude-queries", "fd54f200-402c-4333-a5a4-36ef6709af2f," + - "d3499f6d-1651-41bb-a9a7-de925fea487b," + - "b03a748a-542d-44f4-bb86-9199ab4fd2d5", - "-s", "-p", "/path/e2e/fixtures/samples/single.dockerfile"}, - }, - }, - WantStatus: []int{20}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-021_scan_status_code.go b/e2e/testcases/e2e-cli-021_scan_status_code.go deleted file mode 100644 index b22b66b3493..00000000000 --- a/e2e/testcases/e2e-cli-021_scan_status_code.go +++ /dev/null @@ -1,24 +0,0 @@ -package testcases - -// E2E-CLI-021 - KICS can return different status code based in the scan results (High/Medium/Low..) -// when excluding categories/queries and losing results we can get a different status code. -func init() { //nolint - testSample := TestCase{ - Name: "should validate the kics result status code [E2E-CLI-021]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", - "-p", "/path/e2e/fixtures/samples/positive.yaml"}, - - []string{"scan", "--exclude-categories", - "Access Control,Availability,Backup,Best Practices,Build Process,Encryption," + - "Insecure Configurations,Insecure Defaults,Networking and Firewall,Observability," + - "Resource Management,Secret Management,Supply-Chain,Structure and Semantics", - "-p", "/path/test/fixtures/all_auth_users_get_read_access/test/positive.tf"}, - }, - }, - WantStatus: []int{50, 0}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-022_scan_profiling_cpu.go b/e2e/testcases/e2e-cli-022_scan_profiling_cpu.go deleted file mode 100644 index 1671c035c23..00000000000 --- a/e2e/testcases/e2e-cli-022_scan_profiling_cpu.go +++ /dev/null @@ -1,24 +0,0 @@ -package testcases - -import "regexp" - -// E2E-CLI-022 - Kics scan command with --profiling CPU and -v flags -// should display CPU usage in the CLI -func init() { //nolint - testSample := TestCase{ - Name: "should display CPU usage in the CLI [E2E-CLI-022]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--profiling", "CPU", "-v", - "--no-progress", "--no-color", "-p", "/path/e2e/fixtures/samples/positive.dockerfile"}, - }, - }, - Validation: func(outputText string) bool { - match, _ := regexp.MatchString(`Total CPU usage for start_scan: \d+`, outputText) - return match - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-023_scan_profiling_mem.go b/e2e/testcases/e2e-cli-023_scan_profiling_mem.go deleted file mode 100644 index ee9c9276416..00000000000 --- a/e2e/testcases/e2e-cli-023_scan_profiling_mem.go +++ /dev/null @@ -1,24 +0,0 @@ -package testcases - -import "regexp" - -// E2E-CLI-023 - Kics scan command with --profiling MEM and -v flags -// should display MEM usage in the CLI -func init() { //nolint - testSample := TestCase{ - Name: "should display memory usage in the CLI [E2E-CLI-023]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--profiling", "MEM", "-v", - "--no-progress", "--no-color", "-p", "/path/e2e/fixtures/samples/positive.dockerfile"}, - }, - }, - Validation: func(outputText string) bool { - match, _ := regexp.MatchString(`Total MEM usage for start_scan: \d+`, outputText) - return match - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-024_version.go b/e2e/testcases/e2e-cli-024_version.go deleted file mode 100644 index 6edb9b66c49..00000000000 --- a/e2e/testcases/e2e-cli-024_version.go +++ /dev/null @@ -1,23 +0,0 @@ -package testcases - -import "regexp" - -// E2E-CLI-024 - KICS version command -// should display the version of the kics in the CLI. -func init() { //nolint - testSample := TestCase{ - Name: "should display the kics version [E2E-CLI-024]", - Args: args{ - Args: []cmdArgs{ - []string{"version"}, - }, - }, - Validation: func(outputText string) bool { - match, _ := regexp.MatchString(`Keeping Infrastructure as Code Secure [0-9a-zA-Z]+`, outputText) - return match - }, - WantStatus: []int{0}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-025_scan_fail-on.go b/e2e/testcases/e2e-cli-025_scan_fail-on.go deleted file mode 100644 index 5cf7f1b7fc6..00000000000 --- a/e2e/testcases/e2e-cli-025_scan_fail-on.go +++ /dev/null @@ -1,21 +0,0 @@ -package testcases - -// E2E-CLI-025 - KICS scan command with --fail-on flag should -// return status code different from 0 only when results match the severity provided in this flag -func init() { //nolint - testSample := TestCase{ - Name: "should fail-on provided values [E2E-CLI-025]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--fail-on", "info,low", - "-s", "-p", "/path/assets/queries/dockerfile/apk_add_using_local_cache_path/test/positive.dockerfile"}, - - []string{"scan", "--fail-on", "info", - "-s", "-p", "/path/assets/queries/dockerfile/apk_add_using_local_cache_path/test/positive.dockerfile"}, - }, - }, - WantStatus: []int{30, 20}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-026_scan_ignore-on-exit.go b/e2e/testcases/e2e-cli-026_scan_ignore-on-exit.go deleted file mode 100644 index 860c332cc04..00000000000 --- a/e2e/testcases/e2e-cli-026_scan_ignore-on-exit.go +++ /dev/null @@ -1,28 +0,0 @@ -package testcases - -// E2E-CLI-026 - KICS scan command with --ignore-on-exit flag -// should return status code 0 if the provided flag occurs. -// Example: '--ignore-on-exit errors' -> Returns 0 if an error was found, instead of 126/130... -func init() { //nolint - testSample := TestCase{ - Name: "should ignore on exit provided flags [E2E-CLI-026]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--ignore-on-exit", - "-s", "-p", "/path/e2e/fixtures/samples/terraform-single.invalid.name"}, - - []string{"scan", "--ignore-on-exit", "errors", - "-s", "-p", "/path/e2e/fixtures/samples/terraform-single.invalid.name"}, - - []string{"scan", "--ignore-on-exit", "errors", - "-s", "-p", "/path/e2e/fixtures/samples/positive.yaml"}, - - []string{"scan", "--ignore-on-exit", "all", - "-s", "-p", "/path/e2e/fixtures/samples/positive.yaml"}, - }, - }, - WantStatus: []int{126, 0, 50, 0}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-027_scan_exclude-paths.go b/e2e/testcases/e2e-cli-027_scan_exclude-paths.go deleted file mode 100644 index 4f3e05bb934..00000000000 --- a/e2e/testcases/e2e-cli-027_scan_exclude-paths.go +++ /dev/null @@ -1,24 +0,0 @@ -package testcases - -import "regexp" - -// E2E-CLI-027 - KICS scan command with --exclude-paths -// should not perform the scan on the files/folders provided by this flag -func init() { //nolint - testSample := TestCase{ - Name: " should exclude provided paths [E2E-CLI-027]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--exclude-paths", "/path/test/fixtures/test_swagger/swaggerFileWithoutAuthorizer.yaml", - "-p", "/path/test/fixtures/test_swagger/", "-v"}, - }, - }, - Validation: func(outputText string) bool { - match, _ := regexp.MatchString(`Scanned Files: 1`, outputText) - return match - }, - WantStatus: []int{40}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-028_scan_log-format.go b/e2e/testcases/e2e-cli-028_scan_log-format.go deleted file mode 100644 index 52f0605e567..00000000000 --- a/e2e/testcases/e2e-cli-028_scan_log-format.go +++ /dev/null @@ -1,27 +0,0 @@ -package testcases - -import "regexp" - -// E2E-CLI-028 - KICS scan command with --log-format -// should modify the view structure of output messages in the CLI (json/pretty) -func init() { //nolint - testSample := TestCase{ - Name: "should modify log format messages in the CLI [E2E-CLI-028]", - Args: args{ - Args: []cmdArgs{ - - []string{"scan", "--log-format", "json", "--verbose", - "-p", "/path/e2e/fixtures/samples/single.dockerfile"}, - }, - }, - - Validation: func(outputText string) bool { - match1, _ := regexp.MatchString(`{"level":"info"`, outputText) - match2, _ := regexp.MatchString(`"message":"Inspector initialized, number of queries=\d+"`, outputText) - return match1 && match2 - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-029_scan_config.go b/e2e/testcases/e2e-cli-029_scan_config.go deleted file mode 100644 index d4c0457fea7..00000000000 --- a/e2e/testcases/e2e-cli-029_scan_config.go +++ /dev/null @@ -1,21 +0,0 @@ -package testcases - -// E2E-CLI-029 - KICS scan command with --config flag -// should load a config file that provides commands and arguments to kics. -func init() { //nolint - testSample := TestCase{ - Name: "should load a config file [E2E-CLI-029]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--config", "/path/e2e/fixtures/samples/configs/config.json", "--type", "cloudformation"}, - - []string{"scan", "--config", "/path/e2e/fixtures/samples/configs/config.json"}, - - []string{"scan", "--config", "/path/e2e/fixtures/samples/configs/config.json", "--silent"}, - }, - }, - WantStatus: []int{50, 0, 126}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-030_output-path.go b/e2e/testcases/e2e-cli-030_output-path.go deleted file mode 100644 index e505e9c6361..00000000000 --- a/e2e/testcases/e2e-cli-030_output-path.go +++ /dev/null @@ -1,24 +0,0 @@ -package testcases - -// E2E-CLI-030 - Kics scan command with --output-path flags -// should export the result file (default json) to the path provided by this flag. -func init() { //nolint - testSample := TestCase{ - Name: "should export the result files to provided path [E2E-CLI-030]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--output-path", "/path/e2e/output", - "-p", "/path/e2e/fixtures/samples/positive.dockerfile"}, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "results", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-031_scan_report-formats.go b/e2e/testcases/e2e-cli-031_scan_report-formats.go deleted file mode 100644 index a3d52a81882..00000000000 --- a/e2e/testcases/e2e-cli-031_scan_report-formats.go +++ /dev/null @@ -1,34 +0,0 @@ -package testcases - -// E2E-CLI-031 - Kics scan command with --report-formats and --output-path flags -// should export the results based on the formats provided by this flag. -func init() { //nolint - testSample := TestCase{ - Name: "should export the results based on different formats [E2E-CLI-031]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--output-path", "/path/e2e/output", "--output-name", "E2E_CLI_031_RESULT", - "--report-formats", "json,SARIF,glsast,Html,SonarQUBE,Junit,cyclonedx,asff,csv,CodeClimate", - "-p", "/path/e2e/fixtures/samples/positive.yaml"}, - - []string{"scan", "--output-path", "/path/e2e/output", "--output-name", "E2E_CLI_031_RESULT_CIS", - "--report-formats", "json,JUnit,CSV", "--include-queries", "275a3217-ca37-40c1-a6cf-bb57d245ab32", - "-p", "/path/e2e/fixtures/samples/positive.yaml"}, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_031_RESULT", - ResultsFormats: []string{"json", "sarif", "glsast", "html", "sonarqube", "junit", "cyclonedx", "asff", "csv", "codeclimate"}, - }, - { - ResultsFile: "E2E_CLI_031_RESULT_CIS", - ResultsFormats: []string{"junit", "json-cis", "csv-cis"}, - }, - }, - UseMock: []bool{false, true}, - }, - WantStatus: []int{50, 40}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-032_scan_output-path_validate_json.go b/e2e/testcases/e2e-cli-032_scan_output-path_validate_json.go deleted file mode 100644 index 2a7028cd2ef..00000000000 --- a/e2e/testcases/e2e-cli-032_scan_output-path_validate_json.go +++ /dev/null @@ -1,25 +0,0 @@ -package testcases - -// E2E-CLI-032 - KICS scan command with --output-path flag -// should set the output path and check the results.json report format -func init() { //nolint - testSample := TestCase{ - Name: "should set the results output name [E2E-CLI-032]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", "--output-name", "E2E_CLI_032_RESULT", - "-p", "/path/e2e/fixtures/samples/positive.yaml", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_032_RESULT", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-033_scan_output-path_validate_payload.go b/e2e/testcases/e2e-cli-033_scan_output-path_validate_payload.go deleted file mode 100644 index 5ec2bc47af8..00000000000 --- a/e2e/testcases/e2e-cli-033_scan_output-path_validate_payload.go +++ /dev/null @@ -1,32 +0,0 @@ -package testcases - -// E2E-CLI-033 - KICS scan command with --output-path and --payload-path flags -// should perform a scan and create result file(s) and payload file -func init() { //nolint - testSample := TestCase{ - Name: " should perform a scan and create a result and payload file [E2E-CLI-033]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", - "--output-path", "/path/e2e/output", - "--output-name", "E2E_CLI_033_RESULT", - "--report-formats", "json,sarif,glsast,codeclimate", - "--payload-path", "/path/e2e/output/E2E_CLI_033_PAYLOAD.json", - "-p", "/path/e2e/fixtures/samples/terraform-single.tf", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_033_RESULT", - ResultsFormats: []string{"json", "sarif", "glsast", "codeclimate"}, - }, - }, - ExpectedPayload: []string{ - "E2E_CLI_033_PAYLOAD.json", - }, - }, - WantStatus: []int{40}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-034_scan_log-format_no_verbose.go b/e2e/testcases/e2e-cli-034_scan_log-format_no_verbose.go deleted file mode 100644 index 267a485169e..00000000000 --- a/e2e/testcases/e2e-cli-034_scan_log-format_no_verbose.go +++ /dev/null @@ -1,28 +0,0 @@ -package testcases - -import "regexp" - -// E2E-CLI-034 - KICS scan command with --log-format without --verbose -// should not output log messages in the CLI (json) -func init() { //nolint - testSample := TestCase{ - Name: "should not display messages in the CLI [E2E-CLI-034]", - Args: args{ - Args: []cmdArgs{ - - []string{"scan", "--log-format", "json", - "-p", "/path/e2e/fixtures/samples/single.dockerfile"}, - }, - }, - - Validation: func(outputText string) bool { - match1, _ := regexp.MatchString(`{"level":"info"`, outputText) - match2, _ := regexp.MatchString(`"message":"Inspector initialized, number of queries=\d+"`, outputText) - return !match1 && !match2 - }, - - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-035_scan_exclude-results.go b/e2e/testcases/e2e-cli-035_scan_exclude-results.go deleted file mode 100644 index 65e98ab34b1..00000000000 --- a/e2e/testcases/e2e-cli-035_scan_exclude-results.go +++ /dev/null @@ -1,25 +0,0 @@ -package testcases - -// E2E-CLI-035 - KICS scan command with --exclude-results -// should not run/found results (similarityID) provided by this flag -func init() { //nolint - testSample := TestCase{ - Name: "should exclude provided similarity ID results [E2E-CLI-035]", - Args: args{ - Args: []cmdArgs{ - - []string{"scan", - "--exclude-results", - "449be223f73b808ffbfb61a17090408aaba9615eb57f79c74e7e9cf6190b57d7," + - "d5a929b017b21438c2d42d4361f12941ea5b3d7f9eedfcb73848141b041d1f4d," + - "82ab4f612e7f3e0fbed0ac72f8747fe81f94961f94ad8302121f17ef184acd22", - "-p", "/path/e2e/fixtures/samples/single.dockerfile"}, - - []string{"scan", "--exclude-results", "-p", "/path/e2e/fixtures/samples/single.dockerfile"}, - }, - }, - WantStatus: []int{20, 126}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-036_scan_include-queries.go b/e2e/testcases/e2e-cli-036_scan_include-queries.go deleted file mode 100644 index 0a3022d5f5d..00000000000 --- a/e2e/testcases/e2e-cli-036_scan_include-queries.go +++ /dev/null @@ -1,59 +0,0 @@ -package testcases - -// E2E-CLI-036 - KICS scan command with --include-queries -// should perform a scan running only the provided queries -func init() { //nolint - testSample := TestCase{ - Name: "should perform a scan including only specific queries [E2E-CLI-036]", - Args: args{ - Args: []cmdArgs{ - - []string{"scan", "-p", "/path/e2e/fixtures/samples/positive.yaml", - "--output-path", "/path/e2e/output", "--output-name", "E2E_CLI_036_RESULT", - "--include-queries", "275a3217-ca37-40c1-a6cf-bb57d245ab32,027a4b7a-8a59-4938-a04f-ed532512cf45," + - "e415f8d3-fc2b-4f52-88ab-1129e8c8d3f5,105ba098-1e34-48cd-b0f2-a8a43a51bf9b,ad21e616-5026-4b9d-990d-5b007bfe679c," + - "79d745f0-d5f3-46db-9504-bef73e9fd528,e200a6f3-c589-49ec-9143-7421d4a2c845,01d5a458-a6c4-452a-ac50-054d59275b7c," + - "7f384a5f-b5a2-4d84-8ca3-ee0a5247becb,87482183-a8e7-4e42-a566-7a23ec231c16,4a1e6b34-1008-4e61-a5f2-1f7c276f8d14," + - "d24389b4-b209-4ff0-8345-dc7a4569dcdd,5e6c9c68-8a82-408e-8749-ddad78cbb9c5"}, // Load Many Queries (13) - - []string{"scan", "-p", "/path/e2e/fixtures/samples/positive.yaml", - "--output-path", "/path/e2e/output", "--output-name", "E2E_CLI_036_RESULT_2", - "--include-queries", "87482183-a8e7-4e42-a566-7a23ec231c16"}, // Load 1 query - - []string{"scan", "-p", "/path/e2e/fixtures/samples/positive.yaml", - "--include-queries", "87482183-a8e7-4e42-a566-7a23ec231c17"}, // Load 0 queries (valid, but doesn't exists) - - []string{"scan", "-p", "/path/e2e/fixtures/samples/positive.yaml", - "--include-queries", "87482183-a8e7-4e42-a566-7a23ec23KICS"}, // Invalid query ID - - []string{"scan", "--include-queries", "cfdcabb0-fc06-427c-865b-c59f13e898ce", - "-s", "-p", "/path/e2e/fixtures/samples/terraform.tf"}, - - []string{"scan", "--include-queries", "e38a8e0a-b88b-4902-b3fe-b0fcb17d5c10,15ffbacc-fa42-4f6f-a57d-2feac7365caa", - "-s", "-p", "/path/e2e/fixtures/samples/terraform.tf"}, - - []string{"scan", "--include-queries", "e38a8e0a-b88b-4902-b3fe-b0fcb17d5c10", - "-s", "-p", "/path/e2e/fixtures/samples/terraform.tf"}, - - []string{"scan", "--include-queries", - "-p", "/path/e2e/fixtures/samples/terraform-single.tf"}, - []string{"scan", "--include-queries", - "--queries-path", "/path/assets/queries", "-p", "/path/e2e/fixtures/samples/terraform-single.tf"}, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_036_RESULT", - ResultsFormats: []string{"json"}, - }, - { - ResultsFile: "E2E_CLI_036_RESULT_2", - ResultsFormats: []string{"json"}, - }, - }, - }, - - WantStatus: []int{50, 40, 0, 126, 50, 40, 20, 126, 126}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-037_scan_exclude-results_include-queries.go b/e2e/testcases/e2e-cli-037_scan_exclude-results_include-queries.go deleted file mode 100644 index 6e4327af9dc..00000000000 --- a/e2e/testcases/e2e-cli-037_scan_exclude-results_include-queries.go +++ /dev/null @@ -1,25 +0,0 @@ -package testcases - -// E2E-CLI-037 - KICS scan command with --exclude-results and --include-queries -// should run only provided queries and does not run results (similarityID) provided by this flag -func init() { //nolint - testSample := TestCase{ - Name: "should run only provided queries and exclude provided results [E2E-CLI-037]", - Args: args{ - Args: []cmdArgs{ - - []string{"scan", "--include-queries", "e38a8e0a-b88b-4902-b3fe-b0fcb17d5c10", - "--exclude-results", "406b71d9fd0edb656a4735df30dde77c5f8a6c4ec3caa3442f986a92832c653b", - "-p", "/path/e2e/fixtures/samples/terraform-single.tf"}, - - []string{"scan", "--include-queries", "e38a8e0a-b88b-4902-b3fe-b0fcb17d5c10", - "--exclude-results", "d1c5f6aec84fd91ed24f5f06ccb8b6662e26c0202bcb5d4a58a1458c16456d20", - "-p", "/path/e2e/fixtures/samples/terraform-single.tf"}, - }, - }, - - WantStatus: []int{0, 20}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-038_scan_log-path.go b/e2e/testcases/e2e-cli-038_scan_log-path.go deleted file mode 100644 index bfd4d338d56..00000000000 --- a/e2e/testcases/e2e-cli-038_scan_log-path.go +++ /dev/null @@ -1,35 +0,0 @@ -package testcases - -import "regexp" - -// E2E-CLI-038 - KICS scan command with --log-path -// should generate and save a log file for the scan -func init() { //nolint - testSample := TestCase{ - Name: "should generate and save a log file [E2E-CLI-038]", - Args: args{ - Args: []cmdArgs{ - - []string{"scan", "--log-path", "/path/e2e/output/E2E_CLI_038_LOG", - "-p", "/path/e2e/fixtures/samples/positive.yaml"}, - }, - - ExpectedLog: LogValidation{ - LogFile: "E2E_CLI_038_LOG", - ValidationFunc: func(logText string) bool { - match1, _ := regexp.MatchString("Scanning with Keeping Infrastructure as Code Secure", logText) - match2, _ := regexp.MatchString(`Parsed Files: \d+`, logText) - match3, _ := regexp.MatchString(`Scanned Lines: \d+`, logText) - match4, _ := regexp.MatchString(`Parsed Lines: \d+`, logText) - match5, _ := regexp.MatchString(`Ignored Lines: \d+`, logText) - match6, _ := regexp.MatchString(`Queries loaded: \d+`, logText) - match7, _ := regexp.MatchString(`Queries failed to execute: \d+`, logText) - return match1 && match2 && match3 && match4 && match5 && match6 && match7 - }, - }, - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-039_scan_log-path_log-level.go b/e2e/testcases/e2e-cli-039_scan_log-path_log-level.go deleted file mode 100644 index 7dbf3be4bf4..00000000000 --- a/e2e/testcases/e2e-cli-039_scan_log-path_log-level.go +++ /dev/null @@ -1,32 +0,0 @@ -package testcases - -import "regexp" - -// E2E-CLI-039 - KICS scan command with --log-path and --log-level -// should generate and save a log file based in the provided log-level -func init() { //nolint - testSample := TestCase{ - Name: " should generate and save a log file with log level [E2E-CLI-039]", - Args: args{ - Args: []cmdArgs{ - - []string{"scan", "--log-path", "/path/e2e/output/E2E_CLI_039_LOG", - "--log-level", "Trace", - "-p", "/path/e2e/fixtures/samples/positive.yaml"}, - }, - - ExpectedLog: LogValidation{ - LogFile: "E2E_CLI_039_LOG", - ValidationFunc: func(logText string) bool { - match1, _ := regexp.MatchString("TRACE", logText) - match2, _ := regexp.MatchString(`Inspector executed with result`, logText) - match3, _ := regexp.MatchString(`Scan duration: \d+`, logText) - return match1 && match2 && match3 - }, - }, - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-040_scan_report-formats_validate_outputs.go b/e2e/testcases/e2e-cli-040_scan_report-formats_validate_outputs.go deleted file mode 100644 index b58beae6cce..00000000000 --- a/e2e/testcases/e2e-cli-040_scan_report-formats_validate_outputs.go +++ /dev/null @@ -1,25 +0,0 @@ -package testcases - -// E2E-CLI-040 - Kics scan command with --report-formats and --output-path flags -// should export the results based on the formats provided by this flag. -func init() { //nolint - testSample := TestCase{ - Name: "should export the results based on report formats [E2E-CLI-040]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--output-path", "/path/e2e/output", "--output-name", "E2E_CLI_040_RESULT", - "--report-formats", "json,sarif,glsast,html,sonarqube", - "-p", "/path/e2e/fixtures/samples/positive.yaml"}, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_040_RESULT", - ResultsFormats: []string{"json", "sarif", "glsast", "html", "sonarqube"}, - }, - }, - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-042_scan_remote_path_http.go b/e2e/testcases/e2e-cli-042_scan_remote_path_http.go deleted file mode 100644 index 2cd44c8ba4f..00000000000 --- a/e2e/testcases/e2e-cli-042_scan_remote_path_http.go +++ /dev/null @@ -1,25 +0,0 @@ -package testcases - -// E2E-CLI-042 - Kics scan command with -p targeting remote path (http/https) -// should download and scan the provided path/file. -func init() { //nolint - testSample := TestCase{ - Name: "should download and scan the provided http path/file [E2E-CLI-042]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--output-path", "/path/e2e/output", "--output-name", "E2E_CLI_042_RESULT", - "--report-formats", "json,sarif,glsast", - "-p", "https://raw.githubusercontent.com/dockersamples/example-voting-app/main/docker-compose.yml"}, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_042_RESULT", - ResultsFormats: []string{"json", "sarif", "glsast"}, - }, - }, - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-043_scan_cloud-provider.go b/e2e/testcases/e2e-cli-043_scan_cloud-provider.go deleted file mode 100644 index bcdd03d0788..00000000000 --- a/e2e/testcases/e2e-cli-043_scan_cloud-provider.go +++ /dev/null @@ -1,24 +0,0 @@ -package testcases - -// E2E-CLI-043 - Kics scan command with --cloud-provider -// should execute only queries that have the same provider as given in the flag. -func init() { //nolint - testSample := TestCase{ - Name: "should execute only queries of specific cloud provider [E2E-CLI-043]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "", "/path/e2e/fixtures/samples/positive.yaml", - "--cloud-provider", "none"}, - - []string{"scan", "-p", "/path/e2e/fixtures/samples/positive.yaml", - "--cloud-provider"}, - - []string{"scan", "-p", "/path/e2e/fixtures/samples/positive.yaml", - "--cloud-provider", "aWs"}, - }, - }, - WantStatus: []int{126, 126, 50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-044_scan_exclude-severities.go b/e2e/testcases/e2e-cli-044_scan_exclude-severities.go deleted file mode 100644 index 29a88163b39..00000000000 --- a/e2e/testcases/e2e-cli-044_scan_exclude-severities.go +++ /dev/null @@ -1,31 +0,0 @@ -package testcases - -// E2E-CLI-044 - Kics scan command with --exclude-severities -// should exclude results with the specified severities -func init() { //nolint - testSample := TestCase{ - Name: "should exclude queries by given severities [E2E-CLI-044]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-p", "/path/e2e/fixtures/samples/positive.yaml", - "--output-path", "/path/e2e/output", "--output-name", "E2E_CLI_044_RESULT", - "--exclude-severities", "HIGH"}, - - []string{"scan", "-p", "/path/e2e/fixtures/samples/positive.yaml", - "--output-path", "/path/e2e/output", "--output-name", "E2E_CLI_044_RESULT", - "--exclude-severities", "HIGH,MEDIUM,LOW,INFO"}, - - []string{"scan", "-p", "/path/e2e/fixtures/samples/terraform.tf", - "--output-path", "/path/e2e/output", "--output-name", "E2E_CLI_044_RESULT", - "--exclude-severities"}, - - []string{"scan", "-p", "/path/e2e/fixtures/samples/terraform.tf", - "--output-path", "/path/e2e/output", "--output-name", "E2E_CLI_044_RESULT", - "--exclude-severities", "HIGH,MEDIUM,LOW"}, - }, - }, - WantStatus: []int{40, 0, 126, 20}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-045_scan_disable-secrets.go b/e2e/testcases/e2e-cli-045_scan_disable-secrets.go deleted file mode 100644 index 4cf6ca7a819..00000000000 --- a/e2e/testcases/e2e-cli-045_scan_disable-secrets.go +++ /dev/null @@ -1,26 +0,0 @@ -package testcases - -// E2E-CLI-045 - Kics scan command with --disable-secrets -// should not execute secret based queries. -func init() { //nolint - testSample := TestCase{ - Name: "should not execute secret queries [E2E-CLI-045]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-p", "/path/e2e/fixtures/samples/terraform.tf", - "--include-queries", "487f4be7-3fd9-4506-a07a-eae252180c08"}, - - []string{"scan", "-p", "/path/e2e/fixtures/samples/terraform.tf", - "--include-queries", "487f4be7-3fd9-4506-a07a-eae252180c08", - "--disable-secrets"}, - - []string{"scan", "-p", "/path/e2e/fixtures/samples/terraform.tf", - "--include-queries", "487f4be7-3fd9-4506-a07a-eae252180c08,e38a8e0a-b88b-4902-b3fe-b0fcb17d5c10", - "--disable-secrets"}, - }, - }, - WantStatus: []int{50, 0, 20}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-046_scan_disable-full-descriptions.go b/e2e/testcases/e2e-cli-046_scan_disable-full-descriptions.go deleted file mode 100644 index 35999a3ad8c..00000000000 --- a/e2e/testcases/e2e-cli-046_scan_disable-full-descriptions.go +++ /dev/null @@ -1,26 +0,0 @@ -package testcases - -import "regexp" - -// E2E-CLI-046 - Kics scan command with --disable-full-descriptions -// should fetch descriptions from environment URL KICS_DESCRIPTIONS_ENDPOINT. -func init() { //nolint - testSample := TestCase{ - Name: "should fetch descriptions from environment [E2E-CLI-046]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-p", "/path/e2e/fixtures/samples/positive.dockerfile", - "--no-color", "-v", - "--disable-full-descriptions"}, - }, - }, - Validation: func(outputText string) bool { - uuidRegex := "Skipping descriptions because provided disable flag is set" - match, _ := regexp.MatchString(uuidRegex, outputText) - return match - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-047_scan_payload-lines.go b/e2e/testcases/e2e-cli-047_scan_payload-lines.go deleted file mode 100644 index 782970d5741..00000000000 --- a/e2e/testcases/e2e-cli-047_scan_payload-lines.go +++ /dev/null @@ -1,21 +0,0 @@ -package testcases - -// E2E-CLI-047 - Kics scan command with --payload-lines -// should display additional information lines in the payload file. -func init() { //nolint - testSample := TestCase{ - Name: "should display line references in the payload file [E2E-CLI-047]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--silent", "-p", "/path/e2e/fixtures/samples/terraform.tf", - "--payload-path", "/path/e2e/output/E2E_CLI_047_PAYLOAD.json", "--payload-lines"}, - }, - ExpectedPayload: []string{ - "E2E_CLI_047_PAYLOAD.json", - }, - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-048_scan_custom-secrets-regexes.go b/e2e/testcases/e2e-cli-048_scan_custom-secrets-regexes.go deleted file mode 100644 index 4351c5bc383..00000000000 --- a/e2e/testcases/e2e-cli-048_scan_custom-secrets-regexes.go +++ /dev/null @@ -1,34 +0,0 @@ -package testcases - -// E2E-CLI-048 - Kics scan command with --secrets-regexes-path -// should load custom secrets rules from provided path. -func init() { //nolint - testSample := TestCase{ - Name: "should load custom secrets rules from provided path [E2E-CLI-048]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--silent", "-p", "/path/e2e/fixtures/samples/terraform-secret.tf", - "--secrets-regexes-path", "/path/e2e/fixtures/samples/secrets/regex_rules_48_valid.json"}, - - []string{"scan", "--silent", "-p", "/path/e2e/fixtures/samples/terraform-secret.tf", - "--secrets-regexes-path", "/path/e2e/fixtures/samples/secrets/regex_rules_48_valid.json", - "--exclude-queries", "487f4be7-3fd9-4506-a07a-eae252180c08"}, - - []string{"scan", "--silent", "-p", "/path/e2e/fixtures/samples/terraform-secret.tf", - "--secrets-regexes-path", "/path/e2e/fixtures/samples/secrets/regex_rules_48_empty.json"}, - - []string{"scan", "--silent", "-p", "/path/e2e/fixtures/samples/terraform-secret.tf", - "--secrets-regexes-path", "/path/e2e/fixtures/samples/secrets/regex_rules_48_invalid_regex.json"}, - - []string{"scan", "--silent", "-p", "/path/e2e/fixtures/samples/terraform.tf", - "--secrets-regexes-path", "not-exists-folder"}, - - []string{"scan", "--silent", "-p", "/path/e2e/fixtures/samples/terraform.tf", - "--secrets-regexes-path", "samples"}, - }, - }, - WantStatus: []int{50, 40, 40, 126, 126, 126}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-049_scan_custom-libraries-path.go b/e2e/testcases/e2e-cli-049_scan_custom-libraries-path.go deleted file mode 100644 index b170825d858..00000000000 --- a/e2e/testcases/e2e-cli-049_scan_custom-libraries-path.go +++ /dev/null @@ -1,24 +0,0 @@ -package testcases - -// E2E-CLI-049 - Kics scan command with --libraries-path -// should load libraries from the provided path. -func init() { //nolint - testSample := TestCase{ - Name: "should load libraries from the provided path [E2E-CLI-049]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--silent", "-p", "/path/e2e/fixtures/samples/terraform-single.tf", - "--libraries-path", "/path/e2e/fixtures/samples/libraries"}, - - []string{"scan", "--silent", "-p", "/path/e2e/fixtures/samples/positive.yaml", - "--libraries-path", "/path/e2e/fixtures/samples/libraries"}, - - []string{"scan", "--silent", "-p", "/path/e2e/fixtures/samples/positive.yaml", - "--libraries-path", "/path/e2e/fixtures/samples/not-exists-folder"}, - }, - }, - WantStatus: []int{0, 50, 126}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-050_scan_bill-of-materials.go b/e2e/testcases/e2e-cli-050_scan_bill-of-materials.go deleted file mode 100644 index 22df7077eb1..00000000000 --- a/e2e/testcases/e2e-cli-050_scan_bill-of-materials.go +++ /dev/null @@ -1,27 +0,0 @@ -package testcases - -// E2E-CLI-050 - Kics scan command with --bom (or -m) -// should include bill of materials (BoM) in results output -func init() { //nolint - testSample := TestCase{ - Name: "should include bill of materials in results output [E2E-CLI-050]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-p", "/path/e2e/fixtures/samples/bom-positive.tf", - "--bom", "-o", "/path/e2e/output"}, - - []string{"scan", "-p", "/path/e2e/fixtures/samples/bom-positive.tf", - "--m"}, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "results", - ResultsFormats: []string{"json-bom"}, - }, - }, - }, - WantStatus: []int{50, 126}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-051_scan_custom-queries-path.go b/e2e/testcases/e2e-cli-051_scan_custom-queries-path.go deleted file mode 100644 index a62652f55b2..00000000000 --- a/e2e/testcases/e2e-cli-051_scan_custom-queries-path.go +++ /dev/null @@ -1,24 +0,0 @@ -package testcases - -// E2E-CLI-051 - Kics scan command with --queries-path -// should load and execute queries found in the provided path -func init() { //nolint - testSample := TestCase{ - Name: "should load and execute queries from a custom path [E2E-CLI-051]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--queries-path", "/path/e2e/fixtures/samples/queries/valid/single_query", - "-p", "/path/e2e/fixtures/samples/bom-positive.tf"}, - []string{"scan", "--queries-path", "/path/e2e/fixtures/samples/queries/invalid/invalid_metadata", - "-p", "/path/e2e/fixtures/samples/bom-positive.tf"}, - []string{"scan", "--queries-path", "/path/e2e/fixtures/samples/queries/invalid/missing_metadata", "-p", - "/path/e2e/fixtures/samples/bom-positive.tf"}, - []string{"scan", "--queries-path", "/path/e2e/fixtures/samples/invalid_path", - "-p", "/path/e2e/fixtures/samples/bom-positive.tf"}, - }, - }, - WantStatus: []int{50, 0, 0, 126}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-052_scan_with_custom_cis_descriptions.go b/e2e/testcases/e2e-cli-052_scan_with_custom_cis_descriptions.go deleted file mode 100644 index f8bc7292480..00000000000 --- a/e2e/testcases/e2e-cli-052_scan_with_custom_cis_descriptions.go +++ /dev/null @@ -1,35 +0,0 @@ -package testcases - -// E2E-CLI-052 - Kics scan with a custom CIS descriptions env variable -// should load and display the correct CIS descriptions (provided by the custom server) -func init() { //nolint - testSample := TestCase{ - Name: "should load descriptions from a custom server [E2E-CLI-052]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", - "-p", "/path/e2e/fixtures/samples/terraform.tf", "--no-color", - "--include-queries", "487f4be7-3fd9-4506-a07a-eae252180c08,cfdcabb0-fc06-427c-865b-c59f13e898ce", - "-o", "/path/e2e/output", "--output-name", "/path/e2e/output/E2E_CLI_052_RESULTS_ALL_HAVE_CIS.json"}, - - []string{"scan", - "-p", "/path/e2e/fixtures/samples/terraform.tf", "--no-color", - "-o", "/path/e2e/output", "--output-name", "/path/e2e/output/E2E_CLI_052_RESULTS_SOME_HAVE_CIS.json"}, - }, - UseMock: []bool{true, true}, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_052_RESULTS_ALL_HAVE_CIS", - ResultsFormats: []string{"json-cis"}, - }, - { - ResultsFile: "E2E_CLI_052_RESULTS_SOME_HAVE_CIS", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{50, 50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-053_kics_scan_ignore.go b/e2e/testcases/e2e-cli-053_kics_scan_ignore.go deleted file mode 100644 index a1ec0194cae..00000000000 --- a/e2e/testcases/e2e-cli-053_kics_scan_ignore.go +++ /dev/null @@ -1,20 +0,0 @@ -package testcases - -// E2E-CLI-053 - Kics scan can ignore entire files, blocks and lines based in kics-ignore comments -func init() { //nolint - testSample := TestCase{ - Name: "should ignore files/code-blocks/code-lines during the scan [E2E-CLI-053]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-p", "/path/e2e/fixtures/samples/scan-ignore/enable.tf"}, - []string{"scan", "-p", "/path/e2e/fixtures/samples/scan-ignore/disable.tf"}, - []string{"scan", "-p", "/path/e2e/fixtures/samples/scan-ignore/ignore-block.dockerfile"}, - []string{"scan", "-p", "/path/e2e/fixtures/samples/scan-ignore/ignore-lines.yaml"}, - []string{"scan", "-p", "/path/e2e/fixtures/samples/scan-ignore/ignore"}, - }, - }, - WantStatus: []int{40, 20, 30, 40, 0}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-054_scan_multiple-queries-path.go b/e2e/testcases/e2e-cli-054_scan_multiple-queries-path.go deleted file mode 100644 index 7349fa1fd46..00000000000 --- a/e2e/testcases/e2e-cli-054_scan_multiple-queries-path.go +++ /dev/null @@ -1,26 +0,0 @@ -package testcases - -import "regexp" - -// E2E-CLI-054 - Kics scan command with --queries-path using multiple entries -// should load and execute queries found in the provided paths -func init() { //nolint - testSample := TestCase{ - Name: "should load and execute queries from multiple paths [E2E-CLI-054]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--queries-path", "/path/e2e/fixtures/samples/queries/valid/single_query," + - "/path/e2e/fixtures/samples/queries/valid/multiple_query", - "-p", "/path/e2e/fixtures/samples/bom-positive.tf"}, - }, - }, - Validation: func(outputText string) bool { - matchQueryPath1, _ := regexp.MatchString(`Athena Database Not Encrypted`, outputText) - matchQueryPath2, _ := regexp.MatchString(`S3 Bucket Without Enabled MFA Delete`, outputText) - return matchQueryPath1 && matchQueryPath2 - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-055_scan_resolve_openapi_files.go b/e2e/testcases/e2e-cli-055_scan_resolve_openapi_files.go deleted file mode 100644 index 91fc8b339ef..00000000000 --- a/e2e/testcases/e2e-cli-055_scan_resolve_openapi_files.go +++ /dev/null @@ -1,23 +0,0 @@ -package testcases - -import "regexp" - -// E2E-CLI-055 - Kics scan command with openapi files that are not resolved -// should resolve openapi files and return results in same file -func init() { //nolint - testSample := TestCase{ - Name: "should resolve openapi files and return results in different files [E2E-CLI-055]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-p", "/path/e2e/fixtures/samples/unresolved_openapi"}, - }, - }, - WantStatus: []int{50}, - Validation: func(outputText string) bool { - matchQueryPath1, _ := regexp.MatchString(`openapi.yaml`, outputText) - return matchQueryPath1 - }, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-056_scan_timeout.go b/e2e/testcases/e2e-cli-056_scan_timeout.go deleted file mode 100644 index 0095f8f3cae..00000000000 --- a/e2e/testcases/e2e-cli-056_scan_timeout.go +++ /dev/null @@ -1,27 +0,0 @@ -package testcases - -import ( - "regexp" -) - -// E2E-CLI-056 - Kics scan command with timeout flag -// should stop a query execution when reaching the provided timeout (seconds) -func init() { //nolint - testSample := TestCase{ - Name: "should timeout queries when reaching the timeout limit [E2E-CLI-056]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "--config", "/path/e2e/fixtures/samples/configs/config.yaml", "-v"}, - []string{"scan", "-p", "/path/e2e/fixtures/samples/positive.dockerfile", "--timeout", "1", "-v"}, - []string{"scan", "-p", "/path/e2e/fixtures/samples/positive.dockerfile", "--timeout", "0", "-v"}, - }, - }, - WantStatus: []int{50, 50, 126}, - Validation: func(outputText string) bool { - matchTimeoutLog, _ := regexp.MatchString("Query execution timeout=(0|1|12)s", outputText) - return matchTimeoutLog - }, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-057_fix_all.go b/e2e/testcases/e2e-cli-057_fix_all.go deleted file mode 100644 index 8d53565cce6..00000000000 --- a/e2e/testcases/e2e-cli-057_fix_all.go +++ /dev/null @@ -1,28 +0,0 @@ -package testcases - -import ( - "regexp" -) - -// E2E-CLI-057 - Kics remediate command -// should remediate all remediation found -func init() { //nolint - generateResults("results-remediate-all") - - testSample := TestCase{ - Name: "should remediate all remediation found [E2E-CLI-057]", - Args: args{ - Args: []cmdArgs{ - []string{"remediate", "--results", "/path/e2e/tmp-kics-ar/results-remediate-all.json", "-v"}, - }, - }, - WantStatus: []int{0}, - Validation: func(outputText string) bool { - match1, _ := regexp.MatchString(`Selected remediation: 5`, outputText) - match2, _ := regexp.MatchString(`Remediation done: 5`, outputText) - return match1 && match2 - }, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-058_fix_include_ids.go b/e2e/testcases/e2e-cli-058_fix_include_ids.go deleted file mode 100644 index 1526d353f69..00000000000 --- a/e2e/testcases/e2e-cli-058_fix_include_ids.go +++ /dev/null @@ -1,31 +0,0 @@ -package testcases - -import ( - "regexp" -) - -// E2E-CLI-057 - Kics remediate command -// should remediate all remediation found -func init() { //nolint - generateResults("results-remediate-include-ids") - - testSample := TestCase{ - Name: "should remediate the recommendations pointed in include-ids flag [E2E-CLI-058]", - Args: args{ - Args: []cmdArgs{ - []string{"remediate", "--results", "/path/e2e/tmp-kics-ar/results-remediate-include-ids.json", - "--include-ids", "f282fa13cf5e4ffd4bbb0ee2059f8d0240edcd2ca54b3bb71633145d961de5ce," + - "87abbee5d0ec977ba193371c702dca2c040ea902d2e606806a63b66119ff89bc", - "-v"}, - }, - }, - WantStatus: []int{0}, - Validation: func(outputText string) bool { - match1, _ := regexp.MatchString(`Selected remediation: 2`, outputText) - match2, _ := regexp.MatchString(`Remediation done: 2`, outputText) - return match1 && match2 - }, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-059_help_fix.go b/e2e/testcases/e2e-cli-059_help_fix.go deleted file mode 100644 index ede40f3f54e..00000000000 --- a/e2e/testcases/e2e-cli-059_help_fix.go +++ /dev/null @@ -1,18 +0,0 @@ -package testcases - -// E2E-CLI-059 - KICS remediate command should display a help text in the CLI when provided with the -// --help flag and it should describe the options related with remediate plus the global options -func init() { //nolint - testSample := TestCase{ - Name: "should display the kics remediate help text [E2E-CLI-059]", - Args: args{ - Args: []cmdArgs{ - []string{"remediate", "--help"}, - }, - ExpectedOut: []string{"E2E_CLI_059"}, - }, - WantStatus: []int{0}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-060_fix_text.go b/e2e/testcases/e2e-cli-060_fix_text.go deleted file mode 100644 index f2f5b670402..00000000000 --- a/e2e/testcases/e2e-cli-060_fix_text.go +++ /dev/null @@ -1,18 +0,0 @@ -package testcases - -// E2E-CLI-060 - KICS remediate command has a mandatory flag --results. The CLI should exhibit -// an error message and return exit code 126 -func init() { //nolint - testSample := TestCase{ - Name: "should display an error regarding missing --results flag [E2E-CLI-060]", - Args: args{ - Args: []cmdArgs{ - []string{"remediate"}, - }, - ExpectedOut: []string{"E2E_CLI_060"}, - }, - WantStatus: []int{126}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-061_scan_exclude_type.go b/e2e/testcases/e2e-cli-061_scan_exclude_type.go deleted file mode 100644 index 3bab9e64720..00000000000 --- a/e2e/testcases/e2e-cli-061_scan_exclude_type.go +++ /dev/null @@ -1,23 +0,0 @@ -// Package testcases provides end-to-end (E2E) testing functionality for the application. -package testcases - -// E2E-CLI-061 - KICS scan with a valid case insensitive --exclude-type flag -// should perform the scan successfully and return exit code 50 -func init() { //nolint - testSample := TestCase{ - Name: "should perform a valid scan with --exclude-type flag [E2E-CLI-061]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-p", "\"/path/e2e/fixtures/samples/positive.dockerfile\",\"/path/e2e/fixtures/samples/terraform.tf\"", - "--silent", "--payload-path", "/path/e2e/output/E2E_CLI_061_PAYLOAD.json", "--exclude-type", - "TeRRafOrm"}, - }, - ExpectedPayload: []string{ - "E2E_CLI_061_PAYLOAD.json", - }, - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-062_tf_variables_comment_path.go b/e2e/testcases/e2e-cli-062_tf_variables_comment_path.go deleted file mode 100644 index 524febbef5f..00000000000 --- a/e2e/testcases/e2e-cli-062_tf_variables_comment_path.go +++ /dev/null @@ -1,22 +0,0 @@ -// Package testcases provides end-to-end (E2E) testing functionality for the application. -package testcases - -// E2E-CLI-062 - KICS scan and get the variables using a variables path as a comment -// should perform the scan successfully and return exit code 0 -func init() { //nolint - testSample := TestCase{ - Name: "should perform a valid scan and get the variables using a variables path as a comment [E2E-CLI-062]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-p", "\"/path/e2e/fixtures/samples/terraform-vars-path/tfFiles\"", - "--silent", "--payload-path", "/path/e2e/output/E2E_CLI_062_PAYLOAD.json"}, - }, - ExpectedPayload: []string{ - "E2E_CLI_062_PAYLOAD.json", - }, - }, - WantStatus: []int{0}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-063_tf_variables_flag_path.go b/e2e/testcases/e2e-cli-063_tf_variables_flag_path.go deleted file mode 100644 index 65ddf4388f4..00000000000 --- a/e2e/testcases/e2e-cli-063_tf_variables_flag_path.go +++ /dev/null @@ -1,23 +0,0 @@ -// Package testcases provides end-to-end (E2E) testing functionality for the application. -package testcases - -// E2E-CLI-063 - KICS scan and get the variables using a variables path as a flag -// should perform the scan successfully and return exit code 0 -func init() { //nolint - testSample := TestCase{ - Name: "should perform a valid scan and get the variables using a variables path as a flag [E2E-CLI-063]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-p", "\"/path/e2e/fixtures/samples/terraform-vars-path/tfFiles\"", - "--silent", "--payload-path", "/path/e2e/output/E2E_CLI_063_PAYLOAD.json", - "--terraform-vars-path", "/path/e2e/fixtures/samples/terraform-vars-path/terraform-vars.tfvars"}, - }, - ExpectedPayload: []string{ - "E2E_CLI_063_PAYLOAD.json", - }, - }, - WantStatus: []int{0}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-064_json_file_ref.go b/e2e/testcases/e2e-cli-064_json_file_ref.go deleted file mode 100644 index b98432e31c0..00000000000 --- a/e2e/testcases/e2e-cli-064_json_file_ref.go +++ /dev/null @@ -1,19 +0,0 @@ -// Package testcases provides end-to-end (E2E) testing functionality for the application. -package testcases - -// E2E-CLI-064 - KICS scan with json/yaml file with ## in non ref -// should perform the scan successfully and return exit code 0 -func init() { //nolint - testSample := TestCase{ - Name: "should perform a valid scan with json/yaml file with ## in non ref [E2E-CLI-064]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-p", "\"/path/e2e/fixtures/samples/swagger\"", - "--silent"}, - }, - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-065_yaml_resolver_panic.go b/e2e/testcases/e2e-cli-065_yaml_resolver_panic.go deleted file mode 100644 index ab7744c2611..00000000000 --- a/e2e/testcases/e2e-cli-065_yaml_resolver_panic.go +++ /dev/null @@ -1,19 +0,0 @@ -// Package testcases provides end-to-end (E2E) testing functionality for the application. -package testcases - -// E2E-CLI-065 - KICS scan -// should perform the scan successfully and return exit code 0 -func init() { //nolint - testSample := TestCase{ - Name: "should perform a valid scan [E2E-CLI-065]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-p", "\"/path/e2e/fixtures/samples/panicYamlRef/file1.yaml\"", - "--silent"}, - }, - }, - WantStatus: []int{0}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-066_analyze_command.go b/e2e/testcases/e2e-cli-066_analyze_command.go deleted file mode 100644 index f848d7a7c94..00000000000 --- a/e2e/testcases/e2e-cli-066_analyze_command.go +++ /dev/null @@ -1,23 +0,0 @@ -// Package testcases provides end-to-end (E2E) testing functionality for the application. -package testcases - -// E2E-CLI-066 - KICS analyze -// should finish successfully and return exit code 0 -func init() { //nolint - testSample := TestCase{ - Name: "should perform a valid analyze [E2E-CLI-066]", - Args: args{ - Args: []cmdArgs{ - []string{"analyze", - "--analyze-path", "/path/e2e/fixtures/samples/swagger", - "--analyze-results", "/path/e2e/output/E2E_CLI_066_ANALYZE_RESULTS.json"}, - }, - ExpectedAnalyzerResults: &ResultsValidation{ - ResultsFile: "E2E_CLI_066_ANALYZE_RESULTS", - ResultsFormats: []string{"json"}, - }, - }, - WantStatus: []int{0}, - } - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-067_ignore_broken_symlink_eloop.go b/e2e/testcases/e2e-cli-067_ignore_broken_symlink_eloop.go deleted file mode 100644 index bf610791402..00000000000 --- a/e2e/testcases/e2e-cli-067_ignore_broken_symlink_eloop.go +++ /dev/null @@ -1,22 +0,0 @@ -// Package testcases provides end-to-end (E2E) testing functionality for the application. -package testcases - -// E2E-CLI-067 - KICS scan but ignore broken symlinks and symlinks that create endless loops -// should perform the scan successfully and return exit code 0 -func init() { //nolint - testSample := TestCase{ - Name: "should perform a valid scan but ignore broken symlinks and symlinks that create endless loops [E2E-CLI-067]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-p", "\"/path/test/fixtures/link_test/broken_symlink\"", "\"/path/test/fixtures/link_test/eloop_link\"", - "--silent", "--payload-path", "/path/e2e/output/E2E_CLI_067_PAYLOAD.json"}, - }, - ExpectedPayload: []string{ - "E2E_CLI_067_PAYLOAD.json", - }, - }, - WantStatus: []int{0}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-068_corrupted_dockerfile.go b/e2e/testcases/e2e-cli-068_corrupted_dockerfile.go deleted file mode 100644 index a454068801c..00000000000 --- a/e2e/testcases/e2e-cli-068_corrupted_dockerfile.go +++ /dev/null @@ -1,26 +0,0 @@ -// Package testcases provides end-to-end (E2E) testing functionality for the application. -package testcases - -// E2E-CLI-068 - KICS scan but recover from corrupted dockerfile -// should perform the scan successfully and return exit code 50 -func init() { //nolint - testSample := TestCase{ - Name: "should perform a valid scan and recover from a corrupted dockerfile [E2E-CLI-068]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", "--output-name", "E2E_CLI_068_RESULT", - "-p", "/path/test/fixtures/dockerfile/corrupted_dockerfile", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_068_RESULT", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-069_ignore_experimental_query.go b/e2e/testcases/e2e-cli-069_ignore_experimental_query.go deleted file mode 100644 index 49465d3442f..00000000000 --- a/e2e/testcases/e2e-cli-069_ignore_experimental_query.go +++ /dev/null @@ -1,31 +0,0 @@ -package testcases - -// E2E-CLI-069 - KICS scan and ignore experimental queries -// should perform the scan successfully and return exit code 40 - -func init() { //nolint - samplePath := "/path/test/fixtures/experimental_test/sample" - queriesPath := "/path/test/fixtures/experimental_test/queries" - - paths := []string{samplePath, queriesPath} - - testSample := TestCase{ - Name: "should perform a valid scan and ignore the experimental queries [E2E-CLI-069]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", "--output-name", "E2E_CLI_069_RESULT", - "-p", "\"" + paths[0] + "\"", "-q", "\"" + paths[1] + "\"", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_069_RESULT", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{40}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-070_not_ignore_experimental_query.go b/e2e/testcases/e2e-cli-070_not_ignore_experimental_query.go deleted file mode 100644 index bfe90c4c7ba..00000000000 --- a/e2e/testcases/e2e-cli-070_not_ignore_experimental_query.go +++ /dev/null @@ -1,31 +0,0 @@ -package testcases - -// E2E-CLI-070 - KICS scan and not ignore experimental queries -// should perform the scan successfully and return exit code 40 and 50 -func init() { //nolint - samplePath := "/path/test/fixtures/experimental_test/sample" - queriesPath := "/path/test/fixtures/experimental_test/queries" - - paths := []string{samplePath, queriesPath} - - testSample := TestCase{ - Name: "should perform a valid scan and not ignore the experimental queries [E2E-CLI-070]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", "--output-name", "E2E_CLI_070_RESULT", - "-p", "\"" + paths[0] + "\"", "-q", "\"" + paths[1] + "\"", - "--experimental-queries", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_070_RESULT", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-071_no_flag_resolve_references.go b/e2e/testcases/e2e-cli-071_no_flag_resolve_references.go deleted file mode 100644 index c0de9e72766..00000000000 --- a/e2e/testcases/e2e-cli-071_no_flag_resolve_references.go +++ /dev/null @@ -1,27 +0,0 @@ -package testcases - -// E2E-CLI-071 - KICS scan and ignore references -// should perform the scan successfully and return exit code 20 -func init() { //nolint - testSample := TestCase{ - Name: "should perform a valid scan and not resolve references [E2E-CLI-071]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_071_RESULT", - "-p", "\"/path/test/fixtures/resolve_references\"", - "-i", "6c35d2c6-09f2-4e5c-a094-e0e91327071d,962fa01e-b791-4dcc-b04a-4a3e7389be5e", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_071_RESULT", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{20}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-071_tf_eval_func_unknown_type.go b/e2e/testcases/e2e-cli-071_tf_eval_func_unknown_type.go deleted file mode 100644 index 2a68c32d74e..00000000000 --- a/e2e/testcases/e2e-cli-071_tf_eval_func_unknown_type.go +++ /dev/null @@ -1,22 +0,0 @@ -// Package testcases provides end-to-end (E2E) testing functionality for the application. -package testcases - -// E2E-CLI-071 - KICS scan while evaluating the terraform functions with unknown type -// should perform the scan successfully and return exit code 40 -func init() { //nolint - testSample := TestCase{ - Name: "should perform a valid scan while evaluating the terraform functions with unknown type [E2E-CLI-071]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-p", "\"/path/e2e/fixtures/samples/tf-eval-func-unknown-type/main.tf\"", - "--silent", "--payload-path", "/path/e2e/output/E2E_CLI_071_PAYLOAD.json"}, - }, - ExpectedPayload: []string{ - "E2E_CLI_071_PAYLOAD.json", - }, - }, - WantStatus: []int{40}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-072_flag_resolve_references.go b/e2e/testcases/e2e-cli-072_flag_resolve_references.go deleted file mode 100644 index be9ace47de8..00000000000 --- a/e2e/testcases/e2e-cli-072_flag_resolve_references.go +++ /dev/null @@ -1,28 +0,0 @@ -package testcases - -// E2E-CLI-072 - KICS scan and ignore references -// should perform the scan successfully and return exit code 40,20 -func init() { //nolint - testSample := TestCase{ - Name: "should perform a valid scan and resolve references [E2E-CLI-072]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_072_RESULT", - "-p", "\"/path/test/fixtures/resolve_references\"", - "-i", "6c35d2c6-09f2-4e5c-a094-e0e91327071d,962fa01e-b791-4dcc-b04a-4a3e7389be5e", - "--enable-openapi-refs", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_072_RESULT", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{30}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-073_json_no_flag_resolve_references.go b/e2e/testcases/e2e-cli-073_json_no_flag_resolve_references.go deleted file mode 100644 index e27f8b74745..00000000000 --- a/e2e/testcases/e2e-cli-073_json_no_flag_resolve_references.go +++ /dev/null @@ -1,28 +0,0 @@ -package testcases - -// E2E-CLI-073 - KICS scan and ignore references -// should perform the scan successfully and return exit code 0 -// no results expected -func init() { //nolint - testSample := TestCase{ - Name: "should perform a valid scan and not resolve references [E2E-CLI-073]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_073_RESULT", - "-p", "\"/path/test/fixtures/resolve_references_json\"", - "-i", "750b40be-4bac-4f59-bdc4-1ca0e6c3450e", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_073_RESULT", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{0}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-074_json_flag_resolve_references.go b/e2e/testcases/e2e-cli-074_json_flag_resolve_references.go deleted file mode 100644 index 90a5388c959..00000000000 --- a/e2e/testcases/e2e-cli-074_json_flag_resolve_references.go +++ /dev/null @@ -1,28 +0,0 @@ -package testcases - -// E2E-CLI-074 - KICS scan and ignore references -// should perform the scan successfully and return exit code 20 -func init() { //nolint - testSample := TestCase{ - Name: "should perform a valid scan and resolve references [E2E-CLI-074]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_074_RESULT", - "-p", "\"/path/test/fixtures/resolve_references_json\"", - "-i", "750b40be-4bac-4f59-bdc4-1ca0e6c3450e", - "--enable-openapi-refs", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_074_RESULT", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{20}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-075_ansible_host_detected.go b/e2e/testcases/e2e-cli-075_ansible_host_detected.go deleted file mode 100644 index 241bf3a7d21..00000000000 --- a/e2e/testcases/e2e-cli-075_ansible_host_detected.go +++ /dev/null @@ -1,27 +0,0 @@ -package testcases - -// E2E-CLI-075 - KICS scan -// should perform the scan successfully detect ansible and return result 40 -func init() { //nolint - testSample := TestCase{ - Name: "should perform a valid scan and and detect ansible [E2E-CLI-075]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_075_RESULT", - "-p", "\"/path/test/fixtures/analyzer_test_ansible_host/e2e\"", - "-i", "1b2bf3ff-31e9-460e-bbfb-45e48f4f20cc", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_075_RESULT", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{40}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-076_max_file_size.go b/e2e/testcases/e2e-cli-076_max_file_size.go deleted file mode 100644 index 380e7fc8743..00000000000 --- a/e2e/testcases/e2e-cli-076_max_file_size.go +++ /dev/null @@ -1,27 +0,0 @@ -package testcases - -// E2E-CLI-076 - KICS scan -// should perform a scan without detecting anything since no files are scanned because of max file size -func init() { //nolint - testSample := TestCase{ - Name: "should perform a scan without detecting anything since no files are scanned because of max file size [E2E-CLI-076]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_076_RESULT", - "-p", "\"/path/test/fixtures/max_file_size\"", - "--max-file-size", "3", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_076_RESULT", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{00}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-077_fix_similarity_id.go b/e2e/testcases/e2e-cli-077_fix_similarity_id.go deleted file mode 100644 index a7b52ab78c4..00000000000 --- a/e2e/testcases/e2e-cli-077_fix_similarity_id.go +++ /dev/null @@ -1,27 +0,0 @@ -package testcases - -// E2E-CLI-077 - KICS scan -// should perform a scan, present two results, without the same similarity id -func init() { //nolint - testSample := TestCase{ - Name: "should perform a scan, present two results, without the same similarity id [E2E-CLI-077]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_077_RESULT", - "-p", "\"/path/test/fixtures/similarity_id\"", - "-i", "488847ff-6031-487c-bf42-98fd6ac5c9a0", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_077_RESULT", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{40}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-078_similarity_id_minified_files.go b/e2e/testcases/e2e-cli-078_similarity_id_minified_files.go deleted file mode 100644 index 829ad77767c..00000000000 --- a/e2e/testcases/e2e-cli-078_similarity_id_minified_files.go +++ /dev/null @@ -1,27 +0,0 @@ -package testcases - -// E2E-CLI-078 - KICS scan -// should perform a scan and return three different similarity ids on the results -func init() { //nolint - testSample := TestCase{ - Name: "should perform a scan and return three different similarity ids on the results [E2E-CLI-078]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_078_RESULT", - "-p", "\"/path/test/fixtures/minified_files_similarity_id\"", - "-i", "00b78adf-b83f-419c-8ed8-c6018441dd3a", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_078_RESULT", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{40}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-079_cwe_sarif_result.go b/e2e/testcases/e2e-cli-079_cwe_sarif_result.go deleted file mode 100644 index 14bd3eb0c6f..00000000000 --- a/e2e/testcases/e2e-cli-079_cwe_sarif_result.go +++ /dev/null @@ -1,28 +0,0 @@ -package testcases - -// E2E-CLI-079 - KICS scan -// should perform a scan saving the reports in sarif format, showing the cwe on results -func init() { //nolint - testSample := TestCase{ - Name: "should perform a scan saving the reports in sarif format, showing the cwe on results [E2E-CLI-079]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_079_RESULT", - "-p", "\"/path/test/fixtures/test_sarif_cwe_report/run_block_injection/test\"", - "-q", "\"/path/test/fixtures/test_sarif_cwe_report/run_block_injection/query\"", - "--report-formats", "sarif", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_079_RESULT", - ResultsFormats: []string{"sarif"}, - }, - }, - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-080_cwe_sarif_result.go b/e2e/testcases/e2e-cli-080_cwe_sarif_result.go deleted file mode 100644 index abe3472d8a0..00000000000 --- a/e2e/testcases/e2e-cli-080_cwe_sarif_result.go +++ /dev/null @@ -1,28 +0,0 @@ -package testcases - -// E2E-CLI-080 - KICS scan -// should perform a scan saving the reports in sarif format, showing no cwe field on results -func init() { //nolint - testSample := TestCase{ - Name: "should perform a scan saving the reports in sarif format, showing no cwe field on results [E2E-CLI-080]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_080_RESULT", - "-p", "\"/path/test/fixtures/test_sarif_cwe_report/script_block_injection/test\"", - "-q", "\"/path/test/fixtures/test_sarif_cwe_report/script_block_injection/query\"", - "--report-formats", "sarif", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_080_RESULT", - ResultsFormats: []string{"sarif"}, - }, - }, - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-081_output_path_valid.go b/e2e/testcases/e2e-cli-081_output_path_valid.go deleted file mode 100644 index 2e8e6576634..00000000000 --- a/e2e/testcases/e2e-cli-081_output_path_valid.go +++ /dev/null @@ -1,26 +0,0 @@ -package testcases - -// E2E-CLI-081 - KICS scan -// should check if output path is valid -func init() { //nolint - testSample := TestCase{ - Name: "should check if output path is valid [E2E-CLI-081]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_081_RESULT", - "-p", "\"/path/test/fixtures/test_output_path\"", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_081_RESULT", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{40}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-082_output_path_invalid.go b/e2e/testcases/e2e-cli-082_output_path_invalid.go deleted file mode 100644 index b68ef31b3d9..00000000000 --- a/e2e/testcases/e2e-cli-082_output_path_invalid.go +++ /dev/null @@ -1,23 +0,0 @@ -package testcases - -// E2E-CLI-082 - KICS scan -// should check if output path is invalid -func init() { //nolint - testSample := TestCase{ - Name: "should check if output path is invalid [E2E-CLI-082]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output?", - "--output-name", "E2E_CLI_082_RESULT", - "-p", "\"/path/test/fixtures/test_output_path\"", - }, - }, - ExpectedOut: []string{ - "E2E_CLI_082_RESULT", - }, - }, - WantStatus: []int{126}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-083_helm_ignore.go b/e2e/testcases/e2e-cli-083_helm_ignore.go deleted file mode 100644 index 450b9439d62..00000000000 --- a/e2e/testcases/e2e-cli-083_helm_ignore.go +++ /dev/null @@ -1,27 +0,0 @@ -package testcases - -// E2E-CLI-083 - KICS scan -// should perform a scan and return zero results ignoring the file -func init() { //nolint - testSample := TestCase{ - Name: "should perform a scan and return zero results ignoring the file [E2E-CLI-083]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_083_RESULT", - "-p", "\"/path/test/fixtures/helm_ignore\"", - "-i", "b7652612-de4e-4466-a0bf-1cd81f0c6063", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_083_RESULT", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{0}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-084_helm_ignore_block.go b/e2e/testcases/e2e-cli-084_helm_ignore_block.go deleted file mode 100644 index 9511bd14da4..00000000000 --- a/e2e/testcases/e2e-cli-084_helm_ignore_block.go +++ /dev/null @@ -1,27 +0,0 @@ -package testcases - -// E2E-CLI-084 - KICS scan -// should perform a scan and return zero results ignoring the block -func init() { //nolint - testSample := TestCase{ - Name: "should perform a scan and return zero results ignoring the block [E2E-CLI-084]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_084_RESULT", - "-p", "\"/path/test/fixtures/helm_ignore_block\"", - "-i", "b7652612-de4e-4466-a0bf-1cd81f0c6063", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_084_RESULT", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{0}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-085_helm_disable_query.go b/e2e/testcases/e2e-cli-085_helm_disable_query.go deleted file mode 100644 index d120a35eeb8..00000000000 --- a/e2e/testcases/e2e-cli-085_helm_disable_query.go +++ /dev/null @@ -1,27 +0,0 @@ -package testcases - -// E2E-CLI-085 - KICS scan -// should perform a scan and return zero results ignoring the query -func init() { //nolint - testSample := TestCase{ - Name: "should perform a scan and return zero results ignoring the query [E2E-CLI-085]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_085_RESULT", - "-p", "\"/path/test/fixtures/helm_disable_query\"", - "-i", "b7652612-de4e-4466-a0bf-1cd81f0c6063", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_085_RESULT", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{0}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-086_parallel_scan_default.go b/e2e/testcases/e2e-cli-086_parallel_scan_default.go deleted file mode 100644 index f37dd8fd9b1..00000000000 --- a/e2e/testcases/e2e-cli-086_parallel_scan_default.go +++ /dev/null @@ -1,27 +0,0 @@ -package testcases - -// E2E-CLI-086 - KICS scan -// should perform a scan, finishing successfully and return exit code 0 -func init() { //nolint - testSample := TestCase{ - Name: "should perform a scan and finish successfully [E2E-CLI-086]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_086_RESULT", - "-p", "\"/path/e2e/fixtures/samples/terraform.tf\"", - "--parallel", "0", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_086_RESULT", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-087_parallel_scan_sequential.go b/e2e/testcases/e2e-cli-087_parallel_scan_sequential.go deleted file mode 100644 index 45d569e045b..00000000000 --- a/e2e/testcases/e2e-cli-087_parallel_scan_sequential.go +++ /dev/null @@ -1,27 +0,0 @@ -package testcases - -// E2E-CLI-087 - KICS scan -// should perform a scan, finishing successfully and return exit code 0 -func init() { //nolint - testSample := TestCase{ - Name: "should perform a scan and finish successfully [E2E-CLI-087]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_087_RESULT", - "-p", "\"/path/e2e/fixtures/samples/terraform.tf\"", - "--parallel", "1", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_087_RESULT", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-088_parallel_scan_6_workers.go b/e2e/testcases/e2e-cli-088_parallel_scan_6_workers.go deleted file mode 100644 index 7d05e3d17d7..00000000000 --- a/e2e/testcases/e2e-cli-088_parallel_scan_6_workers.go +++ /dev/null @@ -1,27 +0,0 @@ -package testcases - -// E2E-CLI-088 - KICS scan -// should perform a scan, finishing successfully and return exit code 0 -func init() { //nolint - testSample := TestCase{ - Name: "should perform a scan and finish successfully [E2E-CLI-088]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_088_RESULT", - "-p", "\"/path/e2e/fixtures/samples/terraform.tf\"", - "--parallel", "6", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_088_RESULT", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-089_critical_severity.go b/e2e/testcases/e2e-cli-089_critical_severity.go deleted file mode 100644 index ea7d280e77b..00000000000 --- a/e2e/testcases/e2e-cli-089_critical_severity.go +++ /dev/null @@ -1,26 +0,0 @@ -package testcases - -// E2E-CLI-089 - KICS scan -// should perform a scan successfully giving results with critical severity and return exit code 60 -func init() { //nolint - testSample := TestCase{ - Name: "should perform a scan successfully giving results with critical severity and return exit code 60 [E2E-CLI-089]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_089_RESULT", - "-p", "\"/path/test/fixtures/test_critical_severity/run_block_injection/test\"", - "-q", "\"/path/test/fixtures/test_critical_severity/run_block_injection/query\"", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_089_RESULT", - }, - }, - }, - WantStatus: []int{60}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-090_critical_severity_all_report_formats.go b/e2e/testcases/e2e-cli-090_critical_severity_all_report_formats.go deleted file mode 100644 index d3fb8fc0c2a..00000000000 --- a/e2e/testcases/e2e-cli-090_critical_severity_all_report_formats.go +++ /dev/null @@ -1,28 +0,0 @@ -package testcases - -// E2E-CLI-090 - Kics scan command with --report-formats and --output-path flags -// should export the results based on the formats provided by this flag, with critical severity -func init() { //nolint - testSample := TestCase{ - Name: "should export the results based on the formats provided by this flag, with critical severity [E2E-CLI-090]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_090_RESULT", - "--report-formats", "asff,codeclimate,csv,cyclonedx,glsast,html,json,junit,pdf,sarif,sonarqube", - "-p", "\"/path/test/fixtures/test_critical_custom_queries/amazon_mq_broker_encryption_disabled/test\"", - "-q", "\"/path/test/fixtures/test_critical_custom_queries/amazon_mq_broker_encryption_disabled/query\"", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_090_RESULT", - ResultsFormats: []string{"asff", "codeclimate", "csv", "cyclonedx", "glsast", "html", "json", "junit", "pdf", "sarif", "sonarqube"}, - }, - }, - }, - WantStatus: []int{60}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-091_bicep_scan_output_payload.go b/e2e/testcases/e2e-cli-091_bicep_scan_output_payload.go deleted file mode 100644 index ff1e341ee77..00000000000 --- a/e2e/testcases/e2e-cli-091_bicep_scan_output_payload.go +++ /dev/null @@ -1,31 +0,0 @@ -package testcases - -// E2E-CLI-091 - Kics scan command with -o and -d flags on bicep files -// should perform the scan successfully, evaluating the result and payload files -func init() { //nolint - testSample := TestCase{ - Name: "should perform a scan on bicep files and create a result and payload file [E2E-CLI-091]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_091_RESULT", - "-p", "\"/path/test/fixtures/bicep_test/test\"", - "-d", "/path/e2e/output/E2E_CLI_091_PAYLOAD.json", - "--disable-secrets", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_091_RESULT", - ResultsFormats: []string{"json"}, - }, - }, - ExpectedPayload: []string{ - "E2E_CLI_091_PAYLOAD.json", - }, - }, - WantStatus: []int{20}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-092_gitignore_not_exclude_project.go b/e2e/testcases/e2e-cli-092_gitignore_not_exclude_project.go deleted file mode 100644 index 58e826cec4c..00000000000 --- a/e2e/testcases/e2e-cli-092_gitignore_not_exclude_project.go +++ /dev/null @@ -1,26 +0,0 @@ -package testcases - -// E2E-CLI-092 - KICS scan -// should perform a scan and not ignore the entire project -func init() { //nolint - testSample := TestCase{ - Name: "should perform a scan and not ignore the entire project [E2E-CLI-092]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_092_RESULT", - "-p", "\"/path/e2e/fixtures/samples/tmp-gitignore/project\"", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_092_RESULT", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{50}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-093_old_severity_metadata_field.go b/e2e/testcases/e2e-cli-093_old_severity_metadata_field.go deleted file mode 100644 index 8979b5e620a..00000000000 --- a/e2e/testcases/e2e-cli-093_old_severity_metadata_field.go +++ /dev/null @@ -1,110 +0,0 @@ -package testcases - -var stringToTest = "should perform a scans successfully giving results with old severity and return exit code " - -// E2E-CLI-093 - KICS scan with old severity metadata field -// should perform a scan successfully giving results with old severity metadata field and return exit code according to the severity -func init() { //nolint - testSample01 := TestCase{ - Name: stringToTest + - "according to old severity [E2E-CLI-093_1]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_093_RESULT", - "-p", "\"/path/test/fixtures/test_old_severity/test\"", - "-q", "\"/path/test/fixtures/test_old_severity/info\"", - "--old-severities", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_093_RESULT", - }, - }, - }, - WantStatus: []int{20}, - } - testSample02 := TestCase{ - Name: stringToTest + - "according to old severity [E2E-CLI-093_2]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_093_RESULT_2", - "-p", "\"/path/test/fixtures/test_old_severity/test\"", - "-q", "\"/path/test/fixtures/test_old_severity/low\"", - "--old-severities", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_093_RESULT_2", - }, - }, - }, - WantStatus: []int{30, 40, 50, 60}, - } - testSample03 := TestCase{ - Name: stringToTest + - "according to old severity [E2E-CLI-093_3]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_093_RESULT_3", - "-p", "\"/path/test/fixtures/test_old_severity/test\"", - "-q", "\"/path/test/fixtures/test_old_severity/medium\"", - "--old-severities", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_093_RESULT_3", - }, - }, - }, - WantStatus: []int{40}, - } - testSample04 := TestCase{ - Name: stringToTest + - "according to old severity [E2E-CLI-093_4]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_093_RESULT_4", - "-p", "\"/path/test/fixtures/test_old_severity/test\"", - "-q", "\"/path/test/fixtures/test_old_severity/high\"", - "--old-severities", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_093_RESULT_4", - }, - }, - }, - WantStatus: []int{50}, - } - testSample05 := TestCase{ - Name: stringToTest + - "according to old severity [E2E-CLI-093_5]", - Args: args{ - Args: []cmdArgs{ - - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_093_RESULT_5", - "-p", "\"/path/test/fixtures/test_old_severity/test\"", - "-q", "\"/path/test/fixtures/test_old_severity/critical\"", - "--old-severities", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_093_RESULT_5", - }, - }, - }, - WantStatus: []int{60}, - } - Tests = append(Tests, testSample01, testSample02, testSample03, testSample04, testSample05) -} diff --git a/e2e/testcases/e2e-cli-094_max_resolver_depth_0.go b/e2e/testcases/e2e-cli-094_max_resolver_depth_0.go deleted file mode 100644 index 88ef2af39cb..00000000000 --- a/e2e/testcases/e2e-cli-094_max_resolver_depth_0.go +++ /dev/null @@ -1,30 +0,0 @@ -package testcases - -// E2E-CLI-094 - KICS scan and ignore references -// should perform the scan successfully and return exit code 20 -// this test is similar to E2E-CLI-071. Since the '--max-resolver-path' parameter is set to 0, it will not resolve any files -func init() { //nolint - testSample := TestCase{ - Name: "should perform a valid scan and not resolve references [E2E-CLI-094]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_094_RESULT", - "-p", "\"/path/test/fixtures/resolve_references\"", - "-i", "6c35d2c6-09f2-4e5c-a094-e0e91327071d,962fa01e-b791-4dcc-b04a-4a3e7389be5e", - "--enable-openapi-refs", - "--max-resolver-depth", "0", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_094_RESULT", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{20}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-095_max_resolver_depth_default.go b/e2e/testcases/e2e-cli-095_max_resolver_depth_default.go deleted file mode 100644 index 80a9686858c..00000000000 --- a/e2e/testcases/e2e-cli-095_max_resolver_depth_default.go +++ /dev/null @@ -1,29 +0,0 @@ -package testcases - -// E2E-CLI-095 - KICS scan and ignore references -// should perform the scan successfully and return exit code 0 -// this test sample contains a circular loop. It will stop after 15 iterations, having parsed 6887 lines -func init() { //nolint - testSample := TestCase{ - Name: "should perform a valid scan and resolve references [E2E-CLI-095]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_095_RESULT", - "-p", "\"/path/test/fixtures/resolve_circular_loop\"", - "-i", "a88baa34-e2ad-44ea-ad6f-8cac87bc7c71", - "--max-resolver-depth", "15", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_095_RESULT", - ResultsFormats: []string{"json"}, - }, - }, - }, - WantStatus: []int{0}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-096_new_similarity_id_with_old_similarity_id.go b/e2e/testcases/e2e-cli-096_new_similarity_id_with_old_similarity_id.go deleted file mode 100644 index 9c57f943b36..00000000000 --- a/e2e/testcases/e2e-cli-096_new_similarity_id_with_old_similarity_id.go +++ /dev/null @@ -1,27 +0,0 @@ -package testcases - -// E2E-CLI-096 - KICS scan -// should perform a scan successfully giving results with similarity ids unique and the old similarity id -func init() { //nolint - testSample := TestCase{ - Name: "should perform a scan successfully giving results with similarity ids unique, showing the old similarity id [E2E-CLI-096]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_096_RESULT", - "-p", "\"/path/test/fixtures/new_similarity_id\"", - "-i", "bb9ac4f7-e13b-423d-a010-c74a1bfbe492", - "--kics_compute_new_simid", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_096_RESULT", - }, - }, - }, - WantStatus: []int{40}, - } - - Tests = append(Tests, testSample) -} diff --git a/e2e/testcases/e2e-cli-097_new_similarity_id_without_old_similarity_id.go b/e2e/testcases/e2e-cli-097_new_similarity_id_without_old_similarity_id.go deleted file mode 100644 index 56db7569290..00000000000 --- a/e2e/testcases/e2e-cli-097_new_similarity_id_without_old_similarity_id.go +++ /dev/null @@ -1,26 +0,0 @@ -package testcases - -// E2E-CLI-097 - KICS scan -// should perform a scan successfully giving results with similarity ids unique without showing the old similarity id -func init() { //nolint - testSample := TestCase{ - Name: "should perform a scan successfully giving results with similarity ids unique without showing the old similarity id [E2E-CLI-097]", - Args: args{ - Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", - "--output-name", "E2E_CLI_097_RESULT", - "-p", "\"/path/test/fixtures/new_similarity_id\"", - "-i", "bb9ac4f7-e13b-423d-a010-c74a1bfbe492", - }, - }, - ExpectedResult: []ResultsValidation{ - { - ResultsFile: "E2E_CLI_097_RESULT", - }, - }, - }, - WantStatus: []int{40}, - } - - Tests = append(Tests, testSample) -}