Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

When a backfill request is 403'd over federation, the client is sent a 500. #5814

Closed
Half-Shot opened this issue Aug 2, 2019 · 1 comment
Labels
A-Messages-Endpoint /messages client API endpoint (`RoomMessageListRestServlet`) (which also triggers /backfill) z-bug (Deprecated Label) z-p2 (Deprecated Label)

Comments

@Half-Shot
Copy link
Collaborator

2019-08-02 11:30:29,224 - synapse.http.matrixfederationclient - 520 - WARNING - GET-1347183- {GET-O-6433} [kde.org] Request failed: GET matrix://kde.org/_matrix/federation/v1/backfill/%21tkjKPHGiiaARNcYnyZ%3Amatrix.org?v=%24156345231212240nRfCP%3Akde.org&limit=100: HttpResponseException("403: b'Forbidden'")
2019-08-02 11:30:29,226 - synapse.http.server - 108 - ERROR - GET-1347183- Failed handle request via 'RoomMessageListRestServlet': <XForwardedForRequest at 0x7fa023390fd0 method='GET' uri='/_matrix/client/r0/rooms/!tkjKPHGiiaARNcYnyZ%3Amatrix.org/messages?from=s31156778_190146386_388_12815145_147699_1000_124576_774830_47&limit=20&dir=b&filter=%7B%22lazy_load_members%22%3Atrue%7D' clientproto='HTTP/1.0' site=8008>
Traceback (most recent call last):
  File "/srv/matrix/synapse/lib/python3.7/site-packages/synapse/http/server.py", line 76, in wrapped_request_handler
    await h(self, request)
  File "/srv/matrix/synapse/lib/python3.7/site-packages/synapse/http/server.py", line 315, in _async_render
    callback_return = await callback_return
  File "/srv/matrix/synapse/lib/python3.7/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/srv/matrix/synapse/lib/python3.7/site-packages/twisted/python/failure.py", line 512, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/srv/matrix/synapse/lib/python3.7/site-packages/synapse/logging/opentracing.py", line 480, in _trace_servlet_inner
    result = yield defer.maybeDeferred(func, request, *args, **kwargs)
  File "/srv/matrix/synapse/lib/python3.7/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/srv/matrix/synapse/lib/python3.7/site-packages/twisted/python/failure.py", line 512, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/srv/matrix/synapse/lib/python3.7/site-packages/synapse/rest/client/v1/room.py", line 510, in on_GET
    event_filter=event_filter,
  File "/srv/matrix/synapse/lib/python3.7/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/srv/matrix/synapse/lib/python3.7/site-packages/twisted/python/failure.py", line 512, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/srv/matrix/synapse/lib/python3.7/site-packages/synapse/handlers/pagination.py", line 222, in get_messages
    room_id, max_topo
  File "/srv/matrix/synapse/lib/python3.7/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/srv/matrix/synapse/lib/python3.7/site-packages/twisted/python/failure.py", line 512, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/srv/matrix/synapse/lib/python3.7/site-packages/synapse/handlers/federation.py", line 990, in maybe_backfill
    success = yield try_backfill(likely_domains)
  File "/srv/matrix/synapse/lib/python3.7/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/srv/matrix/synapse/lib/python3.7/site-packages/twisted/python/failure.py", line 512, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/srv/matrix/synapse/lib/python3.7/site-packages/synapse/handlers/federation.py", line 963, in try_backfill
    dom, room_id, limit=100, extremities=extremities
  File "/srv/matrix/synapse/lib/python3.7/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/srv/matrix/synapse/lib/python3.7/site-packages/twisted/python/failure.py", line 512, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/srv/matrix/synapse/lib/python3.7/site-packages/synapse/handlers/federation.py", line 658, in backfill
    dest, room_id, limit=limit, extremities=extremities
  File "/srv/matrix/synapse/lib/python3.7/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/srv/matrix/synapse/lib/python3.7/site-packages/twisted/python/failure.py", line 512, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/srv/matrix/synapse/lib/python3.7/site-packages/synapse/federation/federation_client.py", line 196, in backfill
    dest, room_id, extremities, limit
  File "/srv/matrix/synapse/lib/python3.7/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/srv/matrix/synapse/lib/python3.7/site-packages/twisted/python/failure.py", line 512, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/srv/matrix/synapse/lib/python3.7/site-packages/synapse/http/matrixfederationclient.py", line 774, in get_json
    timeout=timeout,
  File "/srv/matrix/synapse/lib/python3.7/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/srv/matrix/synapse/lib/python3.7/site-packages/twisted/python/failure.py", line 512, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/srv/matrix/synapse/lib/python3.7/site-packages/synapse/http/matrixfederationclient.py", line 241, in _send_request_with_optional_trailing_slash
    response = yield self._send_request(request, **send_request_args)
  File "/srv/matrix/synapse/lib/python3.7/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
    result = g.send(result)
  File "/srv/matrix/synapse/lib/python3.7/site-packages/synapse/http/matrixfederationclient.py", line 475, in _send_request
    raise e
synapse.api.errors.HttpResponseException: 403: b'Forbidden'
2019-08-02 11:30:29,228 - synapse.access.http.8008 - 302 - INFO - GET-1347183- - - 8008 - {@Half-Shot:half-shot.uk} Processed request: 0.207sec/0.001sec (0.026sec, 0.007sec) (0.001sec/0.053sec/3) 55B 500 "GET /_matrix/client/r0/rooms/!tkjKPHGiiaARNcYnyZ%3Amatrix.org/messages?from=s31156778_190146386_388_12815145_147699_1000_124576_774830_47&limit=20&dir=b&filter=%7B%22lazy_load_members%22%3Atrue%7D HTTP/1.0" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Riot/1.3.0 Chrome/69.0.3497.128 Electron/4.2.6 Safari/537.36" [0 dbevts]

The client should surely be sent a 403, so they won't endlessly try to backfill messages they do not have access to.

@neilisfragile neilisfragile added z-bug (Deprecated Label) z-p2 (Deprecated Label) labels Aug 6, 2019
@richvdh
Copy link
Member

richvdh commented Feb 6, 2020

The client should surely be sent a 403, so they won't endlessly try to backfill messages they do not have access to.

This assumes that the 403 is correct, which there isn't any guarantee of.

I'm going to close this as a dup of #3736.

@richvdh richvdh closed this as completed Feb 6, 2020
@MadLittleMods MadLittleMods added the A-Messages-Endpoint /messages client API endpoint (`RoomMessageListRestServlet`) (which also triggers /backfill) label Jun 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Messages-Endpoint /messages client API endpoint (`RoomMessageListRestServlet`) (which also triggers /backfill) z-bug (Deprecated Label) z-p2 (Deprecated Label)
Projects
None yet
Development

No branches or pull requests

4 participants