feat(PR-05): pure static export and hardened Live boundary
- export.rs: marqdo view export PATH --out DIR through the same ReaderRenderer; index.html + pages/<relative>.html + hash-named assets + manifest.json - export never calls Core run; refuses output inside project root and unrelated non-empty dirs; staging + atomic rename replaces only prior View exports - offline by construction: embedded asset bytes, data-URI images, relative links, no remote subresources; --no-annotations hides anchors only - HTTP hardening: max 32 concurrent requests (503), detail-free public error JSON/pages (no absolute paths/subprocess text), 30s page check budget - tools/test-export.sh (manifest hashes + file:// Chromium offline check), tools/test-security.sh, adversarial security-project browser fixture - tests/export.rs export contracts; ADR-0005; docs updated
This commit is contained in:
1 parent
9a80272b5f
commit
1f34daffb0
20 files changed
+983
-19
No files matched your search
@@ -115,6 +115,24 @@ function localHostOnly(url) {
|
||||
);
|
||||
await page.keyboard.press("Escape");
|
||||
|
||||
if (projectName === "security-project") {
|
||||
// X-01: an adversarial document must not execute script or fetch anything.
|
||||
let alertFired = false;
|
||||
page.on("dialog", async (dialog) => {
|
||||
alertFired = true;
|
||||
await dialog.dismiss();
|
||||
});
|
||||
await page.reload({ waitUntil: "networkidle" });
|
||||
check("adversarial doc has no alert dialog", !alertFired);
|
||||
check("adversarial doc has no external requests", external.length === 0, external.join(", "));
|
||||
check("raw HTML omitted note rendered", (await page.locator(".mq-raw-omitted").count()) > 0);
|
||||
check("prose survives sanitization", (await page.locator(".mq-document").innerText()).includes("普通正文"));
|
||||
check(
|
||||
"javascript link neutralized",
|
||||
(await page.locator('a[href^="javascript:"]').count()) === 0
|
||||
);
|
||||
}
|
||||
|
||||
if (projectName === "welcome") {
|
||||
check("welcome hero only on configured page", (await page.locator(".mq-welcome").count()) === 1);
|
||||
check(
|
||||
|
||||
Reference in new issue
Block a user