trailofbits.yaml.ansible.zypper-unencrypted-url.zypper-unencrypted-url

profile photo of trailofbitstrailofbits
Author
unknown
Download Count*

Found Zypper package with unencrypted URL (e.g. HTTP, FTP, etc.)

Run Locally

Run in CI

Defintion

rules:
  - id: zypper-unencrypted-url
    message: Found Zypper package with unencrypted URL (e.g. HTTP, FTP, etc.)
    languages:
      - yaml
    severity: WARNING
    metadata:
      category: security
      cwe: "CWE-319: Cleartext Transmission of Sensitive Information"
      subcategory:
        - audit
      technology:
        - ansible
        - zypper
      confidence: HIGH
      likelihood: HIGH
      impact: HIGH
      references:
        - https://docs.ansible.com/ansible/latest/collections/community/general/zypper_module.html#parameter-name
      license: AGPL-3.0 license
      vulnerability_class:
        - Mishandled Sensitive Information
    patterns:
      - pattern-inside: |
          $ZYPPER:
            ...
      - pattern: "$KEY: '$VALUE'"
      - metavariable-pattern:
          metavariable: $KEY
          pattern-either:
            - pattern: name
            - pattern: pkg
      - metavariable-pattern:
          metavariable: $ZYPPER
          pattern-either:
            - pattern: zypper
            - pattern: community.general.zypper
      - metavariable-regex:
          metavariable: $VALUE
          regex: (?i)^(http|ftp)://.*

Examples

zypper-unencrypted-url.test.yaml

---
- name: Semgrep tests
  hosts: all
  tasks:
    - name: Positive test
      community.general.zypper:
        # ruleid: zypper-unencrypted-url
        name: "http://example.com/package.rpm"
        state: present
    - name: Negative test
      community.general.zypper:
        # ok: zypper-unencrypted-url
        name: "https://example.com/package.rpm"
        state: present