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

profile photo of trailofbitstrailofbits
Author
unknown
Download Count*

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

Run Locally

Run in CI

Defintion

rules:
  - id: zypper-repository-unencrypted-url
    message: Found Zypper repository 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: repo
      - metavariable-pattern:
          metavariable: $ZYPPER
          pattern-either:
            - pattern: zypper_repository
            - pattern: community.general.zypper_repository
      - metavariable-regex:
          metavariable: $VALUE
          regex: (?i)^(http|ftp)://.*

Examples

zypper-repository-unencrypted-url.test.yaml

---
- name: Semgrep tests
  hosts: all
  tasks:
    - name: Positive test
      community.general.zypper_repository:
        # ruleid: zypper-repository-unencrypted-url
        repo: "http://example.com/repo/"
        auto_import_keys: true
    - name: Negative test
      community.general.zypper_repository:
        # ok: zypper-repository-unencrypted-url
        repo: "https://example.com/repo/"
        auto_import_keys: true