Skip to content

Commit 8d3243b

Browse files
test(wordpress): bind browser isolation to recorded parent namespace
1 parent 645b218 commit 8d3243b

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

‎docs/WORDPRESS.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,8 +696,8 @@ The edit-screen final-close metabox links to the private queue; it never nests a
696696
second form inside WordPress's post editor. Its actual projected database row
697697
includes every field required by the trusted-event validator. For an offline
698698
browser regression, run the standalone report fixture with
699-
`CT_SCAN_METABOX_DOM_FIXTURE` set to a new private HTML path, then invoke
700-
`standalone-tests/metabox-dom.mjs` under `bwrap --unshare-net` with that HTML,
699+
`CT_SCAN_METABOX_DOM_FIXTURE` set to a new private HTML path, record the current `/proc/self/ns/net` value in `CT_SCAN_DOM_PARENT_NETNS`,
700+
then invoke `standalone-tests/metabox-dom.mjs` under `bwrap --unshare-net` with that HTML,
701701
an already-installed Playwright module path and Chromium executable. The check
702702
intercepts ordinary post saving and requires one original post action/nonce,
703703
intact form ownership and zero network requests; it sends no submission.

‎integrations/wordpress/standalone-tests/metabox-dom.mjs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import fs from 'node:fs';
33
import { pathToFileURL } from 'node:url';
44
const [htmlPath, playwrightPath, chromiumPath] = process.argv.slice(2);
55
if (!htmlPath || !playwrightPath || !chromiumPath) throw new Error('HTML, installed Playwright module, Chromium executable required');
6-
if(fs.readlinkSync('/proc/self/ns/net')===fs.readlinkSync('/proc/1/ns/net')) throw new Error('Browser check requires an isolated network namespace');
6+
const parentNetns=process.env.CT_SCAN_DOM_PARENT_NETNS;
7+
if(!/^net:\[\d+\]$/.test(parentNetns||'')||fs.readlinkSync('/proc/self/ns/net')===parentNetns) throw new Error('Browser check requires a recorded parent and isolated network namespace');
78
const { chromium } = await import(pathToFileURL(playwrightPath).href);
89
const browser = await chromium.launch({executablePath: chromiumPath, headless:true,
910
args:['--no-sandbox','--disable-background-networking','--disable-dev-shm-usage']});

0 commit comments

Comments
 (0)