-
Notifications
You must be signed in to change notification settings - Fork 376
Description
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:
- The
YDocWebSocketHandlercan be protected withcontents:write, but it means that the WebSocket should be accepted for a user who has onlycontents: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. - 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/meendpoint. 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.