rules:
- id: rsa-padding-set
  metadata:
    cwe:
    - 'CWE-780: Use of RSA Algorithm without OAEP'
    owasp:
    - A02:2021 - Cryptographic Failures
    category: security
    technology:
    - scala
    - cryptography
    resources:
    - https://blog.codacy.com/9-scala-security-issues/
    confidence: HIGH
    references:
    - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
    subcategory:
    - audit
    likelihood: MEDIUM
    impact: MEDIUM
  message: >-
    Usage of RSA without OAEP (Optimal Asymmetric Encryption Padding) may weaken encryption. This could
    lead to sensitive data
    exposure. Instead, use RSA with `OAEPWithMD5AndMGF1Padding` instead.
  severity: WARNING
  languages:
  - scala
  patterns:
  - pattern: |
      $VAR = $CIPHER.getInstance($MODE)
  - metavariable-regex:
      metavariable: $MODE
      regex: .*RSA/.*/NoPadding.*