html-embed: upgrade create/duplicate/import gate tests from source-regex to real execution #27

Closed
opened 2026-06-20 20:31:53 +03:00 by Ghost · 0 comments

Found in security review of PR #16 (merged in 7a03321d).

Severity: medium (test quality; production code is correct).

The gate tests for the create/duplicate/import write paths assert gate presence with brittle expect(SRC).toMatch(/regex/) against the source text and a reimplemented applyGate() stand-in, instead of executing the real methods with a member role and asserting the embed is actually stripped.

  • Files: apps/server/src/core/page/services/page-service-html-embed-identity.spec.ts (~L80-102), apps/server/src/integrations/import/services/import-html-embed-identity.spec.ts (~L91-121).
  • Risk: a refactor (renamed variable, reordered logic) could break the real gate while these tests still pass.
  • Gate paths with no behavioral test: page.service.create(), page.service.duplicatePage(), import.service, file-import-task.service.

Fix: rewrite to execute the real methods with a non-admin/member role and assert a member's embed is stripped end-to-end, matching the quality of the existing collab/persistence/share specs.

Found in security review of PR #16 (merged in 7a03321d). **Severity: medium (test quality; production code is correct).** The gate tests for the create/duplicate/import write paths assert gate presence with brittle `expect(SRC).toMatch(/regex/)` against the source text and a reimplemented `applyGate()` stand-in, instead of executing the real methods with a member role and asserting the embed is actually stripped. - Files: `apps/server/src/core/page/services/page-service-html-embed-identity.spec.ts` (~L80-102), `apps/server/src/integrations/import/services/import-html-embed-identity.spec.ts` (~L91-121). - Risk: a refactor (renamed variable, reordered logic) could break the real gate while these tests still pass. - Gate paths with no behavioral test: `page.service.create()`, `page.service.duplicatePage()`, `import.service`, `file-import-task.service`. **Fix:** rewrite to execute the real methods with a non-admin/member role and assert a member's embed is stripped end-to-end, matching the quality of the existing collab/persistence/share specs.
Ghost added the test label 2026-06-21 02:27:17 +03:00
Ghost closed this issue 2026-06-21 03:02:06 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vvzvlad/gitmost#27