Skip to content

Contents permissions and RTC #948

@davidbrochart

Description

@davidbrochart

Problem

With RTC, the contents API is shifting to the YDocWebSocketHandler, which e.g. handles saving documents automatically after a change. There is no PUT /api/contents/{path} endpoint that we can restrict to users having a contents:write permission, for instance. I see two ways of handling contents permissions in RTC:

  1. The YDocWebSocketHandler can be protected with contents:write, but it means that the WebSocket should be accepted for a user who has only contents:read, and the Y updates which change the document should be filtered out for this user. In other words, the authorization is moving from an HTTP protocol level to a Y protocol level.
  2. Another direction would be to let the responsibility to front-ends to allow a user to change a document. Indeed, they know if a user has write permissions through the /api/me endpoint. That way, no Y update would be emitted for a user lacking write permissions, and the server would not even need to care about authorization at the Y protocol level.

Note that even for solution 1, the front-end has to disable changes to the document, otherwise the user would see that they're changing the document while in reality it wouldn't be true. It would even be catastrophic because the local document would loose synchronization with the remote document.
But relying on front-ends for authorization (solution 2) could potentially open the door to malicious apps that could give users more rights than they have, so there might be a security risk.

cc @dmonad @SylvainCorlay @ellisonbg @afshin @minrk

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions