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 · Carl Sampson

Python 3.13 Major Step Forward

Python 3.13: A Major Step Forward for Python Developers Released on October 7, 2024, Python 3.13 brings several high-impact enhancements—most notably a modernized REPL, experimental performance features, improved developer ergonomics, and valuable standard library upgrades. Real Python Python.org 1. A Smarter, More User-Friendly REPL Python 3.13’s interactive interpreter (REPL) is a substantial quality-of-life improvement: Block-level editing and history: Now, up-arrow lets you recall entire code blocks—no more juggling line-by-line history. ...

September 6, 2025 · Carl Sampson

What is GitHub CoPilot?

GitHub Copilot is an AI-powered coding assistant developed by GitHub in collaboration with OpenAI. It uses large language models trained on public code repositories to suggest code completions, generate entire functions, and assist with a wide range of programming tasks directly in your editor. How It Works Copilot is powered by OpenAI’s Codex and GPT-4-class models (the underlying models have evolved significantly since launch). It analyzes the context of your current file — comments, function signatures, variable names, surrounding code — and generates suggestions in real time. ...

May 2, 2023 · Carl Sampson