Skip to content

Commit feffb67

Browse files
committed
Fix unblinded legacy auth
Legacy endpoints were still allowing unblinded authentication (using the very old query string and "Authorization" headers). This rejects legacy auth from resolving to a 05 session_id (which bypassed blinding-required authentication rules).
1 parent ea27471 commit feffb67

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sogs/routes/legacy.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from flask import abort, request, jsonify, g, Blueprint
1+
from flask import abort, request, jsonify, g, Blueprint, Response
22
from werkzeug.exceptions import HTTPException
33
from ..web import app
44
from .. import crypto, config, db, http, utils
@@ -68,6 +68,10 @@ def legacy_check_user_room(
6868
if not pubkey or len(pubkey) != (utils.SESSION_ID_SIZE * 2) or not pubkey.startswith('05'):
6969
app.logger.warning("cannot get pubkey for checking room permissions")
7070
abort(http.BAD_REQUEST)
71+
if config.REQUIRE_BLIND_KEYS and pubkey.startswith('05'):
72+
msg = "Invalid authentication: this server requires the use of blinded ids"
73+
app.logger.warning(msg)
74+
abort(Response(msg, status=http.BAD_REQUEST, mimetype='text/plain'))
7175

7276
if room is None:
7377
if room_token is None:

0 commit comments

Comments
 (0)