sdk/python/Cryptography

Cryptography

hashlib, hmac, ssl, secrets — weak crypto detection

All 23Source: 4Sink: 6Sanitizer: 9
PyAuth0
auth0

Third-party Python package module — auth0. Auto-indexed from CDN. Method-level security roles have not been annotated; rule writers should inspect the source before use.

10 methods
PyAuthlib
authlib

Authlib is a comprehensive OAuth / OpenID / JWT library. JsonWebToken.decode() and the OAuth client Client.parse_request_body_response track access-token flows.

1 sanitizer2 methods
PyCrypt
crypt

The crypt module (deprecated in 3.11, removed in 3.13). crypt.crypt() wraps the Unix crypt(3) call. Most default methods are weak (DES, MD5). Use passlib or hashlib.scrypt / pbkdf2_hmac instead.

1 sink1 methods
PyCryptography
cryptography

The cryptography package provides recipes (Fernet) and primitives (hazmat). Fernet is the recommended symmetric encryption helper. Findings arise when hazmat primitives are used with obsolete algorithms (MD5, DES, RC4) or ECB mode.

3 sanitizers4 methods
PyGetpass
getpass

The getpass module. getpass.getpass() prompts for a password without echoing. getpass.getuser() returns the current user — source when used for authorization decisions.

2 sources2 methods
PyHashlib
hashlib

The hashlib module provides cryptographic hash functions. md5 and sha1 are cryptographically broken — findings for password hashing / signature use. For password hashing use hashlib.scrypt, pbkdf2_hmac, or the passlib / argon2-cffi packages.

2 sinks2 sanitizers5 methods
PyHmac
hmac

The hmac module for keyed message authentication. compare_digest is the only constant-time comparison helper — using ordinary == for MAC comparison is a timing-attack sink.

1 sanitizer2 methods
PyHvac
hvac

hvac is the Python client for HashiCorp Vault. Client.secrets.kv.v2.read_secret_version reads a secret — the returned payload is a source. Client() with verify=False disables TLS verification (major finding).

1 source2 methods
PyJks
jks

Third-party Python package module — jks. Auto-indexed from CDN. Method-level security roles have not been annotated; rule writers should inspect the source before use.

10 methods
PyJose
jose

python-jose implements JWT / JWS / JWE. jwt.decode() is the canonical validation entry point. Finding when algorithms=['none'] is passed (unsigned token acceptance) or verify_signature=False.

2 sources1 sanitizer4 methods
PyJwcrypto
jwcrypto

Third-party Python package module — jwcrypto. Auto-indexed from CDN. Method-level security roles have not been annotated; rule writers should inspect the source before use.

10 methods
PyOauthlib
oauthlib

oauthlib implements the OAuth 1 / OAuth 2 protocols. WebApplicationClient.parse_request_uri_response extracts the authorization code from the callback URL — source for subsequent token exchange.

1 source2 methods
PyParamiko
paramiko

paramiko is the SSH / SFTP client for Python. SSHClient.set_missing_host_key_policy with AutoAddPolicy() silently trusts unknown hosts — MITM risk. exec_command() is a command-execution sink when the command is user-controlled.

3 sinks4 methods
PyPasspy
passpy

Third-party Python package module — passpy. Auto-indexed from CDN. Method-level security roles have not been annotated; rule writers should inspect the source before use.

10 methods
PyPyjwt
jwt

PyJWT decodes and validates JWTs. jwt.decode() with algorithms=['none'] or options={'verify_signature': False} accepts unsigned tokens — major finding. Always pass algorithms explicitly.

1 sanitizer2 methods
PyPysftp
pysftp

pysftp wraps paramiko with a simpler SFTP interface. Connection(host, cnopts=...) with CnOpts.hostkeys=None disables host-key checking — MITM finding.

3 sinks3 methods
PyRandom
random

The random module uses a Mersenne Twister PRNG — NOT suitable for cryptography. random.random, random.choice, random.randint, and SystemRandom(..) should be flagged for security contexts. Use the secrets module for tokens, passwords, and keys.

5 sinks5 methods
PyRequestsOauthlib
requests_oauthlib

Third-party Python package module — requests_oauthlib. Auto-indexed from CDN. Method-level security roles have not been annotated; rule writers should inspect the source before use.

10 methods
PySecrets
secrets

The secrets module provides cryptographically strong random values suitable for managing authentication tokens. Use secrets instead of the random module for session IDs, tokens, and CSRF nonces.

5 sanitizers5 methods
PySsl
ssl

The ssl module for TLS / SSL. SSLContext with verify_mode=CERT_NONE disables certificate validation (MITM risk). _create_unverified_context() is an explicit bypass — finding for any production code. Use create_default_context() for sane defaults.

2 sinks1 sanitizer4 methods
PyTgcrypto
tgcrypto

Third-party Python package module — tgcrypto. Auto-indexed from CDN. Method-level security roles have not been annotated; rule writers should inspect the source before use.

6 methods
PyWerkzeugSecurity
werkzeug.security

werkzeug.security provides generate_password_hash and check_password_hash. The default method is pbkdf2:sha256 with 600_000 iterations. Findings arise when method='plain' or a weak hasher is passed explicitly.

2 sanitizers2 methods
PyZxcvbn
zxcvbn

Third-party Python package module — zxcvbn. Auto-indexed from CDN. Method-level security roles have not been annotated; rule writers should inspect the source before use.

10 methods