Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add vuln #2

Merged
merged 34 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .circleci/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2.1
jobs:
kics:
docker:
- image: arturribeirocx/kics:testecritical
steps:
- checkout
- run:
name: Run KICS
command: |
/app/bin/kics scan -p ${PWD} -o ${PWD} --ci
- store_artifacts:
path: ${PWD}/results.json

workflows:
version: 2
build:
jobs:
- kics
11 changes: 5 additions & 6 deletions .github/workflows/kics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: scan with KICS and upload SARIF

on:
pull_request:
branches: [master]
branches: [main]

jobs:
kics-job:
Expand All @@ -15,18 +15,17 @@ jobs:
# make sure results dir is created
run: mkdir -p results-dir
- name: Run KICS Scan with SARIF result
uses: checkmarx/kics-github-action@v1.7.0
uses: cxMiguelSilva/kics-github-action@TestConfigV6.23
with:
path: 'terraform'
path: vulns
# when provided with a directory on output_path
# it will generate the specified reports file named 'results.{extension}'
# in this example it will generate:
# - results-dir/results.json
# - results-dir/results.sarif
output_path: results-dir
platform_type: terraform
config_path: vulns/config
output_formats: 'json,sarif'
exclude_paths: "terraform/gcp/big_data.tf,terraform/azure"
ignore_on_exit: results
# seek query id in it's metadata.json
exclude_queries: 0437633b-daa6-4bbc-8526-c0d2443b946e
- name: Show results
Expand Down
1 change: 1 addition & 0 deletions positive.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ WORKDIR /app
ONBUILD COPY . /app
ONBUILD RUN virtualenv /env && /env/bin/pip install -r /app/requirements.txt
EXPOSE 8080
EXPOSE 8081
CMD ["/env/bin/python", "main.py"]
7 changes: 7 additions & 0 deletions vulns/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"path" = "assets/iac_samples"
"verbose" = true
"log-file" = true
"type" = "Dockerfile,Kubernetes"
"queries-path" = "assets/queries"
"exclude-paths" = ["foo/", "bar/"]
"output-name" = "results-demo.testcoiso"
8 changes: 8 additions & 0 deletions vulns/configs/hcl/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"path" = "assets/iac_samples"
"verbose" = true
"log-file" = true
"type" = "Dockerfile,Kubernetes"
"queries-path" = "assets/queries"
"exclude-paths" = ["foo/", "bar/"]
"output-path" = "results"
"output-name" = "res.json"
13 changes: 13 additions & 0 deletions vulns/configs/json/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"path": "assets/iac_samples",
"verbose": true,
"log-file": true,
"type": "Dockerfile,Kubernetes",
"queries-path": "assets/queries",
"exclude-paths": [
"foo/",
"bar/"
],
"output-path": "results",
"output-name": "res.json"
}
8 changes: 8 additions & 0 deletions vulns/configs/toml/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
path = "assets/iac_samples"
verbose = true
log-file = true
type = "Dockerfile,Kubernetes"
queries-path = "assets/queries"
exclude-paths = [ "foo/", "bar/" ]
output-path = "results"
output-name = "res.json"
13 changes: 13 additions & 0 deletions vulns/configs/yaml/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
path: assets/iac_samples
verbose: true
log-file: true
type:
- Dockerfile
- Kubernetes
queries-path: assets/queries
exclude-paths:
- foo/
- bar/
output-path: results
output-name: res.json
8 changes: 8 additions & 0 deletions vulns/positive.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM gliderlabs/alpine:3.3

Check warning on line 1 in vulns/positive.dockerfile

View workflow job for this annotation

GitHub Actions / kics-action

[HIGH] Missing User Instruction

A user should be specified in the dockerfile, otherwise the image will run as root

Check warning on line 1 in vulns/positive.dockerfile

View workflow job for this annotation

GitHub Actions / kics-action

[LOW] Healthcheck Instruction Missing

Ensure that HEALTHCHECK is being used. The HEALTHCHECK instruction tells Docker how to test a container to check that it is still working

Check failure

Code scanning / KICS

Missing User Instruction Error

The 'Dockerfile' does not contain any 'USER' instruction

Check notice

Code scanning / KICS

Healthcheck Instruction Missing Note

Dockerfile doesn't contain instruction 'HEALTHCHECK'
RUN apk add --update-cache python

Check warning on line 2 in vulns/positive.dockerfile

View workflow job for this annotation

GitHub Actions / kics-action

[MEDIUM] Unpinned Package Version in Apk Add

Package version pinning reduces the range of versions that can be installed, reducing the chances of failure due to unanticipated changes

Check warning on line 2 in vulns/positive.dockerfile

View workflow job for this annotation

GitHub Actions / kics-action

[INFO] Apk Add Using Local Cache Path

When installing packages, use the '--no-cache' switch to avoid the need to use '--update' and remove '/var/cache/apk/*'

Check warning

Code scanning / KICS

Unpinned Package Version in Apk Add Warning

RUN instruction apk add --update-cache python does not use package pinning form

Check notice

Code scanning / KICS

Apk Add Using Local Cache Path

'RUN' contains 'apk add' command without '--no-cache' switch
WORKDIR /app
ONBUILD COPY . /app
ONBUILD RUN virtualenv /env && /env/bin/pip install -r /app/requirements.txt
EXPOSE 8080
EXPOSE 8081
CMD ["/env/bin/python", "main.py"]
8 changes: 8 additions & 0 deletions vulns/positive2.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM gliderlabs/alpine:3.3

Check warning on line 1 in vulns/positive2.dockerfile

View workflow job for this annotation

GitHub Actions / kics-action

[HIGH] Missing User Instruction

A user should be specified in the dockerfile, otherwise the image will run as root

Check warning on line 1 in vulns/positive2.dockerfile

View workflow job for this annotation

GitHub Actions / kics-action

[LOW] Healthcheck Instruction Missing

Ensure that HEALTHCHECK is being used. The HEALTHCHECK instruction tells Docker how to test a container to check that it is still working

Check failure

Code scanning / KICS

Missing User Instruction Error

The 'Dockerfile' does not contain any 'USER' instruction

Check notice

Code scanning / KICS

Healthcheck Instruction Missing Note

Dockerfile doesn't contain instruction 'HEALTHCHECK'
RUN apk add --update-cache python

Check warning on line 2 in vulns/positive2.dockerfile

View workflow job for this annotation

GitHub Actions / kics-action

[MEDIUM] Unpinned Package Version in Apk Add

Package version pinning reduces the range of versions that can be installed, reducing the chances of failure due to unanticipated changes

Check warning on line 2 in vulns/positive2.dockerfile

View workflow job for this annotation

GitHub Actions / kics-action

[INFO] Apk Add Using Local Cache Path

When installing packages, use the '--no-cache' switch to avoid the need to use '--update' and remove '/var/cache/apk/*'

Check warning

Code scanning / KICS

Unpinned Package Version in Apk Add Warning

RUN instruction apk add --update-cache python does not use package pinning form

Check notice

Code scanning / KICS

Apk Add Using Local Cache Path

'RUN' contains 'apk add' command without '--no-cache' switch
WORKDIR /app
ONBUILD COPY . /app
ONBUILD RUN virtualenv /env; \
/env/bin/pip install -r /app/requirements.txt
EXPOSE 8080
CMD ["/env/bin/python", "main.py"]
Loading