mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-18 16:08:56 +00:00
* fix(studio-server): keep cache writes inside the project and canonicalize preview paths - The tool's own folders (.hyperframes records, backups, preview documents, .thumbnails, .transcode-cache) are no longer written, pruned or emptied through a link that points outside the project. Thumbnails are still served when their cache folder is a link; they are just not cached. - The hf-id stamp record and the history id are replaced atomically instead of written through an existing link. - Sub-composition previews and thumbnails use the composition's canonical project-relative path, and the path is attribute-encoded in the document. - Thumbnail requests from another site are refused before any capture. - Saved GSAP scripts escape a `</script` sequence so the script element keeps its contents. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(core): refuse a UNC or device path on another root before any disk access isSafePath now rejects a target whose root is a UNC or device root other than the project's own before it calls realpath or lstat. Projects on a share keep working. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(studio): answer WebMCP clients only from Studio's own page The polyfill now starts with its tab transport limited to Studio's origin and its frame transport off, so a page that frames Studio cannot list or call its tools. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(inspector): check Host on the per-session preview server The preview page server applies the inspector API's loopback Host rule, so a rebound DNS name cannot read the bundled composition or project files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * revert(studio-server): keep writing media proxies through a linked .transcode-cache Refusing the folder made every proxied video in such a project answer 502. A linked cache folder now receives copies again; it is still never swept, so nothing already in the folder it points at is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(studio-server): drop a comment the comment ratchet refuses Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cli): skip HEIF and GIF preview prep when .hyperframes/prepared-assets is a link The preview transform wrote converted images into .hyperframes/prepared-assets through a link, so a project shipping .hyperframes as a link to another folder had files written there. Such a project now gets its preview with the images as written in the composition, unconverted, and nothing is written. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(studio-server): never sweep a linked .transcode-cache, from Studio or hyperframes clean The link check moves into cleanupProxyCache, which both Studio's cache maintenance and `hyperframes clean` call, so neither removes files from the folder a linked .transcode-cache points at. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import { describe, expect, it, vi } from "vitest";
|
|
|
|
// Windows path rules on any host, and a disk that records every look at it.
|
|
const probes = vi.hoisted(() => [] as string[]);
|
|
vi.mock("node:path", async () => {
|
|
const path = await vi.importActual<typeof import("node:path")>("node:path");
|
|
return { ...path.win32, default: path.win32 };
|
|
});
|
|
vi.mock("node:fs", async () => {
|
|
const fs = await vi.importActual<typeof import("node:fs")>("node:fs");
|
|
const missing = (path: string) => {
|
|
probes.push(path);
|
|
throw Object.assign(new Error(`ENOENT: ${path}`), { code: "ENOENT" });
|
|
};
|
|
const realpathSync = Object.assign(missing, { native: missing });
|
|
const mocked = { ...fs, realpathSync, lstatSync: missing };
|
|
return { ...mocked, default: mocked };
|
|
});
|
|
|
|
const { resolveWithinProject } = await import("./safePath.js");
|
|
|
|
describe("a request path on another network root", () => {
|
|
it.each([
|
|
"\\\\attacker.example\\share\\x.html",
|
|
"//attacker.example/share/x.html",
|
|
"\\\\?\\UNC\\attacker.example\\share\\x.html",
|
|
"\\\\.\\pipe\\x",
|
|
])("is refused without touching the disk: %s", (path) => {
|
|
probes.length = 0;
|
|
expect(resolveWithinProject("C:\\project", path)).toBeNull();
|
|
expect(probes).toEqual([]);
|
|
});
|
|
|
|
it("does not stop a project that itself lives on a share", () => {
|
|
probes.length = 0;
|
|
resolveWithinProject("\\\\nas\\films\\project", "scenes\\intro.html");
|
|
expect(probes.length).toBeGreaterThan(0);
|
|
});
|
|
});
|