Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file added .DS_Store
Binary file not shown.
36 changes: 5 additions & 31 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,33 +1,7 @@
# Local .terraform directories
**/.terraform/*
.idea
# Ignore npm installed packages
/node_modules

# .tfstate files
*.tfstate
*.tfstate.*
# Ignore coverage reports
/coverage

# Crash log files
crash.log

# Ignore any .tfvars files that are generated automatically for each Terraform run. Most
# .tfvars files are managed as part of configuration and so should be included in
# version control.
#
# example.tfvars

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json
credentials.json
*.tfbackend
*.tfvars

# Include override files you do wish to add to version control using negated pattern
#
# !example_override.tf

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*
.idea
30 changes: 30 additions & 0 deletions ansible/blocks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---

- name: Verify tests
hosts: all
gather_facts: False
tasks:
- name: Install, configure, and start Apache
block:
- name: Install httpd and memcached

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MEDIUM  SSL validation is disabled with yum
    Resource: tasks.block.ansible.builtin.yum.Install httpd and memcached | Checkov ID: CKV_ANSIBLE_4

Description

This policy detects whether Ansible yum tasks have SSL validation disabled. Disabling SSL validation can significantly increase security risks as it allows the system to accept potentially compromised SSL certificates without verification. This could result in exposing the system to potential man-in-the-middle attacks.

ansible.builtin.yum:
name:
- httpd
- memcached
sslverify: False
state: latest

- name: Apply the foo config template
ansible.builtin.template:
src: templates/src.j2
dest: /etc/foo.conf

- name: Start service bar and enable it
ansible.builtin.service:
name: bar
state: started
enabled: True
when: ansible_facts['distribution'] == 'CentOS'
become: true
become_user: root
ignore_errors: true
29 changes: 29 additions & 0 deletions ansible/fail.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
- name: Verify tests
hosts: all
gather_facts: False
tasks:
- name: Install, configure, and start Apache
block:
- name: Install httpd and memcached

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MEDIUM  SSL validation is disabled with yum
    Resource: tasks.block.ansible.builtin.yum.Install httpd and memcached | Checkov ID: CKV_ANSIBLE_4

Description

This policy detects whether Ansible yum tasks have SSL validation disabled. Disabling SSL validation can significantly increase security risks as it allows the system to accept potentially compromised SSL certificates without verification. This could result in exposing the system to potential man-in-the-middle attacks.

ansible.builtin.yum:
name:
- httpd
- memcached
sslverify: False
state: latest

- name: Apply the foo config template
ansible.builtin.template:
src: templates/src.j2
dest: /etc/foo.conf

- name: Start service bar and enable it
ansible.builtin.service:
name: bar
state: started
enabled: True
when: ansible_facts['distribution'] == 'CentOS'
become: true
become_user: root
ignore_errors: true
Binary file added ansible/k8s_utf16.yaml
Binary file not shown.
34 changes: 34 additions & 0 deletions ansible/nested_blocks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---

- name: Verify tests
hosts: all
gather_facts: False
tasks:
- name: 1st level block
block:
- name: 2nd level block
block:
- name: 3rd level block
block:
- name: 4th level block
block:
- name: 5th level block
block:
- name: 6th level uri
ansible.builtin.uri:
url: https://www.example.com
- name: 5th level uri
ansible.builtin.uri:
url: https://www.example.com
- name: 4th level uri
ansible.builtin.uri:
url: https://www.example.com
- name: 3rd level uri
ansible.builtin.uri:
url: https://www.example.com
- name: 2nd level uri
ansible.builtin.uri:
url: https://www.example.com
- name: 1st level uri
ansible.builtin.uri:
url: https://www.example.com
7 changes: 7 additions & 0 deletions ansible/no_tasks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---

- name: Sample play
hosts:
- test
roles:
- role: somerole
21 changes: 21 additions & 0 deletions ansible/site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---

- name: Verify tests
hosts: all
gather_facts: False
tasks:
- name: Get Running instance Info
amazon.aws.ec2_instance_info:
register: ec2info

- name: enabled

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HIGH  AWS EC2 instances with public IP and associated with security groups have Internet access
    Resource: tasks.amazon.aws.ec2_instance.enabled | Checkov ID: CKV_AWS_88

Description

A public IP address is an IPv4 address that is reachable from the Internet.
You can use public addresses for communication between your instances and the Internet.
Each instance that receives a public IP address is also given an external DNS hostname.
We recommend you control whether your instance receives a public IP address as required.

amazon.aws.ec2_instance:
name: "public-compute-instance"
key_name: "prod-ssh-key"
vpc_subnet_id: subnet-5ca1ab1e
instance_type: c5.large
security_group: default
network:
assign_public_ip: true
image_id: ami-123456
ebs_optimized: true
31 changes: 31 additions & 0 deletions ansible/skip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
- hosts: localhost
gather_facts: false
tasks:
- name: Launch ec2 instances 1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HIGH  AWS EC2 instances with public IP and associated with security groups have Internet access
    Resource: tasks.amazon.aws.ec2_instance.Launch ec2 instances 1 | Checkov ID: CKV_AWS_88

Description

A public IP address is an IPv4 address that is reachable from the Internet.
You can use public addresses for communication between your instances and the Internet.
Each instance that receives a public IP address is also given an external DNS hostname.
We recommend you control whether your instance receives a public IP address as required.

#checkov:skip=CKV_AWS_135
amazon.aws.ec2_instance:
name: "bc-office-hours"
vpc_subnet_id: subnet-012d94ee641ab4277
instance_type: t3.micro
security_group: sg-04acc4e02a5b71244
image_id: "{{ ami_latest.image_id }}"
state: running

- name: Launch ec2 instances 2
amazon.aws.ec2_instance:
#checkov:skip=CKV_AWS_88
name: "bc-office-hours"
vpc_subnet_id: subnet-012d94ee641ab4277
instance_type: t3.micro
security_group: sg-04acc4e02a5b71244
image_id: "{{ ami_latest.image_id }}"
state: running

- name: http
#checkov:skip=CKV2_ANSIBLE_1
uri:
url: http://www.example.com
return_content: yes
register: this
failed_when: "'AWESOME' not in this.content"

12 changes: 12 additions & 0 deletions ansible/tasks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---

- name: Check that you can connect (GET) to a page
uri:
url: https://www.example.com

- name: Download foo.conf

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MEDIUM  Certificate validation disabled with Ansible get_url module
    Resource: tasks.ansible.builtin.get_url.Download foo.conf | Checkov ID: CKV_ANSIBLE_2

Description

This policy detects whether the Ansible get_url tasks enforce SSL certificate validation. Disabling certificate validation in get_url tasks may allow accepting potentially compromised certificates, leading to security vulnerabilities, such as man-in-the-middle attacks.

ansible.builtin.get_url:
url: https://example.com/path/file.conf
dest: /etc/foo.conf
mode: '0440'
validate_certs: false
6 changes: 0 additions & 6 deletions docker/Dockerfile

This file was deleted.

15 changes: 15 additions & 0 deletions docker/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:12-alpine

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got 6.7.1 / dockerfile.FROM

Total vulnerabilities: 1

Critical: 0 High: 0 Medium: 1 Low: 0
Vulnerability IDSeverityCVSSFixed inStatus
CVE-2022-33987 MEDIUM MEDIUM 5.3 12.1.0 Open

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

request 2.88.0 / dockerfile.FROM

Total vulnerabilities: 1

Critical: 0 High: 0 Medium: 1 Low: 0
Vulnerability IDSeverityCVSSFixed inStatus
CVE-2023-28155 MEDIUM MEDIUM 6.1 - Open

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tar 4.4.19 / dockerfile.FROM

Total vulnerabilities: 1

Critical: 0 High: 0 Medium: 1 Low: 0
Vulnerability IDSeverityCVSSFixed inStatus
CVE-2024-28863 MEDIUM MEDIUM 6.5 6.2.1 Open

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ansi-regex 4.1.0 / dockerfile.FROM

Total vulnerabilities: 1

Critical: 0 High: 1 Medium: 0 Low: 0
Vulnerability IDSeverityCVSSFixed inStatus
CVE-2021-3807 HIGH HIGH 7.5 4.1.1 Open

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ansi-regex 3.0.0 / dockerfile.FROM

Total vulnerabilities: 1

Critical: 0 High: 1 Medium: 0 Low: 0
Vulnerability IDSeverityCVSSFixed inStatus
CVE-2021-3807 HIGH HIGH 7.5 4.1.1 Open

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qs 6.5.2 / dockerfile.FROM

Total vulnerabilities: 1

Critical: 0 High: 1 Medium: 0 Low: 0
Vulnerability IDSeverityCVSSFixed inStatus
CVE-2022-24999 HIGH HIGH 7.5 6.10.3 Open

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

http-cache-semantics 3.8.1 / dockerfile.FROM

Total vulnerabilities: 1

Critical: 0 High: 1 Medium: 0 Low: 0
Vulnerability IDSeverityCVSSFixed inStatus
CVE-2022-25881 HIGH HIGH 7.5 4.1.1 Open

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

semver 5.7.1 / dockerfile.FROM

Total vulnerabilities: 1

Critical: 0 High: 1 Medium: 0 Low: 0
Vulnerability IDSeverityCVSSFixed inStatus
CVE-2022-25883 HIGH HIGH 7.5 7.5.2 Open

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimatch 3.0.4 / dockerfile.FROM

Total vulnerabilities: 1

Critical: 0 High: 1 Medium: 0 Low: 0
Vulnerability IDSeverityCVSSFixed inStatus
CVE-2022-3517 HIGH HIGH 7.5 3.0.5 Open

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

decode-uri-component 0.2.0 / dockerfile.FROM

Total vulnerabilities: 2

Critical: 0 High: 1 Medium: 1 Low: 0
Vulnerability IDSeverityCVSSFixed inStatus
CVE-2022-38900 HIGH HIGH 7.5 0.2.1 Open
CVE-2022-38778 MEDIUM MEDIUM 6.5 0.2.1 Open

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

openssl 1.1.1n-r0 / dockerfile.FROM

Total vulnerabilities: 13

Critical: 0 High: 4 Medium: 9 Low: 0
Vulnerability IDSeverityCVSSFixed inStatus
CVE-2023-0286 HIGH HIGH 7.4 - Open
CVE-2022-4450 HIGH HIGH 7.5 - Open
CVE-2023-0215 HIGH HIGH 7.5 - Open
CVE-2023-0464 HIGH HIGH 7.5 - Open
CVE-2022-2097 MEDIUM MEDIUM 5.3 - Open
CVE-2023-0465 MEDIUM MEDIUM 5.3 - Open
CVE-2023-0466 MEDIUM MEDIUM 5.3 - Open
CVE-2023-3446 MEDIUM MEDIUM 5.3 - Open
CVE-2023-3817 MEDIUM MEDIUM 5.3 - Open
CVE-2023-5678 MEDIUM MEDIUM 5.3 - Open
CVE-2024-0727 MEDIUM MEDIUM 5.5 - Open
CVE-2022-4304 MEDIUM MEDIUM 5.9 - Open
CVE-2023-2650 MEDIUM MEDIUM 6.5 - Open

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimist 1.2.5 / dockerfile.FROM

Total vulnerabilities: 1

Critical: 1 High: 0 Medium: 0 Low: 0
Vulnerability IDSeverityCVSSFixed inStatus
CVE-2021-44906 CRITICAL CRITICAL 9.8 1.2.6 Open

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zlib 1.2.12-r0 / dockerfile.FROM

Total vulnerabilities: 2

Critical: 1 High: 0 Medium: 1 Low: 0
Vulnerability IDSeverityCVSSFixed inStatus
CVE-2022-37434 CRITICAL CRITICAL 9.8 1.2.12-r2 Open
CVE-2023-6992 MEDIUM MEDIUM 5.5 - Open

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

busybox 1.34.1-r5 / dockerfile.FROM

Total vulnerabilities: 1

Critical: 1 High: 0 Medium: 0 Low: 0
Vulnerability IDSeverityCVSSFixed inStatus
CVE-2022-48174 CRITICAL CRITICAL 9.8 - Open

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tough-cookie 2.4.3 / dockerfile.FROM

Total vulnerabilities: 1

Critical: 1 High: 0 Medium: 0 Low: 0
Vulnerability IDSeverityCVSSFixed inStatus
CVE-2023-26136 CRITICAL CRITICAL 9.8 4.1.3 Open

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ip 1.1.5 / dockerfile.FROM

Total vulnerabilities: 2

Critical: 1 High: 1 Medium: 0 Low: 0
Vulnerability IDSeverityCVSSFixed inStatus
CVE-2023-42282 CRITICAL CRITICAL 9.8 1.1.9 Open
CVE-2024-29415 HIGH HIGH 8.1 - Open

ENV NODE_ENV "production"
ENV PORT 8079
EXPOSE 8079
RUN addgroup mygroup && adduser -D -G mygroup myuser && mkdir -p /usr/src/app && chown -R myuser /usr/src/app
# Prepare app directory
WORKDIR /usr/src/app
COPY package.json /usr/src/app/
COPY yarn.lock /usr/src/app/
RUN chown myuser /usr/src/app/yarn.lock
USER myuser
RUN yarn install
COPY . /usr/src/app
# Start the app
CMD ["/usr/local/bin/npm", "start"]