-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into joaom/kics-1163
- Loading branch information
Showing
15 changed files
with
287 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
assets/queries/openAPI/general/api_key_exposed_in_global_security/test/negative5.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
openapi: "3.0.1" | ||
info: | ||
title: "test" | ||
version: "1.0" | ||
servers: | ||
- url: "https://@API-GW-ID.execute-api.us-east-1.amazonaws.com/{basePath}" | ||
variables: | ||
basePath: | ||
default: "/api" | ||
|
||
paths: | ||
/address: | ||
get: | ||
summary: test | ||
description: test | ||
responses: | ||
'200': | ||
description: test | ||
content: | ||
text/plain: | ||
schema: | ||
type: string | ||
|
||
security: | ||
- authorizer: [ ] | ||
|
||
components: | ||
securitySchemes: | ||
authorizer: | ||
type: "apiKey" | ||
name: "authorization" | ||
in: "header" |
32 changes: 32 additions & 0 deletions
32
assets/queries/openAPI/general/api_key_exposed_in_operation_security/test/negative5.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
openapi: "3.0.1" | ||
info: | ||
title: "test" | ||
version: "1.0" | ||
servers: | ||
- url: "https://@API-GW-ID.execute-api.us-east-1.amazonaws.com/{basePath}" | ||
variables: | ||
basePath: | ||
default: "/api" | ||
|
||
paths: | ||
/address: | ||
get: | ||
summary: test | ||
description: test | ||
security: | ||
- apiKey1: [ ] | ||
- authorizer: [ ] | ||
responses: | ||
'200': | ||
description: test | ||
content: | ||
text/plain: | ||
schema: | ||
type: string | ||
|
||
components: | ||
securitySchemes: | ||
authorizer: | ||
type: "apiKey" | ||
name: "authorization" | ||
in: "header" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
{ | ||
"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": 49, | ||
"queries_failed_to_execute": 1, | ||
"queries_failed_to_compute_similarity_id": 0, | ||
"scan_id": "console", | ||
"severity_counters": { | ||
"HIGH": 1, | ||
"INFO": 0, | ||
"LOW": 1, | ||
"MEDIUM": 1, | ||
"TRACE": 0 | ||
}, | ||
"total_counter": 3, | ||
"total_bom_resources": 0, | ||
"start": "2023-10-15T09:20:54.322549843Z", | ||
"end": "2023-10-15T09:20:57.878486637Z", | ||
"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", | ||
"category": "Build Process", | ||
"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", | ||
"category": "Supply-Chain", | ||
"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", | ||
"category": "Insecure Configurations", | ||
"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'" | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Package testcases provides end-to-end (E2E) testing functionality for the application. | ||
package testcases | ||
|
||
// E2E-CLI-068 - KICS scan but recover from corrupted dockerfile | ||
// should perform the scan successfully and return exit code 50 | ||
func init() { //nolint | ||
testSample := TestCase{ | ||
Name: "should perform a valid scan and recover from a corrupted dockerfile [E2E-CLI-068]", | ||
Args: args{ | ||
Args: []cmdArgs{ | ||
[]string{"scan", "-o", "/path/e2e/output", "--output-name", "E2E_CLI_068_RESULT", | ||
"-p", "/path/test/fixtures/dockerfile/corrupted_dockerfile", | ||
}, | ||
}, | ||
ExpectedResult: []ResultsValidation{ | ||
{ | ||
ResultsFile: "E2E_CLI_068_RESULT", | ||
ResultsFormats: []string{"json"}, | ||
}, | ||
}, | ||
}, | ||
WantStatus: []int{50}, | ||
} | ||
|
||
Tests = append(Tests, testSample) | ||
} |
Oops, something went wrong.