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

Application Services are rate-limited by IP address on /login #8846

@anoadragon453

Description

@anoadragon453

Since MSC2778's implementation application services are able to use /login to login as an interested user and create a device which aids them in performing end-to-end encryption.

However, /login has a ratelimit on it which is IP-based:

async def on_POST(self, request: SynapseRequest):
self._address_ratelimiter.ratelimit(request.getClientIP())
login_submission = parse_json_object_from_request(request)
try:
if login_submission["type"] == LoginRestServlet.APPSERVICE_TYPE:
appservice = self.auth.get_appservice_by_req(request)
result = await self._do_appservice_login(login_submission, appservice)
elif self.jwt_enabled and (

This is obviously quite bad news for application services that need to login to a lot of user accounts on startup or somesuch. Currently there is no way to override this ratelimit.

As a solution, I propose only calling upon the ratelimiter for non uk.half-shot.msc2778.login.application_service identifier types (aka non-AS requests). If the request cannot be authenticated via an access token, it will immediately be rejected.

We may also want to move this line:

login_submission = parse_json_object_from_request(request)

as someone could technically supply a huge JSON body over and over and upset the server that way.

Metadata

Metadata

Assignees

Labels

A-Application-ServiceRelated to AS supportZ-Help-WantedWe know exactly how to fix this issue, and would be grateful for any contributionz-bug(Deprecated Label)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions