Interview Prep/Python for DevOps/Best practices & rapid-fire commands

What are the most common security mistakes in Python ops code?

AdvancedConceptBest practices & rapid-fire commands
Answer
  • shell=True with interpolated input (command injection).
  • yaml.load, pickle.loads on untrusted data (code execution).
  • verify=False on 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.
All Python for DevOps questions Roadmap: Python for automation

More on Best practices & rapid-fire commands