fix(admin): guard revisions and tenant targets

Read-time authorization alone cannot protect concurrent edits.
Guard revisions, current roles and destination ownership in the
write transaction, and use per-group endpoints for isolated changes.
This commit is contained in:
翅膀 committed 2026-10-23 23:23:37 +08:00
1 parent 4fc784ab9f
commit 2ec541ad7c
10 files changed
+2615 -300

No files matched your search

+8
View File
@@ -9,6 +9,9 @@ import {
adminApiMe,
adminApiGroupsGet,
adminApiGroupsPut,
adminGroupCreate,
adminGroupUpdate,
adminGroupDelete,
adminApiRoutesGet,
adminApiRoutesPut,
adminApiLogs,
@@ -40,6 +43,11 @@ export default defineEventHandler((event) => {
if (seg[0] === "groups" && seg.length === 1) {
if (method === "GET") return adminApiGroupsGet(event);
if (method === "PUT") return adminApiGroupsPut(event);
if (method === "POST") return adminGroupCreate(event);
}
if (seg[0] === "groups" && seg.length === 2) {
if (method === "PUT") return adminGroupUpdate(event, seg[1]!);
if (method === "DELETE") return adminGroupDelete(event, seg[1]!);
}
if (seg[0] === "routes" && seg.length === 1) {
if (method === "GET") return adminApiRoutesGet(event);