Skip to content
Snippets Groups Projects
Commit 75e517a2 authored by Mark Haines's avatar Mark Haines
Browse files

Remove debug logging, raise a proper SynapseError if the auth header is missing

parent 66848557
No related branches found
No related tags found
No related merge requests found
...@@ -24,6 +24,7 @@ over a different (albeit still reliable) protocol. ...@@ -24,6 +24,7 @@ over a different (albeit still reliable) protocol.
from twisted.internet import defer from twisted.internet import defer
from synapse.api.urls import FEDERATION_PREFIX as PREFIX from synapse.api.urls import FEDERATION_PREFIX as PREFIX
from synapse.api.errors import Codes, SynapseError
from synapse.util.logutils import log_function from synapse.util.logutils import log_function
import logging import logging
...@@ -230,8 +231,9 @@ class TransportLayer(object): ...@@ -230,8 +231,9 @@ class TransportLayer(object):
auth_headers = request.requestHeaders.getRawHeaders(b"Authorization") auth_headers = request.requestHeaders.getRawHeaders(b"Authorization")
if not auth_headers: if not auth_headers:
#TODO(markjh): Send a 401 response? raise SynapseError(
raise Exception("Missing auth headers") 401, "Missing Authorization headers", Codes.FORBIDDEN,
)
for auth in auth_headers: for auth in auth_headers:
if auth.startswith("X-Matrix"): if auth.startswith("X-Matrix"):
...@@ -239,9 +241,6 @@ class TransportLayer(object): ...@@ -239,9 +241,6 @@ class TransportLayer(object):
json_request["origin"] = origin json_request["origin"] = origin
json_request["signatures"].setdefault(origin,{})[key] = sig json_request["signatures"].setdefault(origin,{})[key] = sig
from syutil.jsonutil import encode_canonical_json
logger.debug("Checking %s %s",
origin, encode_canonical_json(json_request))
yield self.keyring.verify_json_for_server(origin, json_request) yield self.keyring.verify_json_for_server(origin, json_request)
defer.returnValue((origin, content)) defer.returnValue((origin, content))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment