GHSA-wj7x-58c2-5793: Daptin: Broken Access Control (IDOR) in the generic YJS collaboration endpoint
- Source:
- OSV.dev
- Published:
- Fetched:
- Updated:
- Affects:
- github.com/daptin/daptin
https://osv.dev/vulnerability/GHSA-wj7x-58c2-5793 ↗
Daptin: Broken Access Control (IDOR) in the generic YJS collaboration endpoint ### Summary Daptin registers a generic WebSocket endpoint, `GET /yjs/:documentName`, for real-time collaborative document editing (YJS/CRDT). Unlike its purpose-built sibling route, this generic endpoint performs no per-resource authorization check - it only verifies that *some* user session exists. Because the document store parses `:documentName` as `typename.referenceId.columnName` and fetches that row's real column content unconditionally, any authenticated user (including a brand-new, zero-privilege, self-registered account) can read - and, since YJS sync is bidirectional, also write - the content of any `file.*`-typed column on any row of any table, including tables that are admin-only by default. ### Details `InitializeYjsResources` (`server/endpoint_yjs.go`) registers two routes. The purpose-built, correctly-secured route, registered once per `file.*`-typed column on every table: ```go // server/endpoint_yjs.go:47-113 (abridged) path := fmt.Sprintf("/live/%v/:referenceId/%v/yjs", typename, columnInfo.ColumnName) ... return func(ginContext *gin.Context) { sessionUser := ... if sessionUser == nil { ginContext.AbortWithStatus(403); return } ... object, _, getErr := cruds[typename].GetSingleRowByReferenceIdWithTransaction(typename, parsedId, nil, tx) if getErr != nil { ginContext.AbortWithStatus(404); return } ... objectPermission := cruds[typename].GetRowPermission(object, tx2) if !objectPermission.CanUpdate(user.UserReferenceId, user.Groups, cruds[typename].AdministratorGroupId) { ginContext.AbortWithStatus(401) return } roomName := fmt.Sprintf("%v%v%v%v%v", typename, ".", referenceId, ".", columnInfo.ColumnName) ... yjsConnectionHandler(ginContext.Writer, ginContext.Request) } ``` This route correctly requires a session, loads the actual row, and checks `objectPermission.CanUpdate(...)` for the specific requesting user before allowing the WebSocket upgrade. A second, generic route is registered right above it, with none of those checks: ```go // server/endpoint_yjs.go:27-38 defaultRouter.GET("/yjs/:documentName", func(ginContext *gin.Context) { sessionUser := ginContext.Request.Context().Value("user") if sessionUser == nil { ginContext.AbortWithStatus(403) return } yjsConnectionHandler(ginContext.Writer, ginContext.Request) }) ``` The only gate here is "is some session present" - there is no lookup of the referenced row, no `GetRowPermission`, no `CanUpdate`/`CanRead` check at all. `:documentName` is taken verbatim from the URL and handed straight to `yjsConnectionHandler`. The YJS document store's content provider parses `documentName` using exactly the `typename.referenceId.columnName` convention the secure route builds internally as `roomName`, and uses it to fetch the real row from the database with no authorization check of its own: ```go // server/yjs_doucment_provider.go:41-115 (abridged) ydb.WithInitialContentProvider(func(doc Affected: Go:github.com/daptin/daptin Fixed in: 0.12.30 References: https://github.com/daptin/daptin/security/advisories/GHSA-wj7x-58c2-5793 https://nvd.nist.gov/vuln/detail/CVE-2026-77369 https://github.com/daptin/daptin/commit/a1a3c48f88ce30632a57d3fe6a971033b23bd394 https://github.com/daptin/daptin https://github.com/daptin/daptin/releases/tag/v0.12.30