Skip to content

Commit 32527e1

Browse files
committed
Error if attempting to auth with non-blinded ids when blinding required
1 parent 228fd3e commit 32527e1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

sogs/routes/auth.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from ..web import app
22
from ..db import query
3-
from .. import crypto, http, utils
3+
from .. import config, crypto, http, utils
44
from ..model.user import User
55
from ..hashing import blake2b
66

@@ -247,8 +247,11 @@ def handle_http_auth():
247247
pk = VerifyKey(pk)
248248
if blinded_pk:
249249
session_id = '15' + pk.encode().hex()
250+
elif config.REQUIRE_BLIND_KEYS:
251+
abort_with_reason(
252+
http.BAD_REQUEST, "Invalid authentication: this server requires the use of blinded ids"
253+
)
250254
else:
251-
# TODO: if "blinding required" config option is set then reject the request here
252255
try:
253256
session_id = '05' + pk.to_curve25519_public_key().encode().hex()
254257
except nacl.exceptions.RuntimeError:

0 commit comments

Comments
 (0)