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

fix(ansible): Fix CKV2_ANSIBLE_2 #6610

Merged
merged 3 commits into from
Jul 29, 2024
Merged
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
22 changes: 15 additions & 7 deletions checkov/ansible/checks/graph_checks/GetUrlHttpsOnly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@ metadata:
name: "Ensure that HTTPS url is used with get_url"
category: "NETWORKING"
definition:
cond_type: attribute
resource_types:
- tasks.ansible.builtin.get_url
- tasks.get_url
attribute: url
operator: starting_with
value: "https://"
and:
- cond_type: attribute
resource_types:
- tasks.ansible.builtin.get_url
- tasks.get_url
attribute: url
operator: not_starting_with
value: "http://"
- cond_type: attribute
resource_types:
- tasks.ansible.builtin.get_url
- tasks.get_url
attribute: url
operator: not_starting_with
value: "ftp://"
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pass:
- "tasks.ansible.builtin.get_url.https"
- "tasks.get_url.unknown" # update test when variable rendering is supported
fail:
- "tasks.get_url.http"
evaluated_keys:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- name: Verify tests
hosts: all
vars:
variable_url: https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
tasks:
- name: unknown
get_url:
url: "{{ variable_url }}"
dest: /etc/foo.conf
force_basic_auth: yes
Loading