trailofbits.yaml.ansible.dnf-validate-certs-disabled.dnf-validate-certs-disabled
trailofbits
Author
unknown
Download Count*
License
Found dnf with SSL verification disabled
Run Locally
Run in CI
Defintion
rules:
- id: dnf-validate-certs-disabled
message: Found dnf with SSL verification disabled
languages:
- yaml
severity: WARNING
metadata:
category: security
cwe: "CWE-295: Improper Certificate Validation"
subcategory:
- audit
technology:
- ansible
- dnf
confidence: HIGH
likelihood: HIGH
impact: HIGH
references:
- https://docs.ansible.com/ansible/latest/collections/ansible/builtin/dnf_module.html#parameter-validate_certs
- https://docs.ansible.com/ansible/latest/collections/ansible/builtin/dnf5_module.html#parameter-validate_certs
license: AGPL-3.0 license
vulnerability_class:
- Improper Authentication
patterns:
- pattern-inside: |
$DNF:
...
- metavariable-pattern:
metavariable: $DNF
pattern-either:
- pattern: dnf
- pattern: ansible.builtin.dnf
- pattern: dnf5
- pattern: ansible.builtin.dnf5
- pattern: "$KEY: $VALUE"
- metavariable-pattern:
metavariable: $KEY
pattern-either:
- pattern: validate_certs
- metavariable-pattern:
metavariable: $VALUE
pattern-either:
- pattern: "false"
Examples
dnf-validate-certs-disabled.test.yaml
---
- name: Semgrep tests
hosts: all
tasks:
- name: Positive test
ansible.builtin.dnf:
name: https://example.com/example.rpm
state: present
# ruleid: dnf-validate-certs-disabled
validate_certs: false
- name: Negative test (dnf-unencrypted-url and dnf-validate-certs-disabled)
ansible.builtin.dnf:
# ok: dnf-validate-certs-disabled
name: https://example.com/example.rpm
state: present
Short Link: https://sg.run/wdL06