From ad495c7ac538e8583fb6aac0aa2111dc8d8458eb Mon Sep 17 00:00:00 2001 From: Amin Alaee Date: Tue, 18 Jan 2022 16:05:09 +0100 Subject: [PATCH] Add third-party CSRF middlewares (#1414) * change github issues template * Add third-party CSRF middlewares Co-authored-by: Tom Christie --- docs/middleware.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/middleware.md b/docs/middleware.md index 5fe7ce516..f053e97fa 100644 --- a/docs/middleware.md +++ b/docs/middleware.md @@ -250,6 +250,10 @@ This middleware adds authentication to any ASGI application, requiring users to using their GitHub account (via [OAuth](https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/)). Access can be restricted to specific users or to members of specific GitHub organizations or teams. +#### [asgi-csrf](https://github.com/simonw/asgi-csrf) + +Middleware for protecting against CSRF attacks. This middleware implements the Double Submit Cookie pattern, where a cookie is set, then it is compared to a csrftoken hidden form field or an `x-csrftoken` HTTP header. + #### [AuthlibMiddleware](https://github.com/aogier/starlette-authlib) A drop-in replacement for Starlette session middleware, using [authlib's jwt](https://docs.authlib.org/en/latest/jose/jwt.html) @@ -259,6 +263,10 @@ module. A middleware class for logging exceptions to [Bugsnag](https://www.bugsnag.com/). +#### [CSRFMiddleware](https://github.com/frankie567/starlette-csrf) + +Middleware for protecting against CSRF attacks. This middleware implements the Double Submit Cookie pattern, where a cookie is set, then it is compared to an `x-csrftoken` HTTP header. + #### [EarlyDataMiddleware](https://github.com/HarrySky/starlette-early-data) Middleware and decorator for detecting and denying [TLSv1.3 early data](https://tools.ietf.org/html/rfc8470) requests.