Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Securing Python Web Applications

Securing Python Web Applications

In today’s digital era, web application security is more important than ever. The systems are becoming complex, containing sensitive data, and therefore attracting more hackers. This talk covers the most common web vulnerabilities and how to address them by leveraging Python-specific tools.

Dmytro Khmelenko

January 25, 2025
Tweet

More Decks by Dmytro Khmelenko

Other Decks in Programming

Transcript

  1. Who I Am • Writing code since 2010 • Backend

    developer since 2019 • Currently at Preply • Author of the book “Unlock the Code” • Building becomingbetterdeveloper.com
  2. Why Security The average costs of security breaches in 2024

    was USD 4.88M https://www.ibm.com/reports/data-breach
  3. Meet Ben - Backend Developer - Works for mid size

    company - Builds web applications
  4. Weak Authentication & Authorization Threat - Poor password management -

    Improper session handling - Failed roles separation Solution - Use libraries like bcrypt for password hashing - Utilize existing solutions for access rights managements
  5. Exposing Sensitive Data Threat - Leaking configurations & API keys

    - Leaking personal identifiable information Solution - Disable debug mode in production - Exclude configuration files in .gitignore
  6. Exposing Personal Identifiable Information (PII) • Field Encryption • Data

    Masking • Data Redaction in APIs • Access Control
  7. Check dependencies • Dependabot for security updates • Apply pip-audit

    for checking known vulnerabilities • Lock dependency version with pip-tools • Regularly update outdated dependencies with pip list --outdated
  8. Secrets Management • Avoid hardcoding passwords and API keys in

    code • Use Vault from HashiCorp or Secrets Manager from AWS
  9. Error Handling • Don’t expose stacktrace to users • Configure

    custom error pages • Log all possible errors
  10. State Management Best Practices • Use immutable objects • Track

    object changes • Validate object before operating
  11. Open Web Application Security Project - OWASP • Track of

    top security risks • Tools for improving security • Guidelines and standards for secure coding • Community, resources and trainings https://owasp.org
  12. “There is no silver bullet solution with cyber security; a

    layered defense is the only viable defence” – James Scott