rules:
- id: detect-insecure-websocket
  message: Insecure WebSocket Detected. WebSocket Secure (wss) should be used for all WebSocket connections.
  metadata:
    cwe:
    - 'CWE-319: Cleartext Transmission of Sensitive Information'
    asvs:
      section: 'V13: API and Web Service Verification Requirements'
      control_id: 13.5.1 Insecure WebSocket
      control_url: https://github.com/OWASP/ASVS/blob/master/4.0/en/0x21-V13-API.md#v135-websocket-security-requirements
      version: '4'
    category: security
    technology:
    - regex
    owasp:
    - A03:2017 - Sensitive Data Exposure
    - A02:2021 - Cryptographic Failures
    subcategory:
    - audit
    likelihood: LOW
    impact: MEDIUM
    confidence: LOW
    references:
    - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
  languages:
  - regex
  severity: ERROR
  patterns:
  - pattern-regex: \bws:\/\/
  - pattern-not-inside: \bws:\/\/localhost.*
  - pattern-not-inside: \bws:\/\/127.0.0.1.*
