Define HTTP security headers once, apply them across Python web apps
AI-generated summary of reporting by GitHub Opensource Projects. Read the original for the full story.
Why it matters
Python developers can now manage security headers through one dependency-free library instead of scattering configuration across middleware and handlers.
A free, open-source Python library called 'secure' helps web developers keep their websites safer with less hassle. Websites use hidden labels, called HTTP security headers, that tell browsers to block attacks like clickjacking. Usually developers sprinkle these settings across many code files, so it's easy to miss one. This tool stores all the settings in one place and applies them across popular Python frameworks, offering ready-made presets named BASIC, BALANCED, and STRICT.
Teams maintaining multiple Python web services often lose track of which layer sets which security header, creating audit and risk blind spots. The open-source 'secure' library consolidates that configuration into a single policy object applied via ASGI or WSGI middleware. It has zero dependencies, reducing audit surface, and its defaults follow MDN and OWASP guidance. The trade-off: presets still need per-application review, especially Content Security Policy.
The 'secure' library (github.com/typeerror/secure) exposes a single Secure policy object applied through ASGI middleware, WSGI middleware, or response hooks, with both set_headers and set_headers_async methods. Secure.with_default_headers() yields a BALANCED preset covering COOP, CORP, CSP, HSTS, Permissions-Policy, Referrer-Policy, X-Content-Type-Options and X-Frame-Options; Preset.BASIC and Preset.STRICT are also available. Duplicate handling, overwrites, and validation are explicit, and the dependency count is zero. The README warns defaults are a starting point, not a substitute for application-specific review.
Read the original
This summary exists to save you time, not to replace the source.
Key terms
secure FastAPI Content Security Policy Strict-Transport-Security X-Frame-Options OWASP MDN
Was this summary useful?
One click, anonymous. It tells us which summaries to re-run.
Related reading
Node graph engine that runs big diffusion models on 4GB VRAM
ComfyUI's asynchronous weight streaming lets large diffusion models run on 4GB VRAM, meaning practitioners with modest GPUs no longer need expensive hardware for local image, video and audio generation.
iCloud apps for Windows, Linux and Android, written in Rust
Skykeep gives Rust-based native iCloud apps for Windows, Linux and Android, ending the iCloud.com-browser workaround for non-Apple-device users.
An open-source video editor covering auto-captions, voice isolation and keyframes
Very little for most professionals: Concat is a free, pre-1.0 open-source video editor that makes basic auto-captions and voice isolation available on mobile and desktop without a subscription.
OpenGame: turn your local coding agent into a full-stack game studio
Developers with a local coding agent can now scaffold full playable 3D games, art, music, testing, publishing, instead of only refactoring code, opening a path from hobby coding to shippable mini-games.
A Flipper Zero CAN bus toolkit for Tesla, from $14
An open-source $14 ESP32/Flipper Zero build replicates $200+ commercial Tesla dongles at the CAN bus level, including FSD region-gate bypass and TLSSC restore, with real VIN-ban risk.