Skip to main content

Precaution versus Bandit


When choosing a Static Application Security Testing (SAST) tool for Python projects, it’s important to consider how different tools align with your development workflow and security needs. This comparison focuses on Precaution and Bandit, two popular options with distinct approaches and feature sets.

Programming Languages

LanguagePrecautionBandit
Go
Java
Python

Rule Coverage

Precaution RuleBandit Check
PY001: assertB101: assert_used
PY002: crypt - weak hash
PY003: ftplib - cleartextB321: ftplib
PY004: hashlib - weak hash
PY005: hmac - timing attack
PY006: hmac - weak hash
PY007: http url secret
PY008: imaplib - cleartext
PY009: json - load
PY010: logging - insecure listen configB612: logging_config_insecure_listen
PY011: marshal - loadB302: marshal
PY012: nntplib - cleartext
PY013: pickle - loadB301: pickle, dill, shelve, jsonpickle, pandas.read)
PY014: poplib - cleartext
PY015: shelve - openB301: pickle, dill, shelve, jsonpickle, pandas.read)
PY016: smtplib - cleartext
PY017: ssl - unverified contextB321: ftplib
PY018: ssl - insecure tls versionB502: ssl_with_bad_version
PY019: ssl - weak key
PY020: telnetlib - cleartextB312: telnetlib
PY021: tempfile - mktemp race conditionB304: ciphers
PY022: ftplib - unverified context
PY023: imaplib - unverified context
PY024: nntplib - unverified context
PY025: poplib - unverified context
PY026: smtplib - unverified context
PY027: argparse - sensitive info
PY028: secrets - weak token
PY029: socket - unrestricted bindB104: hardcoded_bind_all_interfaces
PY030: socketserver - unrestricted bindB104: hardcoded_bind_all_interfaces
PY031: http - unrestricted bindB104: hardcoded_bind_all_interfaces
PY032: xmlrpc - unrestricted bindB104: hardcoded_bind_all_interfaces
PY033: re - denial of service
PY034: hmac - weak key
PY035: hashlib - improper prngB311: random
PY036: os - incorrect permissionB103: set_bad_file_permissions
PY037: pathlib - incorrect permissionB103: set_bad_file_permissions
PY038: os - unnessary privileges
PY039: socket - no timeout
PY040: smtplib - no timeout
PY041: imaplib - no timeout
PY042: nntplib - no timeout
PY043: poplib - no timeout
PY044: telnetlib - no timeout
PY045: ftplib - no timeout
PY046: ssl - no timeout
PY501: aiohttp - no certificate verify
PY502: cryptography - weak cipherB304: ciphers
PY503: cryptography - weak cipher mode
PY504: cryptography - weak hashB303: md5
PY505: cryptography - weak keyB505: weak_crytographic_key
PY506: dill - loadB301: pickle, dill, shelve, jsonpickle, pandas.read)
PY507: flask - code injectionB201: flask_debug_true
PY508: httpx - no certificate verify
PY509: jsonpickle - decodeB301: pickle, dill, shelve, jsonpickle, pandas.read)
PY510: m2crypto - weak key
PY511: pandas - read_pickleB301: pickle, dill, shelve, jsonpickle, pandas.read)
PY512: policy - no host key verifyB507: ssh_no_host_key_verification
PY513: pycrypto - weak cipherB304: ciphers
PY514: pycrypto - weak hashB303: md5
PY515: pycrypto - weak keyB505: weak_crytographic_key
PY516: pycryptodomex - weak cipherB304: ciphers
PY517: pycryptodomex - weak hashB303: md5
PY518: pycryptodomex - weak keyB505: weak_crytographic_key
PY519: command - cleartext
PY520: pyopenssl - insecure tls versionB502: ssl_with_bad_version
PY521: pyopenssl - weak key
PY522: yaml - loadB506: yaml_load
PY523: requests - no certificate verifyB501: request_with_no_cert_validation
PY524: fastapi - debug
PY525: ruamel.yaml - yaml
PY526: Jinja2 - no autoescapeB701: jinja2_autoescape_false
PY527: ldap3 - anonymous bind
PY528: python-ldap - anonymous bind
PY529: websockets - cleartext
PY530: websocket-client - cleartext
PY531: pyjwt - no verify