fix(knowledge): stop listing workspace knowledge bases on stale creator identity (#6454)

GET /api/knowledge without a workspaceId ORed on knowledge_base.user_id with no
permission check, so a user removed from a workspace kept seeing metadata for every
KB they created there. Scope the creator fallback to legacy KBs with no workspaceId,
matching the workspace-filtered branch and the detail path.
This commit is contained in:
Waleed
2026-08-08 15:08:09 -07:00
committed by GitHub
parent a477a5286c
commit 9883543eb2
3 changed files with 91 additions and 22 deletions
@@ -29,6 +29,8 @@ export function createMockSql() {
toSQL: () => ({ sql: strings.join('?'), params: values }),
/** Mirrors drizzle's `sql``…`.as(alias)` for aliased select expressions. */
as: (alias: string) => ({ ...fragment, alias }),
/** Mirrors drizzle's `sql``…`.mapWith(decoder)` for typed select expressions. */
mapWith: (decoder: unknown) => ({ ...fragment, decoder }),
}
return fragment
}