fix(folders): stop exposing every root folder to admins
PR — Ouverture automatique / create-pr (push) Successful in 3s

The listing applied an admin bypass that showed all private root folders
of other accounts, contradicting access.ts policy (admin role grants no
folder-level rights). Remove it: visibility is now owner, public, or
traversable share only.
This commit is contained in:
2026-10-19 15:44:54 +02:00
parent d63be65ad1
commit a97a3fcf5d
+3 -6
View File
@@ -129,14 +129,11 @@ export const registerFolderRoutes = (app: App, db: Db, config: Config): void =>
[parentId],
);
// Un enfant est visible s'il est lisible directement ou s'il mene a un partage.
// Un enfant est visible s'il est lisible directement ou s'il mene a un
// partage. Le role admin ne donne aucun droit special ici (voir access.ts).
const visible: FolderRow[] = [];
for (const row of rows) {
if (
user.role_slug === "admin" ||
row.owner_id === user.id ||
(await canTraverse(db, user, row.id))
) {
if (row.owner_id === user.id || (await canTraverse(db, user, row.id))) {
visible.push(row);
}
}