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

Error Parsing YAML File #1

Open
ossie-git opened this issue Nov 7, 2024 · 1 comment
Open

Error Parsing YAML File #1

ossie-git opened this issue Nov 7, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@ossie-git
Copy link

Hi,

Thank you for developing yaa. While trying out yaa, I ran into the following error:

git clone https://github.com/trailofbits/semgrep-rules/
cd semgrep-rules/
yaa index .

and it would give me:

Indexing.Error parsing YAML file yaml/ansible/apt-key-unencrypted-url.test.yaml: yaml: unmarshal errors:
  line 2: cannot unmarshal !!seq into map[string]interface {}
Error parsing YAML file yaml/ansible/apt-key-unencrypted-url.yaml: yaml: line 32: found unknown escape character
Indexing..Error parsing YAML file yaml/ansible/apt-key-validate-certs-disabled.test.yaml: yaml: unmarshal errors:
  line 3: cannot unmarshal !!seq into map[string]interface {}
Error parsing YAML file yaml/ansible/apt-unencrypted-url.test.yaml: yaml: unmarshal errors:
  line 2: cannot unmarshal !!seq into map[string]interface {}
Error parsing YAML file yaml/ansible/apt-unencrypted-url.yaml: yaml: line 32: found unknown escape character
Error parsing YAML file yaml/ansible/dnf-unencrypted-url.test.yaml: yaml: unmarshal errors:
  line 2: cannot unmarshal !!seq into map[string]interface {}
Error parsing YAML file yaml/ansible/dnf-unencrypted-url.yaml: yaml: line 36: found unknown escape character
Error parsing YAML file yaml/ansible/dnf-validate-certs-disabled.test.yaml: yaml: unmarshal errors:
  line 2: cannot unmarshal !!seq into map[string]interface {}
Error parsing YAML file yaml/ansible/get-url-unencrypted-url.test.yaml: yaml: unmarshal errors:
  line 2: cannot unmarshal !!seq into map[string]interface {}
Error parsing YAML file yaml/ansible/get-url-unencrypted-url.yaml: yaml: line 42: found unknown escape character
Error parsing YAML file yaml/ansible/get-url-validate-certs-disabled.test.yaml: yaml: unmarshal errors:
  line 2: cannot unmarshal !!seq into map[string]interface {}
Error parsing YAML file yaml/ansible/rpm-key-unencrypted-url.test.yaml: yaml: unmarshal errors:
  line 2: cannot unmarshal !!seq into map[string]interface {}
Error parsing YAML file yaml/ansible/rpm-key-unencrypted-url.yaml: yaml: line 32: found unknown escape character
Error parsing YAML file yaml/ansible/rpm-key-validate-certs-disabled.test.yaml: yaml: unmarshal errors:
  line 2: cannot unmarshal !!seq into map[string]interface {}
Error parsing YAML file yaml/ansible/unarchive-unencrypted-url.test.yaml: yaml: unmarshal errors:
  line 2: cannot unmarshal !!seq into map[string]interface {}
Error parsing YAML file yaml/ansible/unarchive-unencrypted-url.yaml: yaml: line 32: found unknown escape character
Error parsing YAML file yaml/ansible/unarchive-validate-certs-disabled.test.yaml: yaml: unmarshal errors:
  line 2: cannot unmarshal !!seq into map[string]interface {}
Error parsing YAML file yaml/ansible/wrm-cert-validation-ignore.test.yaml: yaml: unmarshal errors:
  line 2: cannot unmarshal !!seq into map[string]interface {}
Error parsing YAML file yaml/ansible/yum-unencrypted-url.test.yaml: yaml: unmarshal errors:
  line 2: cannot unmarshal !!seq into map[string]interface {}
Error parsing YAML file yaml/ansible/yum-unencrypted-url.yaml: yaml: line 33: found unknown escape character
Error parsing YAML file yaml/ansible/yum-validate-certs-disabled.test.yaml: yaml: unmarshal errors:
  line 2: cannot unmarshal !!seq into map[string]interface {}
Error parsing YAML file yaml/ansible/zypper-repository-unencrypted-url.test.yaml: yaml: unmarshal errors:
  line 2: cannot unmarshal !!seq into map[string]interface {}
Error parsing YAML file yaml/ansible/zypper-repository-unencrypted-url.yaml: yaml: line 32: found unknown escape character
Error parsing YAML file yaml/ansible/zypper-unencrypted-url.test.yaml: yaml: unmarshal errors:
  line 2: cannot unmarshal !!seq into map[string]interface {}
Error parsing YAML file yaml/ansible/zypper-unencrypted-url.yaml: yaml: line 33: found unknown escape character
Done!

here is one of the files that it chokes on:

rules:
  - id: apt-unencrypted-url
    message: Found apt deb 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, apt]
      confidence: HIGH
      likelihood: HIGH
      impact: HIGH
      references:
        - https://docs.ansible.com/ansible/latest/collections/ansible/builtin/apt_module.html#parameter-deb
    patterns:
      - pattern-inside: |
          $APT:
            ...
      - metavariable-pattern:
          metavariable: $APT
          pattern-either:
            - pattern: apt
            - pattern: ansible.builtin.apt
      - pattern: "$KEY: '$VALUE'"
      - metavariable-pattern:
          metavariable: $KEY
          pattern-either:
            - pattern: deb
      - metavariable-regex:
          metavariable: $VALUE
          regex: "(?i)^(http|ftp):\/\/.*"

It looks like it chokes on the regex line (this is one of the reasons but I think there are others). Any ideas? Thanks

@alwashali alwashali added the bug Something isn't working label Nov 15, 2024
@alwashali
Copy link
Owner

Thank you for reporting this
I will look into it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants