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

+4 -1
View File
@@ -43,7 +43,10 @@ export async function processWebhook(
if (!groups.some((g) => g.id === tenantId)) {
return { status: 404, body: { error: "Group not found" } };
}
const secret = await getTenantSecret(env.KV, tenantId);
const secret = await getTenantSecret(
env.KV,
groups.find((g) => g.id === tenantId)!,
);
if (!secret) {
return { status: 404, body: { error: "Webhook disabled for this group" } };
}