Security Considerations¶
The following modules have specific security considerations:
ftplib: default TLS context does not verify server certificates; pass a context fromssl.create_default_context()to verify themhashlib: all constructors take a “usedforsecurity” keyword-only argument disabling known insecure and blocked algorithmshttp.serveris not suitable for production use, only implementing basic security checks. See the security considerations.imaplib: default TLS context does not verify server certificates; pass a context fromssl.create_default_context()to verify thempoplib: default TLS context does not verify server certificates; pass a context fromssl.create_default_context()to verify themrandomshouldn’t be used for security purposes, usesecretsinsteadshelve: shelve is based on pickle and thus unsuitable for dealing with untrusted sourcessmtplib: default TLS context does not verify server certificates; pass a context fromssl.create_default_context()to verify themtempfile: mktemp is deprecated due to vulnerability to race conditionszipfile: maliciously prepared .zip files can cause disk volume exhaustion
The -I command line option can be used to run Python in isolated
mode. When it cannot be used, the -P option or the
PYTHONSAFEPATH environment variable can be used to not prepend a
potentially unsafe path to sys.path such as the current directory, the
script’s directory or an empty string.