rules:
  - id: kotlin-weak-rsa-key-size
    patterns:
      - pattern: |
          $KG.initialize($SIZE)
      - pattern-inside: |
          val $KG = KeyPairGenerator.getInstance("RSA")
          ...
      - metavariable-comparison:
          metavariable: $SIZE
          comparison: $SIZE < 2048
    message: >-
      QUANTUM VULNERABILITY: RSA key size $SIZE bits is insufficient. RSA is
      broken by Shor's algorithm regardless of key size. Migrate to
      CRYSTALS-Kyber (ML-KEM) or CRYSTALS-Dilithium (ML-DSA).
    severity: ERROR
    languages: [kotlin]
    metadata:
      category: security
      cwe:
        - "CWE-326: Inadequate Encryption Strength"
      quantum_vulnerable: true
      quantum_attack: "Shor's Algorithm"
      quantum_risk_score: 10
