Writing Secure Python Applications: Preventing SSRF, SQL Injection, and XSS

1. Core Security Foundations Treat all input as untrusted. Validate strictly (whitelists over blacklists), normalize before checks, and enforce types and sizes. Use framework security features instead of writing your own. Least privilege: minimize DB, filesystem, and network permissions. Secrets management: use environment variables or secret stores, never hardcode. Dependency hygiene: pin and audit dependencies with pip-audit or Safety. Secure HTTP headers: add HSTS, X-Frame-Options, CSP, and others. Logging & monitoring: log relevant events, but never credentials. Testing: integrate Bandit and Semgrep in CI. 2. Preventing SQL Injection (SQLi) Principle: Never build queries using string concatenation. ...

November 3, 2025 · 3 min · Carl Sampson

What is GitHub CoPilot?

GitHub Copilot is an AI-powered coding assistant developed by GitHub in collaboration with OpenAI. It uses machine learning algorithms to assist developers in writing code by suggesting code snippets based on the context of the code being written. This powerful tool has the ability to autocomplete code, provide inline documentation, and generate entire functions, making coding easier and more efficient. GitHub Copilot is built on top of OpenAI’s GPT-3 language model, which has been trained on a vast amount of data from a variety of sources, including code repositories, documentation, and programming languages. With this vast amount of data, GitHub Copilot can understand the context of the code being written and provide relevant suggestions in real time. ...

May 2, 2023 · 1 min · chs