test: cover movePage server-side cycle guard (#67) #102

Closed
opened 2026-06-21 05:05:38 +03:00 by Ghost · 0 comments

PR #101 (commit 212bcea4, closes #67) added a server-side cycle guard in movePage — apps/server/src/core/page/services/page.service.ts (~L991-1007) — to stop MCP/REST/agent callers bypassing the client-side check.

Gap: no spec covers either branch. page.service.spec.ts is a should be defined smoke test only; nothing references movePage/"own subtree".

Needed (would fail on pre-fix code): unit test mocking pageRepo.findById + getPageBreadCrumbs:

  • self-move (parentPageId === pageId) throws BadRequestException before any updatePage;
  • destination whose breadcrumb chain contains pageId throws;
  • a legitimate move (pageId absent from ancestors) proceeds to updatePage.

Found in code review of PR #101.

PR #101 (commit 212bcea4, closes #67) added a server-side cycle guard in `movePage` — apps/server/src/core/page/services/page.service.ts (~L991-1007) — to stop MCP/REST/agent callers bypassing the client-side check. **Gap:** no spec covers either branch. `page.service.spec.ts` is a `should be defined` smoke test only; nothing references `movePage`/"own subtree". **Needed** (would fail on pre-fix code): unit test mocking `pageRepo.findById` + `getPageBreadCrumbs`: - self-move (`parentPageId === pageId`) throws `BadRequestException` **before** any `updatePage`; - destination whose breadcrumb chain contains `pageId` throws; - a legitimate move (pageId absent from ancestors) proceeds to `updatePage`. _Found in code review of PR #101._
Ghost added the testsecurity labels 2026-06-21 05:05:38 +03:00
Ghost closed this issue 2026-06-21 14:10:35 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vvzvlad/gitmost#102