mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
skip_csrf(datasette, scope) plugin hook, refs #1377
This commit is contained in:
parent
4a3e8561ab
commit
b1fd24ac9f
8 changed files with 68 additions and 1 deletions
|
|
@ -1052,6 +1052,9 @@ class Datasette:
|
|||
DatasetteRouter(self, routes),
|
||||
signing_secret=self._secret,
|
||||
cookie_name="ds_csrftoken",
|
||||
skip_if_scope=lambda scope: any(
|
||||
pm.hook.skip_csrf(datasette=self, scope=scope)
|
||||
),
|
||||
)
|
||||
if self.setting("trace_debug"):
|
||||
asgi = AsgiTracer(asgi)
|
||||
|
|
|
|||
|
|
@ -112,3 +112,8 @@ def table_actions(datasette, actor, database, table, request):
|
|||
@hookspec
|
||||
def database_actions(datasette, actor, database, request):
|
||||
"""Links for the database actions menu"""
|
||||
|
||||
|
||||
@hookspec
|
||||
def skip_csrf(datasette, scope):
|
||||
"""Mechanism for skipping CSRF checks for certain requests"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue