diff --git a/.github/workflows/go-ci-integration.yml b/.github/workflows/go-ci-integration.yml
index ee809f7a46f..59ca1cb54bc 100644
--- a/.github/workflows/go-ci-integration.yml
+++ b/.github/workflows/go-ci-integration.yml
@@ -58,7 +58,6 @@ jobs:
docker run --user $(id -u):$(id -g) -v ${PWD}/assets/queries:/path \
kics:${{ github.sha }} scan \
--silent \
- --disable-full-descriptions \
--ignore-on-exit "results" \
--log-level DEBUG \
--log-path "/path/info.log" \
diff --git a/docs/commands.md b/docs/commands.md
index 7500814a3ec..84fdaa08512 100644
--- a/docs/commands.md
+++ b/docs/commands.md
@@ -40,8 +40,7 @@ Use "kics [command] --help" for more information about a command.
|-m, --bom | include bill of materials (BoM) in results output |
| --cloud-provider strings | list of cloud providers to scan (alicloud,aws,azure,gcp,nifcloud,tencentcloud) |
| --config string | path to configuration file |
-| --old-severities | uses old severities in query results |
-| --disable-full-descriptions | disable request for full descriptions and use default vulnerability descriptions |
+| --old-severities | uses old severities in query results |
| --disable-secrets | disable secrets scanning |
| --enable-openapi-refs | resolve the file reference, on OpenAPI files (default [false]) |
| --exclude-categories strings | exclude categories by providing its name
cannot be provided with query inclusion flags
can be provided multiple times or as a comma separated string
example: 'Access control,Best practices' |
diff --git a/docs/dockerhub.md b/docs/dockerhub.md
index a040c5fc5e8..848d535ee83 100644
--- a/docs/dockerhub.md
+++ b/docs/dockerhub.md
@@ -110,7 +110,6 @@ Flags:
--cloud-provider strings list of cloud providers to scan (alicloud,aws,azure,gcp,nifcloud,tencentcloud)
--config string path to configuration file
--old-severities use old severities in query results (excludes critical severity)
- --disable-full-descriptions disable request for full descriptions and use default vulnerability descriptions
--disable-secrets disable secrets scanning
--enable-openapi-refs resolve the file reference, on OpenAPI files (default [false])
--exclude-categories strings exclude categories by providing its name
diff --git a/docs/flags.md b/docs/flags.md
index 81e4d81c84b..b72a20aac4e 100644
--- a/docs/flags.md
+++ b/docs/flags.md
@@ -41,11 +41,11 @@ Example of a valid `flags.json` file:
To mark a flag as hidden use the following configuration:
```json
{
- "disable-full-descriptions": {
+ "log-file": {
"flagType": "bool",
- "shorthandFlag": "",
+ "shorthandFlag": "l",
"defaultValue": "false",
- "usage": "disable request for full descriptions and use default vulnerability descriptions",
+ "usage": "writes log messages to log file",
"hidden": true
}
}
@@ -55,14 +55,14 @@ If you also want to display a flag deprecation warning you can define it like th
```json
{
- "disable-full-descriptions": {
+ "log-file": {
"flagType": "bool",
- "shorthandFlag": "",
+ "shorthandFlag": "l",
"defaultValue": "false",
- "usage": "disable request for full descriptions and use default vulnerability descriptions",
+ "usage": "writes log messages to log file",
"hidden": true,
"deprecated": true,
- "deprecatedInfo": "use --disable-full-descriptions instead"
+ "deprecatedInfo": "please use --log-path instead"
}
}
```
diff --git a/e2e/README.md b/e2e/README.md
index 38f033674a7..35ec88a6e04 100644
--- a/e2e/README.md
+++ b/e2e/README.md
@@ -21,7 +21,7 @@ npm start
- **Running E2E Tests from binary (faster) (used in dev/local):**
-_Note: for Windows only the test "092" must fail and, for Linux, only the test "052" should fail._
+_Note: for Windows only the test "092" must fail and, for Linux, only the test "051" should fail._
Prepare
```bash
@@ -42,7 +42,7 @@ go test "github.com/Checkmarx/kics/v2/e2e" -v -count=1 -tags dev
- **Running E2E Tests from docker (slower) (used in CI):**
-_Note: when running the tests from docker, only the tests "031" and "052" should fail_.
+_Note: when running the tests from docker, only the tests "031" and "051" should fail_.
Prepare
```bash
diff --git a/e2e/fixtures/E2E_CLI_047_PAYLOAD.json b/e2e/fixtures/E2E_CLI_046_PAYLOAD.json
similarity index 100%
rename from e2e/fixtures/E2E_CLI_047_PAYLOAD.json
rename to e2e/fixtures/E2E_CLI_046_PAYLOAD.json
diff --git a/e2e/fixtures/E2E_CLI_058 b/e2e/fixtures/E2E_CLI_058
new file mode 100644
index 00000000000..eacc766dfd3
--- /dev/null
+++ b/e2e/fixtures/E2E_CLI_058
@@ -0,0 +1,3 @@
+Auto remediates the project
+
+{{.RemediateHelp}}
\ No newline at end of file
diff --git a/e2e/fixtures/E2E_CLI_059 b/e2e/fixtures/E2E_CLI_059
index eacc766dfd3..42cda0099ee 100644
--- a/e2e/fixtures/E2E_CLI_059
+++ b/e2e/fixtures/E2E_CLI_059
@@ -1,3 +1,2 @@
-Auto remediates the project
-
-{{.RemediateHelp}}
\ No newline at end of file
+Error: required flag(s) "results" not set
+{{.RemediateHelp}}
diff --git a/e2e/fixtures/E2E_CLI_060 b/e2e/fixtures/E2E_CLI_060
deleted file mode 100644
index 42cda0099ee..00000000000
--- a/e2e/fixtures/E2E_CLI_060
+++ /dev/null
@@ -1,2 +0,0 @@
-Error: required flag(s) "results" not set
-{{.RemediateHelp}}
diff --git a/e2e/fixtures/E2E_CLI_060_PAYLOAD.json b/e2e/fixtures/E2E_CLI_060_PAYLOAD.json
new file mode 100644
index 00000000000..cd7d337a09a
--- /dev/null
+++ b/e2e/fixtures/E2E_CLI_060_PAYLOAD.json
@@ -0,0 +1,163 @@
+{
+ "document": [
+ {
+ "id": "0",
+ "file": "file",
+ "args": [],
+ "command": {
+ "alpine:3.5": [
+ {
+ "Cmd": "from",
+ "EndLine": 1,
+ "Flags": [],
+ "JSON": false,
+ "Original": "FROM alpine:3.5",
+ "SubCmd": "",
+ "Value": [
+ "alpine:3.5"
+ ],
+ "_kics_line": 1
+ },
+ {
+ "Cmd": "run",
+ "EndLine": 2,
+ "Flags": [],
+ "JSON": false,
+ "Original": "RUN apk add --update py2-pip",
+ "SubCmd": "",
+ "Value": [
+ "apk add --update py2-pip"
+ ],
+ "_kics_line": 2
+ },
+ {
+ "Cmd": "run",
+ "EndLine": 3,
+ "Flags": [],
+ "JSON": false,
+ "Original": "RUN gem install bundler",
+ "SubCmd": "",
+ "Value": [
+ "gem install bundler"
+ ],
+ "_kics_line": 3
+ },
+ {
+ "Cmd": "run",
+ "EndLine": 4,
+ "Flags": [],
+ "JSON": true,
+ "Original": "RUN [\"gem\", \"install\", \"blunder\"]",
+ "SubCmd": "",
+ "Value": [
+ "gem",
+ "install",
+ "blunder"
+ ],
+ "_kics_line": 4
+ },
+ {
+ "Cmd": "run",
+ "EndLine": 5,
+ "Flags": [],
+ "JSON": false,
+ "Original": "RUN gem install grpc -v ${GRPC_RUBY_VERSION} blunder",
+ "SubCmd": "",
+ "Value": [
+ "gem install grpc -v ${GRPC_RUBY_VERSION} blunder"
+ ],
+ "_kics_line": 5
+ },
+ {
+ "Cmd": "run",
+ "EndLine": 6,
+ "Flags": [],
+ "JSON": false,
+ "Original": "RUN bundle install",
+ "SubCmd": "",
+ "Value": [
+ "bundle install"
+ ],
+ "_kics_line": 6
+ },
+ {
+ "Cmd": "copy",
+ "EndLine": 7,
+ "Flags": [],
+ "JSON": false,
+ "Original": "COPY requirements.txt /usr/src/app/",
+ "SubCmd": "",
+ "Value": [
+ "requirements.txt",
+ "/usr/src/app/"
+ ],
+ "_kics_line": 7
+ },
+ {
+ "Cmd": "run",
+ "EndLine": 8,
+ "Flags": [],
+ "JSON": false,
+ "Original": "RUN pip install --no-cache-dir -r /usr/src/app/requirements.txt",
+ "SubCmd": "",
+ "Value": [
+ "pip install --no-cache-dir -r /usr/src/app/requirements.txt"
+ ],
+ "_kics_line": 8
+ },
+ {
+ "Cmd": "copy",
+ "EndLine": 9,
+ "Flags": [],
+ "JSON": false,
+ "Original": "COPY app.py /usr/src/app/",
+ "SubCmd": "",
+ "Value": [
+ "app.py",
+ "/usr/src/app/"
+ ],
+ "_kics_line": 9
+ },
+ {
+ "Cmd": "copy",
+ "EndLine": 10,
+ "Flags": [],
+ "JSON": false,
+ "Original": "COPY templates/index.html /usr/src/app/templates/",
+ "SubCmd": "",
+ "Value": [
+ "templates/index.html",
+ "/usr/src/app/templates/"
+ ],
+ "_kics_line": 10
+ },
+ {
+ "Cmd": "expose",
+ "EndLine": 11,
+ "Flags": [],
+ "JSON": false,
+ "Original": "EXPOSE 5000",
+ "SubCmd": "",
+ "Value": [
+ "5000"
+ ],
+ "_kics_line": 11
+ },
+ {
+ "Cmd": "cmd",
+ "EndLine": 12,
+ "Flags": [],
+ "JSON": true,
+ "Original": "CMD [\"python\", \"/usr/src/app/app.py\"]",
+ "SubCmd": "",
+ "Value": [
+ "python",
+ "/usr/src/app/app.py"
+ ],
+ "_kics_line": 12
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/e2e/fixtures/E2E_CLI_061_PAYLOAD.json b/e2e/fixtures/E2E_CLI_061_PAYLOAD.json
index cd7d337a09a..a18f6cab76c 100755
--- a/e2e/fixtures/E2E_CLI_061_PAYLOAD.json
+++ b/e2e/fixtures/E2E_CLI_061_PAYLOAD.json
@@ -1,163 +1,17 @@
{
"document": [
{
- "id": "0",
- "file": "file",
- "args": [],
- "command": {
- "alpine:3.5": [
- {
- "Cmd": "from",
- "EndLine": 1,
- "Flags": [],
- "JSON": false,
- "Original": "FROM alpine:3.5",
- "SubCmd": "",
- "Value": [
- "alpine:3.5"
- ],
- "_kics_line": 1
- },
- {
- "Cmd": "run",
- "EndLine": 2,
- "Flags": [],
- "JSON": false,
- "Original": "RUN apk add --update py2-pip",
- "SubCmd": "",
- "Value": [
- "apk add --update py2-pip"
- ],
- "_kics_line": 2
- },
- {
- "Cmd": "run",
- "EndLine": 3,
- "Flags": [],
- "JSON": false,
- "Original": "RUN gem install bundler",
- "SubCmd": "",
- "Value": [
- "gem install bundler"
- ],
- "_kics_line": 3
- },
- {
- "Cmd": "run",
- "EndLine": 4,
- "Flags": [],
- "JSON": true,
- "Original": "RUN [\"gem\", \"install\", \"blunder\"]",
- "SubCmd": "",
- "Value": [
- "gem",
- "install",
- "blunder"
- ],
- "_kics_line": 4
- },
- {
- "Cmd": "run",
- "EndLine": 5,
- "Flags": [],
- "JSON": false,
- "Original": "RUN gem install grpc -v ${GRPC_RUBY_VERSION} blunder",
- "SubCmd": "",
- "Value": [
- "gem install grpc -v ${GRPC_RUBY_VERSION} blunder"
- ],
- "_kics_line": 5
- },
- {
- "Cmd": "run",
- "EndLine": 6,
- "Flags": [],
- "JSON": false,
- "Original": "RUN bundle install",
- "SubCmd": "",
- "Value": [
- "bundle install"
- ],
- "_kics_line": 6
- },
- {
- "Cmd": "copy",
- "EndLine": 7,
- "Flags": [],
- "JSON": false,
- "Original": "COPY requirements.txt /usr/src/app/",
- "SubCmd": "",
- "Value": [
- "requirements.txt",
- "/usr/src/app/"
- ],
- "_kics_line": 7
- },
- {
- "Cmd": "run",
- "EndLine": 8,
- "Flags": [],
- "JSON": false,
- "Original": "RUN pip install --no-cache-dir -r /usr/src/app/requirements.txt",
- "SubCmd": "",
- "Value": [
- "pip install --no-cache-dir -r /usr/src/app/requirements.txt"
- ],
- "_kics_line": 8
- },
- {
- "Cmd": "copy",
- "EndLine": 9,
- "Flags": [],
- "JSON": false,
- "Original": "COPY app.py /usr/src/app/",
- "SubCmd": "",
- "Value": [
- "app.py",
- "/usr/src/app/"
- ],
- "_kics_line": 9
- },
- {
- "Cmd": "copy",
- "EndLine": 10,
- "Flags": [],
- "JSON": false,
- "Original": "COPY templates/index.html /usr/src/app/templates/",
- "SubCmd": "",
- "Value": [
- "templates/index.html",
- "/usr/src/app/templates/"
- ],
- "_kics_line": 10
- },
- {
- "Cmd": "expose",
- "EndLine": 11,
- "Flags": [],
- "JSON": false,
- "Original": "EXPOSE 5000",
- "SubCmd": "",
- "Value": [
- "5000"
- ],
- "_kics_line": 11
- },
- {
- "Cmd": "cmd",
- "EndLine": 12,
- "Flags": [],
- "JSON": true,
- "Original": "CMD [\"python\", \"/usr/src/app/app.py\"]",
- "SubCmd": "",
- "Value": [
- "python",
- "/usr/src/app/app.py"
- ],
- "_kics_line": 12
+ "id": "0",
+ "resource": {
+ "test": {
+ "test1": {
+ "test_map": {
+ "map3Key1": "givenByVar"
+ }
}
- ]
- }
+ }
+ },
+ "file": "file"
}
]
}
diff --git a/e2e/fixtures/E2E_CLI_063_PAYLOAD.json b/e2e/fixtures/E2E_CLI_063_PAYLOAD.json
deleted file mode 100644
index a18f6cab76c..00000000000
--- a/e2e/fixtures/E2E_CLI_063_PAYLOAD.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "document": [
- {
- "id": "0",
- "resource": {
- "test": {
- "test1": {
- "test_map": {
- "map3Key1": "givenByVar"
- }
- }
- }
- },
- "file": "file"
- }
- ]
-}
diff --git a/e2e/fixtures/E2E_CLI_066_ANALYZE_RESULTS.json b/e2e/fixtures/E2E_CLI_065_ANALYZE_RESULTS.json
similarity index 100%
rename from e2e/fixtures/E2E_CLI_066_ANALYZE_RESULTS.json
rename to e2e/fixtures/E2E_CLI_065_ANALYZE_RESULTS.json
diff --git a/e2e/fixtures/E2E_CLI_066_ANALYZE_RESULTS_2.json b/e2e/fixtures/E2E_CLI_065_ANALYZE_RESULTS_2.json
similarity index 100%
rename from e2e/fixtures/E2E_CLI_066_ANALYZE_RESULTS_2.json
rename to e2e/fixtures/E2E_CLI_065_ANALYZE_RESULTS_2.json
diff --git a/e2e/fixtures/E2E_CLI_067_PAYLOAD.json b/e2e/fixtures/E2E_CLI_066_PAYLOAD.json
similarity index 100%
rename from e2e/fixtures/E2E_CLI_067_PAYLOAD.json
rename to e2e/fixtures/E2E_CLI_066_PAYLOAD.json
diff --git a/e2e/fixtures/E2E_CLI_067_RESULT.json b/e2e/fixtures/E2E_CLI_067_RESULT.json
new file mode 100644
index 00000000000..daf2b8d0200
--- /dev/null
+++ b/e2e/fixtures/E2E_CLI_067_RESULT.json
@@ -0,0 +1,109 @@
+{
+ "kics_version": "development",
+ "files_scanned": 1,
+ "lines_scanned": 6,
+ "files_parsed": 1,
+ "lines_parsed": 6,
+ "lines_ignored": 0,
+ "files_failed_to_scan": 0,
+ "queries_total": 48,
+ "queries_failed_to_execute": 1,
+ "queries_failed_to_compute_similarity_id": 0,
+ "scan_id": "console",
+ "severity_counters": {
+ "CRITICAL": 0,
+ "HIGH": 1,
+ "INFO": 0,
+ "LOW": 1,
+ "MEDIUM": 1,
+ "TRACE": 0
+ },
+ "total_counter": 3,
+ "total_bom_resources": 0,
+ "start": "2024-03-27T11:20:29.068037Z",
+ "end": "2024-03-27T11:20:30.0252697Z",
+ "paths": [
+ "/path/test/fixtures/dockerfile/corrupted_dockerfile"
+ ],
+ "queries": [
+ {
+ "query_name": "Missing User Instruction",
+ "query_id": "fd54f200-402c-4333-a5a4-36ef6709af2f",
+ "query_url": "https://docs.docker.com/engine/reference/builder/#user",
+ "severity": "HIGH",
+ "platform": "Dockerfile",
+ "cwe": "250",
+ "riskScore": "7.7",
+ "cloud_provider": "COMMON",
+ "category": "Build Process",
+ "experimental": false,
+ "description": "A user should be specified in the dockerfile, otherwise the image will run as root",
+ "description_id": "eb49caf6",
+ "files": [
+ {
+ "file_name": "/path/test/fixtures/dockerfile/corrupted_dockerfile",
+ "similarity_id": "821b0a105dd9ebb6b14489251615d94813a578feb68624113a52ba9c1668ecb7",
+ "line": 1,
+ "issue_type": "MissingAttribute",
+ "search_key": "FROM={{alpine:latest}}",
+ "search_line": -1,
+ "search_value": "",
+ "expected_value": "The 'Dockerfile' should contain the 'USER' instruction",
+ "actual_value": "The 'Dockerfile' does not contain any 'USER' instruction"
+ }
+ ]
+ },
+ {
+ "query_name": "Image Version Using 'latest'",
+ "query_id": "f45ea400-6bbe-4501-9fc7-1c3d75c32067",
+ "query_url": "https://docs.docker.com/develop/dev-best-practices/",
+ "severity": "MEDIUM",
+ "platform": "Dockerfile",
+ "cwe": "1357",
+ "riskScore": "5.1",
+ "category": "Best Practices",
+ "experimental": false,
+ "description": "When building images, always tag them with useful tags which codify version information, intended destination (prod or test, for instance), stability, or other information that is useful when deploying the application in different environments. Do not rely on the automatically-created latest tag",
+ "description_id": "22f535ec",
+ "files": [
+ {
+ "file_name": "/path/test/fixtures/dockerfile/corrupted_dockerfile",
+ "similarity_id": "a32938ae4d056569e5cfda73594f6cb276d4f9ee14a848fb6b642b14defee892",
+ "line": 1,
+ "issue_type": "IncorrectValue",
+ "search_key": "FROM={{alpine:latest}}",
+ "search_line": -1,
+ "search_value": "",
+ "expected_value": "FROM alpine:latest:'version' where version should not be 'latest'",
+ "actual_value": "FROM alpine:latest'"
+ }
+ ]
+ },
+ {
+ "query_name": "Healthcheck Instruction Missing",
+ "query_id": "b03a748a-542d-44f4-bb86-9199ab4fd2d5",
+ "query_url": "https://docs.docker.com/engine/reference/builder/#healthcheck",
+ "severity": "LOW",
+ "platform": "Dockerfile",
+ "cwe": "710",
+ "riskScore": "3.6",
+ "category": "Insecure Configurations",
+ "experimental": false,
+ "description": "Ensure that HEALTHCHECK is being used. The HEALTHCHECK instruction tells Docker how to test a container to check that it is still working",
+ "description_id": "426121ee",
+ "files": [
+ {
+ "file_name": "/path/test/fixtures/dockerfile/corrupted_dockerfile",
+ "similarity_id": "ec1a1e998229f963313752def87ce5027e89997cfb4180c9b356414566f5a029",
+ "line": 1,
+ "issue_type": "MissingAttribute",
+ "search_key": "FROM={{alpine:latest}}",
+ "search_line": -1,
+ "search_value": "",
+ "expected_value": "Dockerfile should contain instruction 'HEALTHCHECK'",
+ "actual_value": "Dockerfile doesn't contain instruction 'HEALTHCHECK'"
+ }
+ ]
+ }
+ ]
+}
diff --git a/e2e/fixtures/E2E_CLI_068_RESULT.json b/e2e/fixtures/E2E_CLI_068_RESULT.json
index daf2b8d0200..96bb3396ecf 100644
--- a/e2e/fixtures/E2E_CLI_068_RESULT.json
+++ b/e2e/fixtures/E2E_CLI_068_RESULT.json
@@ -1,109 +1,60 @@
{
- "kics_version": "development",
- "files_scanned": 1,
- "lines_scanned": 6,
- "files_parsed": 1,
- "lines_parsed": 6,
- "lines_ignored": 0,
- "files_failed_to_scan": 0,
- "queries_total": 48,
- "queries_failed_to_execute": 1,
- "queries_failed_to_compute_similarity_id": 0,
- "scan_id": "console",
- "severity_counters": {
- "CRITICAL": 0,
- "HIGH": 1,
- "INFO": 0,
- "LOW": 1,
- "MEDIUM": 1,
- "TRACE": 0
- },
- "total_counter": 3,
- "total_bom_resources": 0,
- "start": "2024-03-27T11:20:29.068037Z",
- "end": "2024-03-27T11:20:30.0252697Z",
- "paths": [
- "/path/test/fixtures/dockerfile/corrupted_dockerfile"
- ],
- "queries": [
- {
- "query_name": "Missing User Instruction",
- "query_id": "fd54f200-402c-4333-a5a4-36ef6709af2f",
- "query_url": "https://docs.docker.com/engine/reference/builder/#user",
- "severity": "HIGH",
- "platform": "Dockerfile",
- "cwe": "250",
- "riskScore": "7.7",
- "cloud_provider": "COMMON",
- "category": "Build Process",
- "experimental": false,
- "description": "A user should be specified in the dockerfile, otherwise the image will run as root",
- "description_id": "eb49caf6",
- "files": [
- {
- "file_name": "/path/test/fixtures/dockerfile/corrupted_dockerfile",
- "similarity_id": "821b0a105dd9ebb6b14489251615d94813a578feb68624113a52ba9c1668ecb7",
- "line": 1,
- "issue_type": "MissingAttribute",
- "search_key": "FROM={{alpine:latest}}",
- "search_line": -1,
- "search_value": "",
- "expected_value": "The 'Dockerfile' should contain the 'USER' instruction",
- "actual_value": "The 'Dockerfile' does not contain any 'USER' instruction"
- }
- ]
- },
- {
- "query_name": "Image Version Using 'latest'",
- "query_id": "f45ea400-6bbe-4501-9fc7-1c3d75c32067",
- "query_url": "https://docs.docker.com/develop/dev-best-practices/",
- "severity": "MEDIUM",
- "platform": "Dockerfile",
- "cwe": "1357",
- "riskScore": "5.1",
- "category": "Best Practices",
- "experimental": false,
- "description": "When building images, always tag them with useful tags which codify version information, intended destination (prod or test, for instance), stability, or other information that is useful when deploying the application in different environments. Do not rely on the automatically-created latest tag",
- "description_id": "22f535ec",
- "files": [
- {
- "file_name": "/path/test/fixtures/dockerfile/corrupted_dockerfile",
- "similarity_id": "a32938ae4d056569e5cfda73594f6cb276d4f9ee14a848fb6b642b14defee892",
- "line": 1,
- "issue_type": "IncorrectValue",
- "search_key": "FROM={{alpine:latest}}",
- "search_line": -1,
- "search_value": "",
- "expected_value": "FROM alpine:latest:'version' where version should not be 'latest'",
- "actual_value": "FROM alpine:latest'"
- }
- ]
- },
- {
- "query_name": "Healthcheck Instruction Missing",
- "query_id": "b03a748a-542d-44f4-bb86-9199ab4fd2d5",
- "query_url": "https://docs.docker.com/engine/reference/builder/#healthcheck",
- "severity": "LOW",
- "platform": "Dockerfile",
- "cwe": "710",
- "riskScore": "3.6",
- "category": "Insecure Configurations",
- "experimental": false,
- "description": "Ensure that HEALTHCHECK is being used. The HEALTHCHECK instruction tells Docker how to test a container to check that it is still working",
- "description_id": "426121ee",
- "files": [
- {
- "file_name": "/path/test/fixtures/dockerfile/corrupted_dockerfile",
- "similarity_id": "ec1a1e998229f963313752def87ce5027e89997cfb4180c9b356414566f5a029",
- "line": 1,
- "issue_type": "MissingAttribute",
- "search_key": "FROM={{alpine:latest}}",
- "search_line": -1,
- "search_value": "",
- "expected_value": "Dockerfile should contain instruction 'HEALTHCHECK'",
- "actual_value": "Dockerfile doesn't contain instruction 'HEALTHCHECK'"
- }
- ]
- }
- ]
+ "kics_version": "development",
+ "files_scanned": 1,
+ "lines_scanned": 10,
+ "files_parsed": 1,
+ "lines_parsed": 9,
+ "lines_ignored": 1,
+ "files_failed_to_scan": 0,
+ "queries_total": 1,
+ "queries_failed_to_execute": 0,
+ "queries_failed_to_compute_similarity_id": 0,
+ "scan_id": "console",
+ "severity_counters": {
+ "CRITICAL": 0,
+ "HIGH": 0,
+ "INFO": 0,
+ "LOW": 0,
+ "MEDIUM": 1,
+ "TRACE": 0
+ },
+ "total_counter": 1,
+ "total_bom_resources": 0,
+ "start": "2024-05-28T13:16:27.1599468+01:00",
+ "end": "2024-05-28T13:16:27.6636108+01:00",
+ "paths": [
+ "/path/test/fixtures/experimental_test/sample",
+ "/path/test/fixtures/experimental_test/queries"
+ ],
+ "queries": [
+ {
+ "query_name": "Redis Disabled",
+ "query_id": "4bd15dd9-8d5e-4008-8532-27eb0c3706d3",
+ "query_url": "https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticache_cluster#engine",
+ "severity": "MEDIUM",
+ "platform": "Terraform",
+ "cloud_provider": "AWS",
+ "category": "Encryption",
+ "experimental": false,
+ "description": "ElastiCache should have Redis enabled, since it covers Compliance Certifications such as FedRAMP, HIPAA, and PCI DSS. For more information, take a look at 'https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/SelectEngine.html'",
+ "description_id": "68984bf2",
+ "files": [
+ {
+ "file_name": "path\\test\\fixtures\\experimental_test\\sample\\sample.tf",
+ "similarity_id": "32a6747d15f909ebe86d171c563878dd7e06dfb2f9ec1b569ef46e810860f27a",
+ "line": 4,
+ "resource_type": "aws_elasticache_cluster",
+ "resource_name": "cluster-example",
+ "issue_type": "IncorrectValue",
+ "search_key": "resource.aws_elasticache_cluster[positive1].engine",
+ "search_line": 4,
+ "search_value": "",
+ "expected_value": "resource.aws_elasticache_cluster[positive1].engine should have Redis enabled",
+ "actual_value": "resource.aws_elasticache_cluster[positive1].engine doesn't enable Redis",
+ "remediation": "{\"after\":\"redis\",\"before\":\"memcached\"}",
+ "remediation_type": "replacement"
+ }
+ ]
+ }
+ ]
}
diff --git a/e2e/fixtures/E2E_CLI_069_RESULT.json b/e2e/fixtures/E2E_CLI_069_RESULT.json
index 96bb3396ecf..c3b5183ce6f 100644
--- a/e2e/fixtures/E2E_CLI_069_RESULT.json
+++ b/e2e/fixtures/E2E_CLI_069_RESULT.json
@@ -6,27 +6,56 @@
"lines_parsed": 9,
"lines_ignored": 1,
"files_failed_to_scan": 0,
- "queries_total": 1,
+ "queries_total": 2,
"queries_failed_to_execute": 0,
"queries_failed_to_compute_similarity_id": 0,
"scan_id": "console",
"severity_counters": {
"CRITICAL": 0,
- "HIGH": 0,
+ "HIGH": 1,
"INFO": 0,
"LOW": 0,
"MEDIUM": 1,
"TRACE": 0
},
- "total_counter": 1,
+ "total_counter": 2,
"total_bom_resources": 0,
- "start": "2024-05-28T13:16:27.1599468+01:00",
- "end": "2024-05-28T13:16:27.6636108+01:00",
+ "start": "2025-11-05T12:30:29.616176853Z",
+ "end": "2025-11-05T12:30:30.07811478Z",
"paths": [
"/path/test/fixtures/experimental_test/sample",
"/path/test/fixtures/experimental_test/queries"
],
"queries": [
+ {
+ "query_name": "Redis Disabled Experimental",
+ "query_id": "4bd15dd9-8d5e-4008-8532-27eb0c3706d4",
+ "query_url": "https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticache_cluster#engine",
+ "severity": "HIGH",
+ "platform": "Terraform",
+ "cloud_provider": "AWS",
+ "category": "Encryption",
+ "experimental": true,
+ "description": "ElastiCache should have Redis enabled, since it covers Compliance Certifications such as FedRAMP, HIPAA, and PCI DSS. For more information, take a look at 'https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/SelectEngine.html'",
+ "description_id": "68984bf2",
+ "files": [
+ {
+ "file_name": "path\\test\\fixtures\\experimental_test\\sample\\sample.tf",
+ "similarity_id": "efa296e727d250c75a82c32c397e4e78d4b87434373312b34d970ec260f0aa15",
+ "line": 4,
+ "resource_type": "aws_elasticache_cluster",
+ "resource_name": "cluster-example",
+ "issue_type": "IncorrectValue",
+ "search_key": "resource.aws_elasticache_cluster[positive1].engine",
+ "search_line": 4,
+ "search_value": "",
+ "expected_value": "resource.aws_elasticache_cluster[positive1].engine should have Redis enabled",
+ "actual_value": "resource.aws_elasticache_cluster[positive1].engine doesn't enable Redis",
+ "remediation": "{\"after\":\"redis\",\"before\":\"memcached\"}",
+ "remediation_type": "replacement"
+ }
+ ]
+ },
{
"query_name": "Redis Disabled",
"query_id": "4bd15dd9-8d5e-4008-8532-27eb0c3706d3",
diff --git a/e2e/fixtures/E2E_CLI_070_RESULT.json b/e2e/fixtures/E2E_CLI_070_RESULT.json
index c3b5183ce6f..e5c2c270247 100644
--- a/e2e/fixtures/E2E_CLI_070_RESULT.json
+++ b/e2e/fixtures/E2E_CLI_070_RESULT.json
@@ -1,89 +1,57 @@
{
- "kics_version": "development",
- "files_scanned": 1,
- "lines_scanned": 10,
- "files_parsed": 1,
- "lines_parsed": 9,
- "lines_ignored": 1,
- "files_failed_to_scan": 0,
- "queries_total": 2,
- "queries_failed_to_execute": 0,
- "queries_failed_to_compute_similarity_id": 0,
- "scan_id": "console",
- "severity_counters": {
- "CRITICAL": 0,
- "HIGH": 1,
- "INFO": 0,
- "LOW": 0,
- "MEDIUM": 1,
- "TRACE": 0
- },
- "total_counter": 2,
- "total_bom_resources": 0,
- "start": "2025-11-05T12:30:29.616176853Z",
- "end": "2025-11-05T12:30:30.07811478Z",
- "paths": [
- "/path/test/fixtures/experimental_test/sample",
- "/path/test/fixtures/experimental_test/queries"
- ],
- "queries": [
- {
- "query_name": "Redis Disabled Experimental",
- "query_id": "4bd15dd9-8d5e-4008-8532-27eb0c3706d4",
- "query_url": "https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticache_cluster#engine",
- "severity": "HIGH",
- "platform": "Terraform",
- "cloud_provider": "AWS",
- "category": "Encryption",
- "experimental": true,
- "description": "ElastiCache should have Redis enabled, since it covers Compliance Certifications such as FedRAMP, HIPAA, and PCI DSS. For more information, take a look at 'https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/SelectEngine.html'",
- "description_id": "68984bf2",
- "files": [
- {
- "file_name": "path\\test\\fixtures\\experimental_test\\sample\\sample.tf",
- "similarity_id": "efa296e727d250c75a82c32c397e4e78d4b87434373312b34d970ec260f0aa15",
- "line": 4,
- "resource_type": "aws_elasticache_cluster",
- "resource_name": "cluster-example",
- "issue_type": "IncorrectValue",
- "search_key": "resource.aws_elasticache_cluster[positive1].engine",
- "search_line": 4,
- "search_value": "",
- "expected_value": "resource.aws_elasticache_cluster[positive1].engine should have Redis enabled",
- "actual_value": "resource.aws_elasticache_cluster[positive1].engine doesn't enable Redis",
- "remediation": "{\"after\":\"redis\",\"before\":\"memcached\"}",
- "remediation_type": "replacement"
- }
- ]
- },
- {
- "query_name": "Redis Disabled",
- "query_id": "4bd15dd9-8d5e-4008-8532-27eb0c3706d3",
- "query_url": "https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticache_cluster#engine",
- "severity": "MEDIUM",
- "platform": "Terraform",
- "cloud_provider": "AWS",
- "category": "Encryption",
- "experimental": false,
- "description": "ElastiCache should have Redis enabled, since it covers Compliance Certifications such as FedRAMP, HIPAA, and PCI DSS. For more information, take a look at 'https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/SelectEngine.html'",
- "description_id": "68984bf2",
- "files": [
- {
- "file_name": "path\\test\\fixtures\\experimental_test\\sample\\sample.tf",
- "similarity_id": "32a6747d15f909ebe86d171c563878dd7e06dfb2f9ec1b569ef46e810860f27a",
- "line": 4,
- "resource_type": "aws_elasticache_cluster",
- "resource_name": "cluster-example",
- "issue_type": "IncorrectValue",
- "search_key": "resource.aws_elasticache_cluster[positive1].engine",
- "search_line": 4,
- "search_value": "",
- "expected_value": "resource.aws_elasticache_cluster[positive1].engine should have Redis enabled",
- "actual_value": "resource.aws_elasticache_cluster[positive1].engine doesn't enable Redis",
- "remediation": "{\"after\":\"redis\",\"before\":\"memcached\"}",
- "remediation_type": "replacement"
- }
- ]
- }
- ]
+ "kics_version": "development",
+ "files_scanned": 1,
+ "lines_scanned": 19,
+ "files_parsed": 1,
+ "lines_parsed": 19,
+ "lines_ignored": 0,
+ "files_failed_to_scan": 0,
+ "queries_total": 17,
+ "queries_failed_to_execute": 0,
+ "queries_failed_to_compute_similarity_id": 0,
+ "scan_id": "console",
+ "severity_counters": {
+ "CRITICAL": 0,
+ "HIGH": 0,
+ "INFO": 1,
+ "LOW": 0,
+ "MEDIUM": 0,
+ "TRACE": 0
+ },
+ "total_counter": 1,
+ "total_bom_resources": 0,
+ "start": "2023-11-08T16:02:34.2300252Z",
+ "end": "2023-11-08T16:02:36.2803423Z",
+ "paths": [
+ "/path/test/fixtures/resolve_references"
+ ],
+ "queries": [
+ {
+ "query_name": "Components Schema Definition Is Unused",
+ "query_id": "962fa01e-b791-4dcc-b04a-4a3e7389be5e",
+ "query_url": "https://swagger.io/specification/#components-object",
+ "severity": "INFO",
+ "platform": "OpenAPI",
+ "cloudProvider": "common",
+ "cwe": "710",
+ "riskScore": "0.0",
+ "category": "Best Practices",
+ "experimental": false,
+ "description": "Components schemas definitions should be referenced or removed from Open API definition",
+ "description_id": "5cdc0f3b",
+ "files": [
+ {
+ "file_name": "path\\test\\fixtures\\resolve_references\\swagger.yaml",
+ "similarity_id": "ff39e561509c13315ce34a0be602a974d63231b70cb5cdf778109e062302f8eb",
+ "line": 17,
+ "issue_type": "IncorrectValue",
+ "search_key": "components.schemas.{{MyResponse}}",
+ "search_line": -1,
+ "search_value": "",
+ "expected_value": "Schema should be used as reference somewhere",
+ "actual_value": "Schema is not used as reference"
+ }
+ ]
+ }
+ ]
}
diff --git a/e2e/fixtures/E2E_CLI_071_RESULT.json b/e2e/fixtures/E2E_CLI_071_RESULT.json
deleted file mode 100644
index e5c2c270247..00000000000
--- a/e2e/fixtures/E2E_CLI_071_RESULT.json
+++ /dev/null
@@ -1,57 +0,0 @@
-{
- "kics_version": "development",
- "files_scanned": 1,
- "lines_scanned": 19,
- "files_parsed": 1,
- "lines_parsed": 19,
- "lines_ignored": 0,
- "files_failed_to_scan": 0,
- "queries_total": 17,
- "queries_failed_to_execute": 0,
- "queries_failed_to_compute_similarity_id": 0,
- "scan_id": "console",
- "severity_counters": {
- "CRITICAL": 0,
- "HIGH": 0,
- "INFO": 1,
- "LOW": 0,
- "MEDIUM": 0,
- "TRACE": 0
- },
- "total_counter": 1,
- "total_bom_resources": 0,
- "start": "2023-11-08T16:02:34.2300252Z",
- "end": "2023-11-08T16:02:36.2803423Z",
- "paths": [
- "/path/test/fixtures/resolve_references"
- ],
- "queries": [
- {
- "query_name": "Components Schema Definition Is Unused",
- "query_id": "962fa01e-b791-4dcc-b04a-4a3e7389be5e",
- "query_url": "https://swagger.io/specification/#components-object",
- "severity": "INFO",
- "platform": "OpenAPI",
- "cloudProvider": "common",
- "cwe": "710",
- "riskScore": "0.0",
- "category": "Best Practices",
- "experimental": false,
- "description": "Components schemas definitions should be referenced or removed from Open API definition",
- "description_id": "5cdc0f3b",
- "files": [
- {
- "file_name": "path\\test\\fixtures\\resolve_references\\swagger.yaml",
- "similarity_id": "ff39e561509c13315ce34a0be602a974d63231b70cb5cdf778109e062302f8eb",
- "line": 17,
- "issue_type": "IncorrectValue",
- "search_key": "components.schemas.{{MyResponse}}",
- "search_line": -1,
- "search_value": "",
- "expected_value": "Schema should be used as reference somewhere",
- "actual_value": "Schema is not used as reference"
- }
- ]
- }
- ]
-}
diff --git a/e2e/fixtures/assets/scan_help b/e2e/fixtures/assets/scan_help
index 6c89453f462..c67eaa2b906 100644
--- a/e2e/fixtures/assets/scan_help
+++ b/e2e/fixtures/assets/scan_help
@@ -5,7 +5,6 @@ Flags:
-m, --bom include bill of materials (BoM) in results output
--cloud-provider strings list of cloud providers to scan (alicloud,aws,azure,gcp,nifcloud,tencentcloud)
--config string path to configuration file
- --disable-full-descriptions disable request for full descriptions and use default vulnerability descriptions
--disable-secrets disable secrets scanning
--enable-openapi-refs resolve the file reference, on OpenAPI files
--exclude-categories strings exclude categories by providing its name
diff --git a/e2e/fixtures/samples/secrets/regex_rules_48_empty.json b/e2e/fixtures/samples/secrets/regex_rules_47_empty.json
similarity index 100%
rename from e2e/fixtures/samples/secrets/regex_rules_48_empty.json
rename to e2e/fixtures/samples/secrets/regex_rules_47_empty.json
diff --git a/e2e/fixtures/samples/secrets/regex_rules_48_invalid_regex.json b/e2e/fixtures/samples/secrets/regex_rules_47_invalid_regex.json
similarity index 100%
rename from e2e/fixtures/samples/secrets/regex_rules_48_invalid_regex.json
rename to e2e/fixtures/samples/secrets/regex_rules_47_invalid_regex.json
diff --git a/e2e/fixtures/samples/secrets/regex_rules_48_valid.json b/e2e/fixtures/samples/secrets/regex_rules_47_valid.json
similarity index 100%
rename from e2e/fixtures/samples/secrets/regex_rules_48_valid.json
rename to e2e/fixtures/samples/secrets/regex_rules_47_valid.json
diff --git a/e2e/testcases/e2e-cli-031_scan_report-formats.go b/e2e/testcases/e2e-cli-031_scan_report-formats.go
index a3d52a81882..64195648742 100644
--- a/e2e/testcases/e2e-cli-031_scan_report-formats.go
+++ b/e2e/testcases/e2e-cli-031_scan_report-formats.go
@@ -11,7 +11,7 @@ func init() { //nolint
"--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",
+ []string{"scan", "--output-path", "/path/e2e/output", "--output-name", "E2E_CLI_031_RESULT_2",
"--report-formats", "json,JUnit,CSV", "--include-queries", "275a3217-ca37-40c1-a6cf-bb57d245ab32",
"-p", "/path/e2e/fixtures/samples/positive.yaml"},
},
@@ -21,8 +21,8 @@ func init() { //nolint
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"},
+ ResultsFile: "E2E_CLI_031_RESULT_2",
+ ResultsFormats: []string{"junit", "json", "csv"},
},
},
UseMock: []bool{false, true},
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-046_scan_payload-lines.go
similarity index 73%
rename from e2e/testcases/e2e-cli-047_scan_payload-lines.go
rename to e2e/testcases/e2e-cli-046_scan_payload-lines.go
index 782970d5741..7aa60154bbd 100644
--- a/e2e/testcases/e2e-cli-047_scan_payload-lines.go
+++ b/e2e/testcases/e2e-cli-046_scan_payload-lines.go
@@ -1,17 +1,17 @@
package testcases
-// E2E-CLI-047 - Kics scan command with --payload-lines
+// E2E-CLI-046 - 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]",
+ Name: "should display line references in the payload file [E2E-CLI-046]",
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"},
+ "--payload-path", "/path/e2e/output/E2E_CLI_046_PAYLOAD.json", "--payload-lines"},
},
ExpectedPayload: []string{
- "E2E_CLI_047_PAYLOAD.json",
+ "E2E_CLI_046_PAYLOAD.json",
},
},
WantStatus: []int{50},
diff --git a/e2e/testcases/e2e-cli-048_scan_custom-secrets-regexes.go b/e2e/testcases/e2e-cli-047_scan_custom-secrets-regexes.go
similarity index 85%
rename from e2e/testcases/e2e-cli-048_scan_custom-secrets-regexes.go
rename to e2e/testcases/e2e-cli-047_scan_custom-secrets-regexes.go
index 4351c5bc383..4ba2db1e26d 100644
--- a/e2e/testcases/e2e-cli-048_scan_custom-secrets-regexes.go
+++ b/e2e/testcases/e2e-cli-047_scan_custom-secrets-regexes.go
@@ -1,24 +1,24 @@
package testcases
-// E2E-CLI-048 - Kics scan command with --secrets-regexes-path
+// E2E-CLI-047 - 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]",
+ Name: "should load custom secrets rules from provided path [E2E-CLI-047]",
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"},
+ "--secrets-regexes-path", "/path/e2e/fixtures/samples/secrets/regex_rules_47_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",
+ "--secrets-regexes-path", "/path/e2e/fixtures/samples/secrets/regex_rules_47_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"},
+ "--secrets-regexes-path", "/path/e2e/fixtures/samples/secrets/regex_rules_47_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"},
+ "--secrets-regexes-path", "/path/e2e/fixtures/samples/secrets/regex_rules_47_invalid_regex.json"},
[]string{"scan", "--silent", "-p", "/path/e2e/fixtures/samples/terraform.tf",
"--secrets-regexes-path", "not-exists-folder"},
diff --git a/e2e/testcases/e2e-cli-049_scan_custom-libraries-path.go b/e2e/testcases/e2e-cli-048_scan_custom-libraries-path.go
similarity index 92%
rename from e2e/testcases/e2e-cli-049_scan_custom-libraries-path.go
rename to e2e/testcases/e2e-cli-048_scan_custom-libraries-path.go
index b170825d858..d4faf7f8a3c 100644
--- a/e2e/testcases/e2e-cli-049_scan_custom-libraries-path.go
+++ b/e2e/testcases/e2e-cli-048_scan_custom-libraries-path.go
@@ -1,10 +1,10 @@
package testcases
-// E2E-CLI-049 - Kics scan command with --libraries-path
+// E2E-CLI-048 - 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]",
+ Name: "should load libraries from the provided path [E2E-CLI-048]",
Args: args{
Args: []cmdArgs{
[]string{"scan", "--silent", "-p", "/path/e2e/fixtures/samples/terraform-single.tf",
diff --git a/e2e/testcases/e2e-cli-050_scan_bill-of-materials.go b/e2e/testcases/e2e-cli-049_scan_bill-of-materials.go
similarity index 90%
rename from e2e/testcases/e2e-cli-050_scan_bill-of-materials.go
rename to e2e/testcases/e2e-cli-049_scan_bill-of-materials.go
index 22df7077eb1..4e9be2841b3 100644
--- a/e2e/testcases/e2e-cli-050_scan_bill-of-materials.go
+++ b/e2e/testcases/e2e-cli-049_scan_bill-of-materials.go
@@ -1,10 +1,10 @@
package testcases
-// E2E-CLI-050 - Kics scan command with --bom (or -m)
+// E2E-CLI-049 - 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]",
+ Name: "should include bill of materials in results output [E2E-CLI-049]",
Args: args{
Args: []cmdArgs{
[]string{"scan", "-p", "/path/e2e/fixtures/samples/bom-positive.tf",
diff --git a/e2e/testcases/e2e-cli-051_scan_custom-queries-path.go b/e2e/testcases/e2e-cli-050_scan_custom-queries-path.go
similarity index 93%
rename from e2e/testcases/e2e-cli-051_scan_custom-queries-path.go
rename to e2e/testcases/e2e-cli-050_scan_custom-queries-path.go
index a62652f55b2..b53e4dec67e 100644
--- a/e2e/testcases/e2e-cli-051_scan_custom-queries-path.go
+++ b/e2e/testcases/e2e-cli-050_scan_custom-queries-path.go
@@ -1,10 +1,10 @@
package testcases
-// E2E-CLI-051 - Kics scan command with --queries-path
+// E2E-CLI-050 - 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]",
+ Name: "should load and execute queries from a custom path [E2E-CLI-050]",
Args: args{
Args: []cmdArgs{
[]string{"scan", "--queries-path", "/path/e2e/fixtures/samples/queries/valid/single_query",
diff --git a/e2e/testcases/e2e-cli-052_scan_with_custom_cis_descriptions.go b/e2e/testcases/e2e-cli-051_scan_with_custom_cis_descriptions.go
similarity index 60%
rename from e2e/testcases/e2e-cli-052_scan_with_custom_cis_descriptions.go
rename to e2e/testcases/e2e-cli-051_scan_with_custom_cis_descriptions.go
index f8bc7292480..0ab579c2a47 100644
--- a/e2e/testcases/e2e-cli-052_scan_with_custom_cis_descriptions.go
+++ b/e2e/testcases/e2e-cli-051_scan_with_custom_cis_descriptions.go
@@ -1,29 +1,29 @@
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)
+// E2E-CLI-051 - Kics scan with specific queries
+// should return results for the provided queries
func init() { //nolint
testSample := TestCase{
- Name: "should load descriptions from a custom server [E2E-CLI-052]",
+ Name: "should return results for the provided queries [E2E-CLI-051]",
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"},
+ "-o", "/path/e2e/output", "--output-name", "/path/e2e/output/E2E_CLI_051_RESULTS.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"},
+ "-o", "/path/e2e/output", "--output-name", "/path/e2e/output/E2E_CLI_051_RESULTS_2.json"},
},
UseMock: []bool{true, true},
ExpectedResult: []ResultsValidation{
{
- ResultsFile: "E2E_CLI_052_RESULTS_ALL_HAVE_CIS",
- ResultsFormats: []string{"json-cis"},
+ ResultsFile: "E2E_CLI_051_RESULTS",
+ ResultsFormats: []string{"json"},
},
{
- ResultsFile: "E2E_CLI_052_RESULTS_SOME_HAVE_CIS",
+ ResultsFile: "E2E_CLI_051_RESULTS_2",
ResultsFormats: []string{"json"},
},
},
diff --git a/e2e/testcases/e2e-cli-053_kics_scan_ignore.go b/e2e/testcases/e2e-cli-052_kics_scan_ignore.go
similarity index 89%
rename from e2e/testcases/e2e-cli-053_kics_scan_ignore.go
rename to e2e/testcases/e2e-cli-052_kics_scan_ignore.go
index a1ec0194cae..e760de5b576 100644
--- a/e2e/testcases/e2e-cli-053_kics_scan_ignore.go
+++ b/e2e/testcases/e2e-cli-052_kics_scan_ignore.go
@@ -1,9 +1,9 @@
package testcases
-// E2E-CLI-053 - Kics scan can ignore entire files, blocks and lines based in kics-ignore comments
+// E2E-CLI-052 - 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]",
+ Name: "should ignore files/code-blocks/code-lines during the scan [E2E-CLI-052]",
Args: args{
Args: []cmdArgs{
[]string{"scan", "-p", "/path/e2e/fixtures/samples/scan-ignore/enable.tf"},
diff --git a/e2e/testcases/e2e-cli-054_scan_multiple-queries-path.go b/e2e/testcases/e2e-cli-053_scan_multiple-queries-path.go
similarity index 91%
rename from e2e/testcases/e2e-cli-054_scan_multiple-queries-path.go
rename to e2e/testcases/e2e-cli-053_scan_multiple-queries-path.go
index 7349fa1fd46..2114a0f1275 100644
--- a/e2e/testcases/e2e-cli-054_scan_multiple-queries-path.go
+++ b/e2e/testcases/e2e-cli-053_scan_multiple-queries-path.go
@@ -2,11 +2,11 @@ package testcases
import "regexp"
-// E2E-CLI-054 - Kics scan command with --queries-path using multiple entries
+// E2E-CLI-053 - 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]",
+ Name: "should load and execute queries from multiple paths [E2E-CLI-053]",
Args: args{
Args: []cmdArgs{
[]string{"scan", "--queries-path", "/path/e2e/fixtures/samples/queries/valid/single_query," +
diff --git a/e2e/testcases/e2e-cli-055_scan_resolve_openapi_files.go b/e2e/testcases/e2e-cli-054_scan_resolve_openapi_files.go
similarity index 85%
rename from e2e/testcases/e2e-cli-055_scan_resolve_openapi_files.go
rename to e2e/testcases/e2e-cli-054_scan_resolve_openapi_files.go
index 91fc8b339ef..4d478c55f89 100644
--- a/e2e/testcases/e2e-cli-055_scan_resolve_openapi_files.go
+++ b/e2e/testcases/e2e-cli-054_scan_resolve_openapi_files.go
@@ -2,11 +2,11 @@ package testcases
import "regexp"
-// E2E-CLI-055 - Kics scan command with openapi files that are not resolved
+// E2E-CLI-054 - 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]",
+ Name: "should resolve openapi files and return results in different files [E2E-CLI-054]",
Args: args{
Args: []cmdArgs{
[]string{"scan", "-p", "/path/e2e/fixtures/samples/unresolved_openapi"},
diff --git a/e2e/testcases/e2e-cli-056_scan_timeout.go b/e2e/testcases/e2e-cli-055_scan_timeout.go
similarity index 93%
rename from e2e/testcases/e2e-cli-056_scan_timeout.go
rename to e2e/testcases/e2e-cli-055_scan_timeout.go
index 26250e845e7..c49df900b55 100644
--- a/e2e/testcases/e2e-cli-056_scan_timeout.go
+++ b/e2e/testcases/e2e-cli-055_scan_timeout.go
@@ -4,11 +4,11 @@ import (
"regexp"
)
-// E2E-CLI-056 - Kics scan command with timeout flag
+// E2E-CLI-055 - 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]",
+ Name: "should timeout queries when reaching the timeout limit [E2E-CLI-055]",
Args: args{
Args: []cmdArgs{
[]string{"scan", "--config", "/path/e2e/fixtures/samples/configs/config.yaml", "-v"},
diff --git a/e2e/testcases/e2e-cli-057_fix_all.go b/e2e/testcases/e2e-cli-056_fix_all.go
similarity index 85%
rename from e2e/testcases/e2e-cli-057_fix_all.go
rename to e2e/testcases/e2e-cli-056_fix_all.go
index 8d53565cce6..c7ccdad01aa 100644
--- a/e2e/testcases/e2e-cli-057_fix_all.go
+++ b/e2e/testcases/e2e-cli-056_fix_all.go
@@ -4,13 +4,13 @@ import (
"regexp"
)
-// E2E-CLI-057 - Kics remediate command
+// E2E-CLI-056 - 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]",
+ Name: "should remediate all remediation found [E2E-CLI-056]",
Args: args{
Args: []cmdArgs{
[]string{"remediate", "--results", "/path/e2e/tmp-kics-ar/results-remediate-all.json", "-v"},
diff --git a/e2e/testcases/e2e-cli-058_fix_include_ids.go b/e2e/testcases/e2e-cli-057_fix_include_ids.go
similarity index 97%
rename from e2e/testcases/e2e-cli-058_fix_include_ids.go
rename to e2e/testcases/e2e-cli-057_fix_include_ids.go
index 1526d353f69..8cc5a6930cc 100644
--- a/e2e/testcases/e2e-cli-058_fix_include_ids.go
+++ b/e2e/testcases/e2e-cli-057_fix_include_ids.go
@@ -10,7 +10,7 @@ func init() { //nolint
generateResults("results-remediate-include-ids")
testSample := TestCase{
- Name: "should remediate the recommendations pointed in include-ids flag [E2E-CLI-058]",
+ Name: "should remediate the recommendations pointed in include-ids flag [E2E-CLI-057]",
Args: args{
Args: []cmdArgs{
[]string{"remediate", "--results", "/path/e2e/tmp-kics-ar/results-remediate-include-ids.json",
diff --git a/e2e/testcases/e2e-cli-059_help_fix.go b/e2e/testcases/e2e-cli-058_help_fix.go
similarity index 78%
rename from e2e/testcases/e2e-cli-059_help_fix.go
rename to e2e/testcases/e2e-cli-058_help_fix.go
index ede40f3f54e..a5e5e1edfe8 100644
--- a/e2e/testcases/e2e-cli-059_help_fix.go
+++ b/e2e/testcases/e2e-cli-058_help_fix.go
@@ -1,15 +1,15 @@
package testcases
-// E2E-CLI-059 - KICS remediate command should display a help text in the CLI when provided with the
+// E2E-CLI-058 - 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]",
+ Name: "should display the kics remediate help text [E2E-CLI-058]",
Args: args{
Args: []cmdArgs{
[]string{"remediate", "--help"},
},
- ExpectedOut: []string{"E2E_CLI_059"},
+ ExpectedOut: []string{"E2E_CLI_058"},
},
WantStatus: []int{0},
}
diff --git a/e2e/testcases/e2e-cli-060_fix_text.go b/e2e/testcases/e2e-cli-059_fix_text.go
similarity index 73%
rename from e2e/testcases/e2e-cli-060_fix_text.go
rename to e2e/testcases/e2e-cli-059_fix_text.go
index f2f5b670402..38a1334c6da 100644
--- a/e2e/testcases/e2e-cli-060_fix_text.go
+++ b/e2e/testcases/e2e-cli-059_fix_text.go
@@ -1,15 +1,15 @@
package testcases
-// E2E-CLI-060 - KICS remediate command has a mandatory flag --results. The CLI should exhibit
+// E2E-CLI-059 - 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]",
+ Name: "should display an error regarding missing --results flag [E2E-CLI-059]",
Args: args{
Args: []cmdArgs{
[]string{"remediate"},
},
- ExpectedOut: []string{"E2E_CLI_060"},
+ ExpectedOut: []string{"E2E_CLI_059"},
},
WantStatus: []int{126},
}
diff --git a/e2e/testcases/e2e-cli-061_scan_exclude_type.go b/e2e/testcases/e2e-cli-060_scan_exclude_type.go
similarity index 78%
rename from e2e/testcases/e2e-cli-061_scan_exclude_type.go
rename to e2e/testcases/e2e-cli-060_scan_exclude_type.go
index 3bab9e64720..c697d43a239 100644
--- a/e2e/testcases/e2e-cli-061_scan_exclude_type.go
+++ b/e2e/testcases/e2e-cli-060_scan_exclude_type.go
@@ -1,19 +1,19 @@
// 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
+// E2E-CLI-060 - 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]",
+ Name: "should perform a valid scan with --exclude-type flag [E2E-CLI-060]",
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",
+ "--silent", "--payload-path", "/path/e2e/output/E2E_CLI_060_PAYLOAD.json", "--exclude-type",
"TeRRafOrm"},
},
ExpectedPayload: []string{
- "E2E_CLI_061_PAYLOAD.json",
+ "E2E_CLI_060_PAYLOAD.json",
},
},
WantStatus: []int{50},
diff --git a/e2e/testcases/e2e-cli-063_tf_variables_flag_path.go b/e2e/testcases/e2e-cli-061_tf_variables_comment_path.go
similarity index 60%
rename from e2e/testcases/e2e-cli-063_tf_variables_flag_path.go
rename to e2e/testcases/e2e-cli-061_tf_variables_comment_path.go
index 65ddf4388f4..6dda5165d84 100644
--- a/e2e/testcases/e2e-cli-063_tf_variables_flag_path.go
+++ b/e2e/testcases/e2e-cli-061_tf_variables_comment_path.go
@@ -1,19 +1,18 @@
// 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
+// E2E-CLI-061 - 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 flag [E2E-CLI-063]",
+ Name: "should perform a valid scan and get the variables using a variables path as a comment [E2E-CLI-061]",
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"},
+ "--silent", "--payload-path", "/path/e2e/output/E2E_CLI_061_PAYLOAD.json"},
},
ExpectedPayload: []string{
- "E2E_CLI_063_PAYLOAD.json",
+ "E2E_CLI_061_PAYLOAD.json",
},
},
WantStatus: []int{0},
diff --git a/e2e/testcases/e2e-cli-062_tf_variables_comment_path.go b/e2e/testcases/e2e-cli-062_tf_variables_flag_path.go
similarity index 78%
rename from e2e/testcases/e2e-cli-062_tf_variables_comment_path.go
rename to e2e/testcases/e2e-cli-062_tf_variables_flag_path.go
index 524febbef5f..934b5f6b171 100644
--- a/e2e/testcases/e2e-cli-062_tf_variables_comment_path.go
+++ b/e2e/testcases/e2e-cli-062_tf_variables_flag_path.go
@@ -1,15 +1,16 @@
// 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
+// E2E-CLI-062 - 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 comment [E2E-CLI-062]",
+ Name: "should perform a valid scan and get the variables using a variables path as a flag [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"},
+ "--silent", "--payload-path", "/path/e2e/output/E2E_CLI_062_PAYLOAD.json",
+ "--terraform-vars-path", "/path/e2e/fixtures/samples/terraform-vars-path/terraform-vars.tfvars"},
},
ExpectedPayload: []string{
"E2E_CLI_062_PAYLOAD.json",
diff --git a/e2e/testcases/e2e-cli-064_json_file_ref.go b/e2e/testcases/e2e-cli-063_json_file_ref.go
similarity index 84%
rename from e2e/testcases/e2e-cli-064_json_file_ref.go
rename to e2e/testcases/e2e-cli-063_json_file_ref.go
index b98432e31c0..96e85eaacc1 100644
--- a/e2e/testcases/e2e-cli-064_json_file_ref.go
+++ b/e2e/testcases/e2e-cli-063_json_file_ref.go
@@ -1,11 +1,11 @@
// 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
+// E2E-CLI-063 - 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]",
+ Name: "should perform a valid scan with json/yaml file with ## in non ref [E2E-CLI-063]",
Args: args{
Args: []cmdArgs{
[]string{"scan", "-p", "\"/path/e2e/fixtures/samples/swagger\"",
diff --git a/e2e/testcases/e2e-cli-065_yaml_resolver_panic.go b/e2e/testcases/e2e-cli-064_yaml_resolver_panic.go
similarity index 84%
rename from e2e/testcases/e2e-cli-065_yaml_resolver_panic.go
rename to e2e/testcases/e2e-cli-064_yaml_resolver_panic.go
index ab7744c2611..b75390361f3 100644
--- a/e2e/testcases/e2e-cli-065_yaml_resolver_panic.go
+++ b/e2e/testcases/e2e-cli-064_yaml_resolver_panic.go
@@ -1,11 +1,11 @@
// Package testcases provides end-to-end (E2E) testing functionality for the application.
package testcases
-// E2E-CLI-065 - KICS scan
+// E2E-CLI-064 - 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]",
+ Name: "should perform a valid scan [E2E-CLI-064]",
Args: args{
Args: []cmdArgs{
[]string{"scan", "-p", "\"/path/e2e/fixtures/samples/panicYamlRef/file1.yaml\"",
diff --git a/e2e/testcases/e2e-cli-066_analyze_command.go b/e2e/testcases/e2e-cli-065_analyze_command.go
similarity index 68%
rename from e2e/testcases/e2e-cli-066_analyze_command.go
rename to e2e/testcases/e2e-cli-065_analyze_command.go
index 6e022b0cb68..832f0bce0e4 100644
--- a/e2e/testcases/e2e-cli-066_analyze_command.go
+++ b/e2e/testcases/e2e-cli-065_analyze_command.go
@@ -1,27 +1,27 @@
// Package testcases provides end-to-end (E2E) testing functionality for the application.
package testcases
-// E2E-CLI-066 - KICS analyze
+// E2E-CLI-065 - KICS analyze
// should finish successfully and return exit code 0
func init() { //nolint
testSample := TestCase{
- Name: "should perform a valid analyze [E2E-CLI-066]",
+ Name: "should perform a valid analyze [E2E-CLI-065]",
Args: args{
Args: []cmdArgs{
[]string{"analyze",
"--analyze-path", "/path/e2e/fixtures/samples/swagger",
- "--analyze-results", "/path/e2e/output/E2E_CLI_066_ANALYZE_RESULTS.json"},
+ "--analyze-results", "/path/e2e/output/E2E_CLI_065_ANALYZE_RESULTS.json"},
[]string{"analyze",
"--analyze-path", "/path/e2e/fixtures/samples/positive.yaml",
- "--analyze-results", "/path/e2e/output/E2E_CLI_066_ANALYZE_RESULTS_2.json"},
+ "--analyze-results", "/path/e2e/output/E2E_CLI_065_ANALYZE_RESULTS_2.json"},
},
ExpectedAnalyzerResults: []ResultsValidation{
{
- ResultsFile: "E2E_CLI_066_ANALYZE_RESULTS",
+ ResultsFile: "E2E_CLI_065_ANALYZE_RESULTS",
ResultsFormats: []string{"json"},
},
{
- ResultsFile: "E2E_CLI_066_ANALYZE_RESULTS_2",
+ ResultsFile: "E2E_CLI_065_ANALYZE_RESULTS_2",
ResultsFormats: []string{"json"},
},
},
diff --git a/e2e/testcases/e2e-cli-067_ignore_broken_symlink_eloop.go b/e2e/testcases/e2e-cli-066_ignore_broken_symlink_eloop.go
similarity index 73%
rename from e2e/testcases/e2e-cli-067_ignore_broken_symlink_eloop.go
rename to e2e/testcases/e2e-cli-066_ignore_broken_symlink_eloop.go
index bf610791402..3c5191773cd 100644
--- a/e2e/testcases/e2e-cli-067_ignore_broken_symlink_eloop.go
+++ b/e2e/testcases/e2e-cli-066_ignore_broken_symlink_eloop.go
@@ -1,18 +1,18 @@
// 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
+// E2E-CLI-066 - 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]",
+ Name: "should perform a valid scan but ignore broken symlinks and symlinks that create endless loops [E2E-CLI-066]",
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"},
+ "--silent", "--payload-path", "/path/e2e/output/E2E_CLI_066_PAYLOAD.json"},
},
ExpectedPayload: []string{
- "E2E_CLI_067_PAYLOAD.json",
+ "E2E_CLI_066_PAYLOAD.json",
},
},
WantStatus: []int{0},
diff --git a/e2e/testcases/e2e-cli-068_corrupted_dockerfile.go b/e2e/testcases/e2e-cli-067_corrupted_dockerfile.go
similarity index 80%
rename from e2e/testcases/e2e-cli-068_corrupted_dockerfile.go
rename to e2e/testcases/e2e-cli-067_corrupted_dockerfile.go
index a454068801c..270239509fa 100644
--- a/e2e/testcases/e2e-cli-068_corrupted_dockerfile.go
+++ b/e2e/testcases/e2e-cli-067_corrupted_dockerfile.go
@@ -1,20 +1,20 @@
// Package testcases provides end-to-end (E2E) testing functionality for the application.
package testcases
-// E2E-CLI-068 - KICS scan but recover from corrupted dockerfile
+// E2E-CLI-067 - 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]",
+ Name: "should perform a valid scan and recover from a corrupted dockerfile [E2E-CLI-067]",
Args: args{
Args: []cmdArgs{
- []string{"scan", "-o", "/path/e2e/output", "--output-name", "E2E_CLI_068_RESULT",
+ []string{"scan", "-o", "/path/e2e/output", "--output-name", "E2E_CLI_067_RESULT",
"-p", "/path/test/fixtures/dockerfile/corrupted_dockerfile",
},
},
ExpectedResult: []ResultsValidation{
{
- ResultsFile: "E2E_CLI_068_RESULT",
+ ResultsFile: "E2E_CLI_067_RESULT",
ResultsFormats: []string{"json"},
},
},
diff --git a/e2e/testcases/e2e-cli-069_ignore_experimental_query.go b/e2e/testcases/e2e-cli-068_ignore_experimental_query.go
similarity index 82%
rename from e2e/testcases/e2e-cli-069_ignore_experimental_query.go
rename to e2e/testcases/e2e-cli-068_ignore_experimental_query.go
index 2e9e07f6e45..964aeecc229 100644
--- a/e2e/testcases/e2e-cli-069_ignore_experimental_query.go
+++ b/e2e/testcases/e2e-cli-068_ignore_experimental_query.go
@@ -1,6 +1,6 @@
package testcases
-// E2E-CLI-069 - KICS scan and ignore experimental queries
+// E2E-CLI-068 - KICS scan and ignore experimental queries
// should perform the scan successfully and return exit code 40
const (
samplePath = "/path/test/fixtures/experimental_test/sample"
@@ -11,16 +11,16 @@ func init() { //nolint
paths := []string{samplePath, queriesPath}
testSample := TestCase{
- Name: "should perform a valid scan and ignore the experimental queries [E2E-CLI-069]",
+ Name: "should perform a valid scan and ignore the experimental queries [E2E-CLI-068]",
Args: args{
Args: []cmdArgs{
- []string{"scan", "-o", "/path/e2e/output", "--output-name", "E2E_CLI_069_RESULT",
+ []string{"scan", "-o", "/path/e2e/output", "--output-name", "E2E_CLI_068_RESULT",
"-p", "\"" + paths[0] + "\"", "-q", "\"" + paths[1] + "\"",
},
},
ExpectedResult: []ResultsValidation{
{
- ResultsFile: "E2E_CLI_069_RESULT",
+ ResultsFile: "E2E_CLI_068_RESULT",
ResultsFormats: []string{"json"},
},
},
diff --git a/e2e/testcases/e2e-cli-070_not_ignore_experimental_query.go b/e2e/testcases/e2e-cli-069_not_ignore_experimental_query.go
similarity index 82%
rename from e2e/testcases/e2e-cli-070_not_ignore_experimental_query.go
rename to e2e/testcases/e2e-cli-069_not_ignore_experimental_query.go
index bfe90c4c7ba..39137d08310 100644
--- a/e2e/testcases/e2e-cli-070_not_ignore_experimental_query.go
+++ b/e2e/testcases/e2e-cli-069_not_ignore_experimental_query.go
@@ -1,6 +1,6 @@
package testcases
-// E2E-CLI-070 - KICS scan and not ignore experimental queries
+// E2E-CLI-069 - 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"
@@ -9,17 +9,17 @@ func init() { //nolint
paths := []string{samplePath, queriesPath}
testSample := TestCase{
- Name: "should perform a valid scan and not ignore the experimental queries [E2E-CLI-070]",
+ Name: "should perform a valid scan and not ignore the experimental queries [E2E-CLI-069]",
Args: args{
Args: []cmdArgs{
- []string{"scan", "-o", "/path/e2e/output", "--output-name", "E2E_CLI_070_RESULT",
+ []string{"scan", "-o", "/path/e2e/output", "--output-name", "E2E_CLI_069_RESULT",
"-p", "\"" + paths[0] + "\"", "-q", "\"" + paths[1] + "\"",
"--experimental-queries",
},
},
ExpectedResult: []ResultsValidation{
{
- ResultsFile: "E2E_CLI_070_RESULT",
+ ResultsFile: "E2E_CLI_069_RESULT",
ResultsFormats: []string{"json"},
},
},
diff --git a/e2e/testcases/e2e-cli-071_no_flag_resolve_references.go b/e2e/testcases/e2e-cli-070_no_flag_resolve_references.go
similarity index 79%
rename from e2e/testcases/e2e-cli-071_no_flag_resolve_references.go
rename to e2e/testcases/e2e-cli-070_no_flag_resolve_references.go
index c0de9e72766..df46ebb6d8a 100644
--- a/e2e/testcases/e2e-cli-071_no_flag_resolve_references.go
+++ b/e2e/testcases/e2e-cli-070_no_flag_resolve_references.go
@@ -1,21 +1,21 @@
package testcases
-// E2E-CLI-071 - KICS scan and ignore references
+// E2E-CLI-070 - KICS scan and not resolve 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]",
+ Name: "should perform a valid scan and not resolve references [E2E-CLI-070]",
Args: args{
Args: []cmdArgs{
[]string{"scan", "-o", "/path/e2e/output",
- "--output-name", "E2E_CLI_071_RESULT",
+ "--output-name", "E2E_CLI_070_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",
+ ResultsFile: "E2E_CLI_070_RESULT",
ResultsFormats: []string{"json"},
},
},
diff --git a/internal/console/assets/scan-flags.json b/internal/console/assets/scan-flags.json
index 2c6f958b04a..a11317200b0 100644
--- a/internal/console/assets/scan-flags.json
+++ b/internal/console/assets/scan-flags.json
@@ -12,12 +12,6 @@
"defaultValue": "",
"usage": "path to configuration file"
},
- "disable-full-descriptions": {
- "flagType": "bool",
- "shorthandFlag": "",
- "defaultValue": "false",
- "usage": "disable request for full descriptions and use default vulnerability descriptions"
- },
"exclude-categories": {
"flagType": "multiStr",
"shorthandFlag": "",
diff --git a/internal/console/flags/scan_flags.go b/internal/console/flags/scan_flags.go
index e361fcf9a88..eccc8ce5f55 100644
--- a/internal/console/flags/scan_flags.go
+++ b/internal/console/flags/scan_flags.go
@@ -5,7 +5,6 @@ const (
BomFlag = "bom"
CloudProviderFlag = "cloud-provider"
ConfigFlag = "config"
- DisableFullDescFlag = "disable-full-descriptions"
ExcludeCategoriesFlag = "exclude-categories"
ExcludePathsFlag = "exclude-paths"
ExcludeQueriesFlag = "exclude-queries"
diff --git a/internal/console/scan.go b/internal/console/scan.go
index 9621ff911d0..833a85b8492 100644
--- a/internal/console/scan.go
+++ b/internal/console/scan.go
@@ -111,7 +111,6 @@ func updateReportFormats() {
func getScanParameters(changedDefaultQueryPath, changedDefaultLibrariesPath bool) *scan.Parameters {
scanParams := scan.Parameters{
CloudProvider: flags.GetMultiStrFlag(flags.CloudProviderFlag),
- DisableFullDesc: flags.GetBoolFlag(flags.DisableFullDescFlag),
ExcludeCategories: flags.GetMultiStrFlag(flags.ExcludeCategoriesFlag),
ExcludePaths: flags.GetMultiStrFlag(flags.ExcludePathsFlag),
ExcludeQueries: flags.GetMultiStrFlag(flags.ExcludeQueriesFlag),
diff --git a/internal/constants/constants.go b/internal/constants/constants.go
index 673f9c5b423..651d30228dc 100644
--- a/internal/constants/constants.go
+++ b/internal/constants/constants.go
@@ -96,6 +96,9 @@ const (
// URL - KICS url
URL = "https://www.kics.io/"
+ // GitHubReleasesURL - GitHub API URL to get the latest KICS release
+ GitHubReleasesURL = "https://api.github.com/repos/Checkmarx/kics/releases/latest"
+
// DefaultLogFile - logfile name
DefaultLogFile = "info.log"
diff --git a/pkg/descriptions/client.go b/pkg/descriptions/client.go
deleted file mode 100644
index c541f6555c0..00000000000
--- a/pkg/descriptions/client.go
+++ /dev/null
@@ -1,214 +0,0 @@
-package descriptions
-
-import (
- "bytes"
- "encoding/base64"
- "encoding/json"
- "fmt"
- "io"
- "net/http"
- "os"
- "time"
-
- "github.com/Checkmarx/kics/v2/internal/constants"
- descModel "github.com/Checkmarx/kics/v2/pkg/descriptions/model"
- "github.com/Checkmarx/kics/v2/pkg/model"
- "github.com/rs/zerolog/log"
-)
-
-var (
- // ***************************************************
- // * HARDCODED authKey is NOT FOR SECURITY PURPOSES *
- // ***************************************************
- authKey = []rune{67, 101, 110, 116, 101, 114, 95, 102, 111, 114, 95, 73, 110, 116, 101, 114, 110, 101,
- 116, 95, 83, 101, 99, 117, 114, 105, 116, 121, 95, 80, 114, 111, 112, 114, 105, 101, 116, 97, 114, 121,
- 95, 67, 111, 110, 116, 101, 110, 116, 95, 99, 105, 115, 101, 99, 117, 114, 105, 116, 121, 46, 111, 114, 103}
-
- tr = &http.Transport{
- Proxy: http.ProxyFromEnvironment,
- MaxIdleConns: 10,
- IdleConnTimeout: 30 * time.Second,
- DisableCompression: true,
- }
- // HTTPRequestClient - http client to use for requests
- HTTPRequestClient HTTPClient = &http.Client{
- Transport: tr,
- Timeout: 20 * time.Second,
- }
-)
-
-// HTTPClient - http client to use for requests
-type HTTPClient interface {
- Do(req *http.Request) (*http.Response, error)
-}
-
-// HTTPDescription - HTTP client interface to use for requesting descriptions
-type HTTPDescription interface {
- CheckConnection() error
- RequestDescriptions(descriptionIDs []string) (map[string]descModel.CISDescriptions, error)
- CheckLatestVersion(version string) (model.Version, error)
-}
-
-// Client - client for making descriptions requests
-type Client struct {
-}
-
-// CheckConnection - checks if the endpoint is reachable
-func (c *Client) CheckConnection() error {
- baseURL, err := getBaseURL()
- if err != nil {
- return err
- }
-
- endpointURL := fmt.Sprintf("%s/api/", baseURL)
- req, err := http.NewRequest(http.MethodGet, endpointURL, http.NoBody) //nolint
- if err != nil {
- return err
- }
-
- resp, err := doRequest(req)
- if err != nil {
- return err
- }
- defer func() {
- if closeErr := resp.Body.Close(); closeErr != nil {
- log.Err(closeErr).Msg("Error closing file")
- }
- }()
- return err
-}
-
-// CheckLatestVersion - Check if using KICS latest version from endpoint
-func (c *Client) CheckLatestVersion(version string) (model.Version, error) {
- baseURL, err := getBaseURL()
- if err != nil {
- return model.Version{}, err
- }
- endpointURL := fmt.Sprintf("%s/api/%s", baseURL, "version")
-
- versionRequest := descModel.VersionRequest{
- Version: version,
- }
-
- requestBody, err := json.Marshal(versionRequest)
- if err != nil {
- return model.Version{}, err
- }
-
- req, err := http.NewRequest(http.MethodPost, endpointURL, bytes.NewReader(requestBody)) //nolint
- if err != nil {
- return model.Version{}, err
- }
- req.Header.Add("Content-Type", "application/json")
- req.Header.Add("Authorization", fmt.Sprintf("Basic %s", base64.StdEncoding.EncodeToString([]byte(getBasicAuth()))))
-
- resp, err := doRequest(req)
- if err != nil {
- return model.Version{}, err
- }
- defer func() {
- if closeErr := resp.Body.Close(); closeErr != nil {
- log.Err(closeErr).Msg("Error closing file")
- }
- }()
-
- b, err := io.ReadAll(resp.Body)
- if err != nil {
- return model.Version{}, err
- }
-
- var VersionResponse model.Version
- err = json.Unmarshal(b, &VersionResponse)
- if err != nil {
- return model.Version{}, err
- }
-
- return VersionResponse, nil
-}
-
-// RequestDescriptions - gets descriptions from endpoint
-func (c *Client) RequestDescriptions(descriptionIDs []string) (map[string]descModel.CISDescriptions, error) {
- baseURL, err := getBaseURL()
- if err != nil {
- log.Debug().Msg("Unable to get baseURL")
- return nil, err
- }
-
- endpointURL := fmt.Sprintf("%s/api/%s", baseURL, "descriptions")
-
- descriptionRequest := descModel.DescriptionRequest{
- Version: constants.Version,
- DescriptionIDs: descriptionIDs,
- }
-
- requestBody, err := json.Marshal(descriptionRequest)
- if err != nil {
- log.Err(err).Msg("Unable to marshal request body")
- return nil, err
- }
-
- req, err := http.NewRequest(http.MethodPost, endpointURL, bytes.NewReader(requestBody)) //nolint
- if err != nil {
- return nil, err
- }
- req.Header.Add("Content-Type", "application/json")
- req.Header.Add("Authorization", fmt.Sprintf("Basic %s", base64.StdEncoding.EncodeToString([]byte(getBasicAuth()))))
-
- log.Debug().Msgf("HTTP POST to descriptions endpoint")
- startTime := time.Now()
- resp, err := doRequest(req)
- if err != nil {
- log.Err(err).Msgf("Unable to POST to descriptions endpoint")
- return nil, err
- }
- defer func() {
- if closeErr := resp.Body.Close(); closeErr != nil {
- log.Err(closeErr).Msg("Error closing file")
- }
- }()
- endTime := time.Since(startTime)
- log.Debug().Msgf("HTTP Status: %d %s %v", resp.StatusCode, http.StatusText(resp.StatusCode), endTime)
-
- b, err := io.ReadAll(resp.Body)
- if err != nil {
- log.Err(err).Msg("Unable to read response body")
- return nil, err
- }
-
- var getDescriptionsResponse descModel.DescriptionResponse
- err = json.Unmarshal(b, &getDescriptionsResponse)
- if err != nil {
- log.Err(err).Msg("Unable to unmarshal response body")
- return nil, err
- }
-
- return getDescriptionsResponse.Descriptions, nil
-}
-
-// doRequest - make HTTP request
-func doRequest(request *http.Request) (*http.Response, error) {
- return HTTPRequestClient.Do(request)
-}
-
-func getBaseURL() (string, error) {
- var rtnBaseURL string
- urlFromEnv := os.Getenv("KICS_DESCRIPTIONS_ENDPOINT")
- if constants.BaseURL == "" && urlFromEnv == "" {
- return "", fmt.Errorf("the BaseURL or KICS_DESCRIPTIONS_ENDPOINT environment variable not set")
- }
-
- if urlFromEnv != "" {
- rtnBaseURL = urlFromEnv
- } else {
- rtnBaseURL = constants.BaseURL
- }
- return rtnBaseURL, nil
-}
-
-func getBasicAuth() string {
- auth := os.Getenv("KICS_BASIC_AUTH_PASS")
- if auth == "" {
- auth = string(authKey)
- }
- return auth
-}
diff --git a/pkg/descriptions/client_test.go b/pkg/descriptions/client_test.go
deleted file mode 100644
index ef94d17a26f..00000000000
--- a/pkg/descriptions/client_test.go
+++ /dev/null
@@ -1,132 +0,0 @@
-package descriptions
-
-import (
- "bytes"
- "encoding/json"
- "io/ioutil"
- "net/http"
- "os"
- "testing"
-
- mockclient "github.com/Checkmarx/kics/v2/pkg/descriptions/mock"
- "github.com/stretchr/testify/require"
-)
-
-var (
- responseJSON = `{
- "descriptions": {
- "foo1": {
- "cisDescriptionText": "",
- "cisDescriptionID": "",
- "cisDescriptionRuleID": "",
- "cisDescriptionTitle": "",
- "cisRationaleText": "",
- "cisBenchmarkName": "",
- "cisBenchmarkVersion": ""
- },
- "foo2": {
- "cisDescriptionText": "",
- "cisDescriptionID": "",
- "cisDescriptionRuleID": "",
- "cisDescriptionTitle": "",
- "cisRationaleText": "",
- "cisBenchmarkName": "",
- "cisBenchmarkVersion": ""
- }
- }
- }`
-)
-
-func TestClient_RequestDescriptions(t *testing.T) {
- os.Setenv("KICS_DESCRIPTIONS_ENDPOINT", "http://example.com")
- HTTPRequestClient = &mockclient.MockHTTPClient{}
- mockclient.GetDoFunc = func(request *http.Request) (*http.Response, error) {
- if request.Method == http.MethodGet {
- r := ioutil.NopCloser(bytes.NewReader([]byte("KICS DESCRIPTIONS API")))
- return &http.Response{
- StatusCode: 200,
- Body: r,
- }, nil
- }
-
- r := ioutil.NopCloser(bytes.NewReader([]byte(responseJSON)))
- return &http.Response{
- StatusCode: 200,
- Body: r,
- }, nil
- }
- descClient := Client{}
- descriptions, err := descClient.RequestDescriptions([]string{
- "foo1",
- "foo2",
- "foo3",
- })
- require.NoError(t, err, "RequestDescriptions() should not return an error")
- require.NotNil(t, descriptions, "RequestDescriptions() should return a description map")
- t.Cleanup(func() {
- os.Setenv("KICS_DESCRIPTIONS_ENDPOINT", "")
- })
-}
-
-func TestClient_post(t *testing.T) {
- HTTPRequestClient = &mockclient.MockHTTPClient{}
- mockclient.GetDoFunc = func(*http.Request) (*http.Response, error) {
- r := ioutil.NopCloser(bytes.NewReader([]byte(responseJSON)))
- return &http.Response{
- StatusCode: 200,
- Body: r,
- }, nil
- }
- headers := map[string]string{
- "Content-Type": "application/json",
- }
- requestBody := mockclient.MockRequestBody{
- Descriptions: []string{
- "foo1",
- "foo2",
- "foo3",
- },
- }
-
- jsonBytes, err := json.Marshal(requestBody)
- require.NoError(t, err, "Marshaling request body should not return an error")
-
- request, err := http.NewRequest(http.MethodPost, "http://example.com", bytes.NewReader(jsonBytes))
- require.NoError(t, err, "Creating request should not return an error")
-
- for key, value := range headers {
- request.Header.Add(key, value)
- }
- response, err := doRequest(request)
- require.NoError(t, err, "post() should not return an error")
- defer response.Body.Close()
- require.NotNil(t, response, "post() should return a response")
- require.Equal(t, 200, response.StatusCode, "post() should return a 200 response")
-}
-
-func TestClient_CheckLatestVersion(t *testing.T) {
- os.Setenv("KICS_DESCRIPTIONS_ENDPOINT", "http://example.com")
- HTTPRequestClient = &mockclient.MockHTTPClient{}
- mockclient.GetDoFunc = func(request *http.Request) (*http.Response, error) {
- if request.Method == http.MethodGet {
- r := ioutil.NopCloser(bytes.NewReader([]byte("KICS DESCRIPTIONS API")))
- return &http.Response{
- StatusCode: 200,
- Body: r,
- }, nil
- }
-
- r := ioutil.NopCloser(bytes.NewReader([]byte(responseJSON)))
- return &http.Response{
- StatusCode: 200,
- Body: r,
- }, nil
- }
- descClient := Client{}
- version, err := descClient.CheckLatestVersion("1.4.0")
- require.NoError(t, err, "CheckLatestVersion() should not return an error")
- require.NotNil(t, version, "CheckLatestVersion() should return a version check")
- t.Cleanup(func() {
- os.Setenv("KICS_DESCRIPTIONS_ENDPOINT", "")
- })
-}
diff --git a/pkg/descriptions/descriptions.go b/pkg/descriptions/descriptions.go
deleted file mode 100644
index 89a80909428..00000000000
--- a/pkg/descriptions/descriptions.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package descriptions
-
-import (
- "fmt"
-
- "github.com/Checkmarx/kics/v2/pkg/model"
-)
-
-var (
- descClient HTTPDescription = &Client{}
-)
-
-// RequestAndOverrideDescriptions - Requests descriptions and override default descriptions
-func RequestAndOverrideDescriptions(summary *model.Summary) error {
- descriptionIDs := make([]string, 0)
- for idx := range summary.Queries {
- descriptionIDs = append(descriptionIDs, summary.Queries[idx].DescriptionID)
- }
-
- if err := descClient.CheckConnection(); err != nil {
- return err
- }
-
- descriptionMap, err := descClient.RequestDescriptions(descriptionIDs)
- if err != nil {
- return err
- }
-
- for idx := range summary.Queries {
- if descriptionMap[summary.Queries[idx].DescriptionID].DescriptionID == "" &&
- descriptionMap[summary.Queries[idx].DescriptionID].RationaleText == "" {
- continue
- }
- descriptionID := summary.Queries[idx].DescriptionID
-
- summary.Queries[idx].CISDescriptionID = descriptionMap[descriptionID].DescriptionID
- summary.Queries[idx].CISDescriptionTitle = descriptionMap[descriptionID].DescriptionTitle
- summary.Queries[idx].CISDescriptionText = descriptionMap[descriptionID].DescriptionText
- summary.Queries[idx].CISRationaleText = descriptionMap[descriptionID].RationaleText
- summary.Queries[idx].CISBenchmarkName = descriptionMap[descriptionID].BenchmarkName
- summary.Queries[idx].CISBenchmarkVersion = descriptionMap[descriptionID].BenchmarkVersion
-
- summary.Queries[idx].CISDescriptionIDFormatted = fmt.Sprintf(
- "Security - %s v%s - Rule %s",
- descriptionMap[descriptionID].BenchmarkName,
- descriptionMap[descriptionID].BenchmarkVersion,
- descriptionMap[descriptionID].DescriptionID,
- )
- summary.Queries[idx].CISDescriptionTextFormatted = fmt.Sprintf(
- "%s\n%s",
- descriptionMap[descriptionID].DescriptionText,
- descriptionMap[descriptionID].RationaleText,
- )
- }
- return nil
-}
diff --git a/pkg/descriptions/descriptions_test.go b/pkg/descriptions/descriptions_test.go
deleted file mode 100644
index b3c463ca69f..00000000000
--- a/pkg/descriptions/descriptions_test.go
+++ /dev/null
@@ -1,80 +0,0 @@
-package descriptions
-
-import (
- "os"
- "testing"
-
- mockclient "github.com/Checkmarx/kics/v2/pkg/descriptions/mock"
- "github.com/Checkmarx/kics/v2/pkg/descriptions/model"
- "github.com/Checkmarx/kics/v2/test"
- "github.com/stretchr/testify/require"
-)
-
-func TestRequestAndOverrideDescriptions_NoBaseURL(t *testing.T) {
- mock := test.SummaryMock
- descClient = &mockclient.MockDescriptionsClient{}
- mockclient.CheckConnection = func() error {
- return nil
- }
- mockclient.GetDescriptions = func(descriptionIDs []string) (map[string]model.CISDescriptions, error) {
- return map[string]model.CISDescriptions{
- "504b1d43": {
- DescriptionID: "1",
- DescriptionTitle: "my title",
- RationaleText: "my rattionale",
- },
- }, nil
- }
- err := RequestAndOverrideDescriptions(&mock)
- require.NoError(t, err, "Expected error")
- for _, query := range mock.Queries {
- if query.DescriptionID == "504b1d43" {
- require.Equal(t, "my title", query.CISDescriptionTitle, "Expected description to be equal")
- }
- }
-}
-
-func Test_CheckConnection(t *testing.T) {
- tests := []struct {
- name string
- setVar bool
- varValue string
- expectedError bool
- }{
- {
- name: "no env var set",
- setVar: false,
- expectedError: true,
- },
- {
- name: "dummy env var set",
- setVar: true,
- varValue: "http://example.com",
- expectedError: false,
- },
- {
- name: "valid env var set",
- setVar: true,
- varValue: "http://kics.io",
- expectedError: false,
- },
- }
-
- envVarName := "KICS_DESCRIPTIONS_ENDPOINT"
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- os.Unsetenv(envVarName)
- if tt.setVar {
- os.Setenv(envVarName, tt.varValue)
- }
- c := Client{}
- err := c.CheckConnection()
- if tt.expectedError {
- require.Error(t, err)
- } else {
- require.NoError(t, err)
- }
- })
- }
-}
diff --git a/pkg/descriptions/mock/client_mock.go b/pkg/descriptions/mock/client_mock.go
deleted file mode 100644
index 0830ab9e324..00000000000
--- a/pkg/descriptions/mock/client_mock.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package mockclient
-
-import (
- "net/http"
-
- "github.com/Checkmarx/kics/v2/pkg/descriptions/model"
- genModel "github.com/Checkmarx/kics/v2/pkg/model"
-)
-
-// MockHTTPClient - the mock http client
-type MockHTTPClient struct {
- DoFunc func(req *http.Request) (*http.Response, error)
-}
-
-// Do - mock clients do function
-func (m *MockHTTPClient) Do(req *http.Request) (*http.Response, error) {
- return GetDoFunc(req)
-}
-
-// MockDescriptionsClient - the mock descriptions client
-type MockDescriptionsClient struct {
- RequestDescriptionsFunc func(descriptionIDs []string) (map[string]model.CISDescriptions, error)
-}
-
-// RequestDescriptions - mock descriptions client request descriptions function
-func (m *MockDescriptionsClient) RequestDescriptions(descriptionIDs []string) (map[string]model.CISDescriptions, error) {
- return GetDescriptions(descriptionIDs)
-}
-
-// CheckConnection - mock descriptions client check connection function
-func (m *MockDescriptionsClient) CheckConnection() error {
- return CheckConnection()
-}
-
-// CheckLatestVersion - mock client request version function
-func (m *MockDescriptionsClient) CheckLatestVersion(version string) (genModel.Version, error) {
- return CheckVersion(version)
-}
-
-var (
- // GetDoFunc - mock client's `Do` func
- GetDoFunc func(req *http.Request) (*http.Response, error)
- // CheckConnection - mock client's `CheckConnection` func
- CheckConnection func() error
- // GetDescriptions - mock client's `RequestDescriptions` func
- GetDescriptions func(descriptionIDs []string) (map[string]model.CISDescriptions, error)
- // CheckVersion mock client's `CheckLatestVersion` func
- CheckVersion func(version string) (genModel.Version, error)
-)
-
-// MockRequestBody - mock request body
-type MockRequestBody struct {
- Descriptions []string `json:"descriptions"`
-}
-
-// MockResponseBody - mock response body
-type MockResponseBody struct {
- Descriptions map[string]string `json:"descriptions"`
-}
diff --git a/pkg/descriptions/model/model.go b/pkg/descriptions/model/model.go
deleted file mode 100644
index 6e447687a17..00000000000
--- a/pkg/descriptions/model/model.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package model
-
-// DescriptionRequest - is the model for the description request
-type DescriptionRequest struct {
- DescriptionIDs []string `json:"descriptions"`
- Version string `json:"version"`
-}
-
-// CISDescriptions - is the model for the description response
-type CISDescriptions struct {
- DescriptionID string `json:"cisDescriptionRuleID"`
- DescriptionTitle string `json:"cisDescriptionTitle"`
- DescriptionText string `json:"cisDescriptionText"`
- RationaleText string `json:"cisRationaleText"`
- BenchmarkName string `json:"cisBenchmarkName"`
- BenchmarkVersion string `json:"cisBenchmarkVersion"`
-}
-
-// DescriptionResponse - is the model for the description response
-type DescriptionResponse struct {
- ID string `json:"RequestID"`
- Descriptions map[string]CISDescriptions `json:"Descriptions"`
- Timestamp string `json:"Timestamp"`
-}
-
-// VersionRequest - is the model for the version request
-type VersionRequest struct {
- Version string `json:"version"`
-}
diff --git a/pkg/descriptions/version.go b/pkg/descriptions/version.go
deleted file mode 100644
index c7b46875761..00000000000
--- a/pkg/descriptions/version.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package descriptions
-
-import (
- "github.com/Checkmarx/kics/v2/internal/constants"
- "github.com/Checkmarx/kics/v2/internal/tracker"
- "github.com/Checkmarx/kics/v2/pkg/model"
-)
-
-// CheckVersion - checks if using the latest version and saves that information in the tracker
-func CheckVersion(t *tracker.CITracker) {
- baseVersionInfo := model.Version{
- Latest: true,
- }
-
- if err := descClient.CheckConnection(); err != nil {
- t.TrackVersion(baseVersionInfo)
- return
- }
-
- versionInfo, err := descClient.CheckLatestVersion(constants.Version)
- if err != nil {
- t.TrackVersion(baseVersionInfo)
- return
- }
-
- t.TrackVersion(versionInfo)
-}
diff --git a/pkg/descriptions/version_test.go b/pkg/descriptions/version_test.go
deleted file mode 100644
index 1f65877296c..00000000000
--- a/pkg/descriptions/version_test.go
+++ /dev/null
@@ -1,51 +0,0 @@
-package descriptions
-
-import (
- "errors"
- "testing"
-
- "github.com/Checkmarx/kics/v2/internal/tracker"
- mockclient "github.com/Checkmarx/kics/v2/pkg/descriptions/mock"
- "github.com/Checkmarx/kics/v2/pkg/model"
- "github.com/stretchr/testify/require"
-)
-
-func TestDescriptions_CheckVersion(t *testing.T) {
- mt := &tracker.CITracker{}
- descClient = &mockclient.MockDescriptionsClient{}
- mockclient.CheckConnection = func() error {
- return nil
- }
- mockclient.CheckVersion = func(version string) (model.Version, error) {
- return model.Version{
- Latest: false,
- LatestVersionTag: "1.4.5",
- }, nil
- }
-
- want := model.Version{
- Latest: false,
- LatestVersionTag: "1.4.5",
- }
-
- CheckVersion(mt)
- require.Equal(t, want, mt.Version)
-
- mockclient.CheckVersion = func(version string) (model.Version, error) {
- return model.Version{}, errors.New("Check version mock error")
- }
-
- want = model.Version{
- Latest: true,
- }
-
- CheckVersion(mt)
- require.Equal(t, want, mt.Version)
-
- mockclient.CheckConnection = func() error {
- return errors.New("Check connection mock error")
- }
-
- CheckVersion(mt)
- require.Equal(t, want, mt.Version)
-}
diff --git a/pkg/scan/client.go b/pkg/scan/client.go
index 47377ef3283..4f444a600e5 100644
--- a/pkg/scan/client.go
+++ b/pkg/scan/client.go
@@ -2,21 +2,28 @@ package scan
import (
"context"
+ "encoding/json"
+ "io"
+ "net/http"
"time"
"github.com/rs/zerolog/log"
+ "github.com/Checkmarx/kics/v2/internal/constants"
"github.com/Checkmarx/kics/v2/internal/storage"
"github.com/Checkmarx/kics/v2/internal/tracker"
- "github.com/Checkmarx/kics/v2/pkg/descriptions"
+ "github.com/Checkmarx/kics/v2/pkg/model"
consolePrinter "github.com/Checkmarx/kics/v2/pkg/printer"
"github.com/Checkmarx/kics/v2/pkg/progress"
)
+var versionHTTPClient = &http.Client{
+ Timeout: 20 * time.Second,
+}
+
// Parameters represents all available scan parameters
type Parameters struct {
CloudProvider []string
- DisableFullDesc bool
ExcludeCategories []string
ExcludePaths []string
ExcludeQueries []string
@@ -73,7 +80,7 @@ func NewClient(params *Parameters, proBarBuilder *progress.PbBuilder, customPrin
return nil, err
}
- descriptions.CheckVersion(t)
+ CheckVersion(t)
store := storage.NewMemoryStorage()
@@ -89,6 +96,47 @@ func NewClient(params *Parameters, proBarBuilder *progress.PbBuilder, customPrin
}, nil
}
+func CheckVersion(t *tracker.CITracker) {
+ baseVersionInfo := model.Version{Latest: true}
+
+ if constants.Version == "development" {
+ t.TrackVersion(baseVersionInfo)
+ return
+ }
+
+ resp, err := versionHTTPClient.Get(constants.GitHubReleasesURL)
+
+ if err != nil {
+ t.TrackVersion(baseVersionInfo)
+ return
+ }
+ defer resp.Body.Close()
+
+ if resp.StatusCode == http.StatusNotFound {
+ t.TrackVersion(baseVersionInfo)
+ return
+ }
+
+ b, err := io.ReadAll(resp.Body)
+ if err != nil {
+ t.TrackVersion(baseVersionInfo)
+ return
+ }
+
+ var release struct {
+ TagName string `json:"tag_name"`
+ }
+ if err := json.Unmarshal(b, &release); err != nil {
+ t.TrackVersion(baseVersionInfo)
+ return
+ }
+
+ t.TrackVersion(model.Version{
+ Latest: constants.Version == release.TagName,
+ LatestVersionTag: release.TagName,
+ })
+}
+
// PerformScan executes executeScan and postScan
func (c *Client) PerformScan(ctx context.Context) error {
c.ScanStartTime = time.Now()
diff --git a/pkg/scan/post_scan.go b/pkg/scan/post_scan.go
index 4912f699d8b..27a4a642fa9 100644
--- a/pkg/scan/post_scan.go
+++ b/pkg/scan/post_scan.go
@@ -2,6 +2,8 @@ package scan
import (
_ "embed" // Embed kics CLI img and scan-flags
+ // "encoding/json"
+ // "fmt"
"os"
"path/filepath"
"sort"
@@ -9,7 +11,6 @@ import (
"time"
consoleHelpers "github.com/Checkmarx/kics/v2/internal/console/helpers"
- "github.com/Checkmarx/kics/v2/pkg/descriptions"
"github.com/Checkmarx/kics/v2/pkg/engine/provider"
"github.com/Checkmarx/kics/v2/pkg/model"
consolePrinter "github.com/Checkmarx/kics/v2/pkg/printer"
@@ -36,16 +37,6 @@ func (c *Client) getSummary(results []model.Vulnerability, end time.Time, pathPa
End: end,
}
- if c.ScanParams.DisableFullDesc {
- log.Warn().Msg("Skipping descriptions because provided disable flag is set")
- } else {
- err := descriptions.RequestAndOverrideDescriptions(&summary)
- if err != nil {
- log.Warn().Msgf("Unable to get descriptions: %s", err)
- log.Warn().Msgf("Using default descriptions")
- }
- }
-
return summary
}
diff --git a/pkg/scan/post_scan_test.go b/pkg/scan/post_scan_test.go
index 362e63223f7..535d69cc11b 100644
--- a/pkg/scan/post_scan_test.go
+++ b/pkg/scan/post_scan_test.go
@@ -41,9 +41,7 @@ func Test_GetSummary(t *testing.T) {
LatestVersionTag: "Dev",
},
},
- scanParameters: Parameters{
- DisableFullDesc: false,
- },
+ scanParameters: Parameters{},
results: []model.Vulnerability{
{
ScanID: "console",
diff --git a/pkg/scan/utils.go b/pkg/scan/utils.go
index 1248cc3a37b..1b640dd0dbf 100644
--- a/pkg/scan/utils.go
+++ b/pkg/scan/utils.go
@@ -242,10 +242,9 @@ func usingCustomQueries(queriesPath []string) bool {
// printVersionCheck - Prints and logs warning if not using KICS latest version
func printVersionCheck(customPrint *consolePrinter.Printer, s *model.Summary) {
if !s.LatestVersion.Latest {
- message := fmt.Sprintf("A new version 'v%s' of KICS is available, please consider updating", s.LatestVersion.LatestVersionTag)
+ message := fmt.Sprintf("A new version '%s' of KICS is available, please consider updating", s.LatestVersion.LatestVersionTag)
fmt.Println(customPrint.VersionMessage.Sprintf("%s", message))
- log.Warn().Msgf("%s", message)
}
}