mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-03 23:59:15 +02:00
Fix #658: Support blind key rotation in HTTP Signatures
This commit is contained in:
parent
8c578fa9f5
commit
5fe30cf59b
9 changed files with 162 additions and 12 deletions
|
@ -49,7 +49,13 @@ class SignatureAuthentication(authentication.BaseAuthentication):
|
|||
try:
|
||||
signing.verify_django(request, actor.public_key.encode("utf-8"))
|
||||
except cryptography.exceptions.InvalidSignature:
|
||||
raise rest_exceptions.AuthenticationFailed("Invalid signature")
|
||||
# in case of invalid signature, we refetch the actor object
|
||||
# to load a potentially new public key. This process is called
|
||||
# Blind key rotation, and is described at
|
||||
# https://blog.dereferenced.org/the-case-for-blind-key-rotation
|
||||
# if signature verification fails after that, then we return a 403 error
|
||||
actor = actors.get_actor(actor_url, skip_cache=True)
|
||||
signing.verify_django(request, actor.public_key.encode("utf-8"))
|
||||
|
||||
return actor
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue