Skip to content

Add secure library for consistent HTTP security headers in FastAPI#291

Merged
mjhea0 merged 1 commit into
mjhea0:mainfrom
cak:main
Jun 24, 2026
Merged

Add secure library for consistent HTTP security headers in FastAPI#291
mjhea0 merged 1 commit into
mjhea0:mainfrom
cak:main

Conversation

@cak

@cak cak commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

name: Add a new project
about: Suggest a new FastAPI project for the Awesome FastAPI list
title: "[NEW] secure"

⚠️ REQUIRED: This template MUST be filled out completely.

Pull requests that delete this template, leave sections blank, or ignore the requirements will be closed without review.

Project Information

  1. Project Name:
    secure

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

  3. Description:

A small library for defining and applying HTTP security headers consistently in FastAPI applications using ASGI middleware.


Criteria

  1. Is the project new?
  • Yes
  • No
  1. How long has the project been maintained?

Originally created several years ago and recently updated with a new v2 design focused on composability, middleware support, and safer header handling.

  1. How many releases has it had if it's a library or package?

See release history:
https://github.com/TypeError/secure/releases

  1. Are you the author, or are you submitting the project on behalf of a company?
  • I am the author
  • I am submitting on behalf of a company
  • Other (please specify)
  1. What makes it awesome?

It addresses a common gap in FastAPI applications where HTTP security headers are defined inconsistently across middleware, response hooks, and handlers.

The library centralizes header configuration in a single object and applies it through ASGI middleware, making it easier to keep policies like CSP consistent as applications grow.


AI Disclosure

  • Yes, this pull request was generated or assisted by AI.
  • No, this pull request was authored entirely by a human.

Additional Information

The project is intentionally small and dependency-free, with a focus on clarity and predictable behavior.

It supports both middleware-based integration and direct response usage, allowing it to fit naturally into existing FastAPI applications without requiring architectural changes.

@mjhea0 mjhea0 merged commit 0eb19d2 into mjhea0:main Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants