mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-22 06:32:00 +00:00
fix: validate multipass output paths
This commit is contained in:
@@ -7,6 +7,15 @@ describe("qa multipass runtime", () => {
|
||||
vi.unstubAllEnvs();
|
||||
});
|
||||
|
||||
it("rejects output directories outside the mounted repo root", () => {
|
||||
expect(() =>
|
||||
createQaMultipassPlan({
|
||||
repoRoot: process.cwd(),
|
||||
outputDir: "/tmp/qa-out",
|
||||
}),
|
||||
).toThrow("qa suite --runner multipass requires --output-dir to stay under the repo root");
|
||||
});
|
||||
|
||||
it("reuses suite scenario semantics and resolves mounted artifact paths", () => {
|
||||
const repoRoot = process.cwd();
|
||||
const outputDir = path.join(repoRoot, ".artifacts", "qa-e2e", "multipass-test");
|
||||
|
||||
@@ -234,7 +234,9 @@ function createQaMultipassOutputDir(repoRoot: string) {
|
||||
function resolveGuestMountedPath(repoRoot: string, hostPath: string) {
|
||||
const relativePath = path.relative(repoRoot, hostPath);
|
||||
if (relativePath.startsWith("..") || path.isAbsolute(relativePath) || relativePath.length === 0) {
|
||||
throw new Error(`unable to resolve Multipass mounted path for ${hostPath}`);
|
||||
throw new Error(
|
||||
`qa suite --runner multipass requires --output-dir to stay under the repo root (${repoRoot}), got ${hostPath}.`,
|
||||
);
|
||||
}
|
||||
return path.posix.join(MULTIPASS_MOUNTED_REPO_PATH, ...relativePath.split(path.sep));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user