Skip to content

Secure: composable HTTP security headers for Python (FastAPI, Flask, ASGI/WSGI) #42

@cak

Description

@cak

Project: https://github.com/TypeError/secure

Secure is a small Python library for defining HTTP security headers once and applying them consistently across web frameworks.

It provides:

  • A single, typed API for configuring headers
  • Presets for common configurations (balanced, strict, basic)
  • ASGI and WSGI middleware for frameworks like FastAPI and Flask
  • Builders for CSP and Permissions Policy
  • Optional validation and normalization pipeline

The goal is to avoid copy-pasting header strings across middleware, response hooks, and framework-specific code, and instead keep a single, explicit policy.

Python 3.10+, no external dependencies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions