[test][page-templates] Cover client-side pageEmbed cycle / self-embed / depth guard #31

Closed
opened 2026-06-20 20:35:47 +03:00 by Ghost · 0 comments

From review of #17 (merged to develop).

The cycle / self-embed / depth guard (PAGE_EMBED_MAX_DEPTH = 5) lives only on the client in apps/client/src/features/editor/components/page-embed/page-embed-view.tsx and page-embed-ancestry-context.tsx. The server returns a single level and does not recurse (see the note in page-template.controller.ts: enforced CLIENT-side only), so this guard is the only protection against runaway nested rendering — and it is currently untested.

Client test infra exists (vitest + RTL). Add unit tests for:

  • ancestry chain / hostPageId construction in the provider;
  • isCycle (ancestor already in chain, and self-embed at top level via hostPageId === sourcePageId);
  • isTooDeep (chain length >= max depth);
  • picker excludes the host page (page-embed-picker.tsx).

Severity: high (correctness + anti-DoS).

From review of #17 (merged to develop). The cycle / self-embed / depth guard (`PAGE_EMBED_MAX_DEPTH = 5`) lives only on the client in `apps/client/src/features/editor/components/page-embed/page-embed-view.tsx` and `page-embed-ancestry-context.tsx`. The server returns a single level and does not recurse (see the note in `page-template.controller.ts`: enforced CLIENT-side only), so this guard is the **only** protection against runaway nested rendering — and it is currently untested. Client test infra exists (vitest + RTL). Add unit tests for: - ancestry `chain` / `hostPageId` construction in the provider; - `isCycle` (ancestor already in chain, and self-embed at top level via `hostPageId === sourcePageId`); - `isTooDeep` (chain length >= max depth); - picker excludes the host page (`page-embed-picker.tsx`). Severity: high (correctness + anti-DoS).
Ghost closed this issue 2026-06-21 02:05:27 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vvzvlad/gitmost#31