mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Mechanism to prevent tokens creating tokens, closes #1857
This commit is contained in:
parent
b29e487bc3
commit
0f013ff497
4 changed files with 17 additions and 2 deletions
|
|
@ -69,4 +69,4 @@ def actor_from_request(datasette, request):
|
|||
if expires_at is not None:
|
||||
if expires_at < time.time():
|
||||
return None
|
||||
return {"id": decoded["a"], "dstok": True}
|
||||
return {"id": decoded["a"], "token": "dstok"}
|
||||
|
|
|
|||
|
|
@ -177,6 +177,10 @@ class CreateTokenView(BaseView):
|
|||
raise Forbidden(
|
||||
"You must be logged in as an actor with an ID to create a token"
|
||||
)
|
||||
if request.actor.get("token"):
|
||||
raise Forbidden(
|
||||
"Token authentication cannot be used to create additional tokens"
|
||||
)
|
||||
|
||||
async def get(self, request):
|
||||
self.check_permission(request)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue