rules:
- id: unirest-http-request
  message: >-
    Checks for requests sent via Unirest to http:// URLS. This is dangerous because
    the server is attempting to connect to a website that does not encrypt traffic with TLS. Instead,
    send requests only to
    https:// URLS.
  severity: WARNING
  metadata:
    likelihood: MEDIUM
    impact: MEDIUM
    confidence: MEDIUM
    category: security
    cwe: 'CWE-319: Cleartext Transmission of Sensitive Information'
    owasp: 'A03:2017 - Sensitive Data Exposure'
    references:
    - https://kong.github.io/unirest-java/#requests
    subcategory:
    - vuln
    technology:
    - unirest
    vulnerability: Insecure Transport
  languages:
  - java
  fix-regex:
    regex: '[Hh][Tt][Tt][Pp]://'
    replacement: https://
    count: 1
  pattern-either:
  - pattern: |
      Unirest.get("=~/[hH][tT][tT][pP]://.*/")
  - pattern: |
      Unirest.post("=~/[hH][tT][tT][pP]://.*/")
