mirror of
https://github.com/RoboSats/robosats.git
synced 2025-08-08 00:20:08 +00:00
Prevent timing attacks on protected orders
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
from datetime import datetime, timedelta
|
||||
from hmac import compare_digest
|
||||
|
||||
from decouple import config
|
||||
from django.conf import settings
|
||||
@ -558,7 +559,8 @@ class OrderView(viewsets.ViewSet):
|
||||
if not valid:
|
||||
return Response(context, status=status.HTTP_409_CONFLICT)
|
||||
|
||||
if order.password is not None and order.password != password:
|
||||
if order.password is not None:
|
||||
if password is None or not compare_digest(order.password, password):
|
||||
return Response(
|
||||
{"bad_request": "Wrong password"},
|
||||
status=status.HTTP_403_FORBIDDEN,
|
||||
|
Reference in New Issue
Block a user