From 89ddf5a3477f58a4287c00cb7dab827af8286948 Mon Sep 17 00:00:00 2001 From: thatguywob Date: Thu, 5 Nov 2026 10:57:29 +0000 Subject: [PATCH] fix(page-frames): treat the Pages alias as same-origin Prevent frames using the redirecting GitHub Pages host from escaping the same-origin sandbox restriction. Hive-Run: hivecommons/hivecommons.github.io#349 Hive-Plan: page-frames-origin-alias Hive-Spec: issue-349#same-origin-alias Signed-off-by: thatguywob --- README.md | 7 ++++--- scripts/page-frames.test.mjs | 36 +++++++++++++++++++++++++++++++----- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c843db6..9726ab1 100644 --- a/README.md +++ b/README.md @@ -64,9 +64,10 @@ red PR job against. - `node --test scripts/page-frames.test.mjs` — static gate over every ``)), [ + `line 2 `)), []); + } +}); + +test("fixture: unrelated GitHub Pages sites and lookalike domains stay cross-origin", () => { + for (const src of [ + "https://other.github.io/project/", + "https://hivecommons.github.io.example.org/project/", + ]) { + assert.equal(isSameOriginFrame(``)), []); + } +}); + test("fixture: a frame without sandbox is reported with its line and src", () => { assert.deepEqual(frameProblems(page('')), [ 'line 2