Comments (8)
Tricky thing is how this should interact with always_protect={set of paths}
.
from asgi-csrf.
always_protect=
solves a different case: it lets you specify that certain paths such as /login
should ALWAYS be CSRF-protected even if they would not be otherwise (in that case to avoid login CSRF).
from asgi-csrf.
Relevant code (this is the only place that deals with always_protect
at the moment):
Lines 118 to 130 in bb7178d
from asgi-csrf.
Maybe I'll go with skip_protection=lambda scope: ...
instead. That makes it a bit more clear what this optional mechanism is intended to do.
Potential names for that keyword argument:
skip_protection=lambda scope: ..
skip_protection_if=lambda scope: ..
skip_protection_callback=lambda scope: ..
skip_callback=
skip_if_scope=
skip_protection_if_scope=
from asgi-csrf.
I wish always_protect=
was called always_protect_paths=
.
from asgi-csrf.
skip_callback=
is shorter, but is it as clear?
from asgi-csrf.
I quite like skip_if_scope=
.
from asgi-csrf.
I've been using this successfully in Datasette plugins for a while now.
from asgi-csrf.
Related Issues (20)
- Bug: I'm not correctly passing through headers
- Skip CSRF checks if no cookies or if authorization: bearer xxx headers
- Switch to GitHub Actions HOT 1
- Get 100% test coverage HOT 4
- Throws errors if scope["method"] is missing HOT 1
- Always generate a token even if scope not called HOT 3
- sdist release in addition to wheel HOT 2
- Tests fail with httpx==0.16.1 HOT 3
- Remove dependency on undocumented httpx classes HOT 3
- IndexError thrown on form posts HOT 1
- Option to skip checks if custom header present
- setup.py has test dependencies, but there are no tests in the repository HOT 1
- 2 test_multipart tests failures
- Add options to set csrftoken cookie attributes
- Confirm that replay_receive mechanism works correctly HOT 1
- Set cookie with path=/
- Only set missing csrftoken cookie if needed by current page HOT 1
- Add Vary: Cookie header to the response if cookie is set HOT 1
- Vary: Cookie on pages that show csrftoken in form, not pages that set cookies
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asgi-csrf.