What are the most common security mistakes in Python ops code?
AdvancedConceptBest practices & rapid-fire commands
Answer
shell=Truewith interpolated input (command injection).yaml.load,pickle.loadson untrusted data (code execution).verify=Falseon HTTPS calls.- Hardcoded keys and tokens, or secrets in logs and exception messages.
paramiko.AutoAddPolicy()in production (MITM).eval()/exec()on input.- Path traversal: joining user-supplied names into paths without checking
resolved.is_relative_to(base). - Unpinned dependencies from public indexes (typosquatting, dependency confusion).
- Overly broad IAM for the script's role.
More on Best practices & rapid-fire commands
What does a production-quality automation script always include?IntermediateHow do you handle configuration in a Python tool?IntermediateBash or Python for this task: how do you decide?BeginnerRapid fire: set up a project environment from scratch.BeginnerRapid fire: one-liners useful during an incident.IntermediateRapid fire: pytest commands.Beginner