mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-11-26 10:07:34 -05:00
Check that a user exports only their own personal data in a new middleware, RequireOwnUserID, so that the check can run before other middlewares on the route, such as a rate limit. The route passes the name of its user id parameter to it. The handler keeps its own check as well, as a safety net: exporting the data of one user to another must never happen, also when the route is changed by mistake. When that check catches a request, it logs an error, since the middleware must be missing. Both unescape the user id from the path, like the other handlers of the users endpoint do, and reject an empty one. The middleware answers 401 when there is no authenticated user. Requests for other users still get a 400, now with a JSON error body instead of a plain text one. Assisted-by: Claude Code:claude-opus-5-5