fix(folders): stop exposing every root folder to admins
PR — Ouverture automatique / create-pr (push) Successful in 3s
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user