Insecure cryptography
Misuse of cryptography-related APIs can create security vulnerabilities. This includes algorithms with known weaknesses, certain padding modes, lack of integrity checks, insufficiently large key sizes, and insecure combinations of the aforementioned.
def cryptography_noncompliant():
    from cryptography.hazmat.primitives import hashes, hmac
    import secrets
    # Noncompliant: keysize too small for this algorithm.
    key = secrets.token_bytes(12)
    hash_key = hmac.HMAC(key, algorithm=hashes.SHA512_224())
def cryptography_compliant():
    from cryptography.hazmat.primitives import hashes, hmac
    import secrets
    # Compliant: keysize sufficient for this algorithm.
    key = secrets.token_bytes(48)
    hash_key = hmac.HMAC(key, algorithm=hashes.SHA512_224())