[hardening][page-templates] Defense-in-depth: workspace checks + throttle fan-out #36
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
From review of #17 (merged to develop). None of these are currently exploitable; they are consistency / defense-in-depth.
toggleTemplate(apps/server/src/core/page/transclusion/page-template.controller.ts) has no explicitpage.workspaceId === user.workspaceIdcheck; it relies on the space-membership model (a cross-workspace page yields no space role -> NotFound). Add an explicit check likeunsyncReferencefor consistency.PageTemplateReferencesRepo.deleteByReferenceAndSourcesis not workspace-scoped (filters only by referencePageId + sourcePageId). AddworkspaceIdfor consistency with the "scope by workspaceId everywhere" invariant.PAGE_TEMPLATE_THROTTLERallows 30 req/min x 50 ids = up to ~1500 full ProseMirror docs/min/user, while the recursion/depth guard is client-only. Consider monitoring or a tighter limit.Severity: low.