Password-protect the JSON RPC interface
This commit is contained in:
@@ -28,6 +28,7 @@ from decimal import Decimal
|
||||
import traceback
|
||||
import urllib
|
||||
import threading
|
||||
import hmac
|
||||
|
||||
from .i18n import _
|
||||
|
||||
@@ -202,6 +203,13 @@ def json_decode(x):
|
||||
except:
|
||||
return x
|
||||
|
||||
|
||||
# taken from Django Source Code
|
||||
def constant_time_compare(val1, val2):
|
||||
"""Return True if the two strings are equal, False otherwise."""
|
||||
return hmac.compare_digest(to_bytes(val1, 'utf8'), to_bytes(val2, 'utf8'))
|
||||
|
||||
|
||||
# decorator that prints execution time
|
||||
def profiler(func):
|
||||
def do_profile(func, args, kw_args):
|
||||
|
||||
Reference in New Issue
Block a user