Skip to content

Commit 445fe55

Browse files
committed
fix: validate multipass output paths
1 parent a04c331 commit 445fe55

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎extensions/qa-lab/src/multipass.runtime.test.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ describe("qa multipass runtime", () => {
77
vi.unstubAllEnvs();
88
});
99

10+
it("rejects output directories outside the mounted repo root", () => {
11+
expect(() =>
12+
createQaMultipassPlan({
13+
repoRoot: process.cwd(),
14+
outputDir: "/tmp/qa-out",
15+
}),
16+
).toThrow("qa suite --runner multipass requires --output-dir to stay under the repo root");
17+
});
18+
1019
it("reuses suite scenario semantics and resolves mounted artifact paths", () => {
1120
const repoRoot = process.cwd();
1221
const outputDir = path.join(repoRoot, ".artifacts", "qa-e2e", "multipass-test");

‎extensions/qa-lab/src/multipass.runtime.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,9 @@ function createQaMultipassOutputDir(repoRoot: string) {
234234
function resolveGuestMountedPath(repoRoot: string, hostPath: string) {
235235
const relativePath = path.relative(repoRoot, hostPath);
236236
if (relativePath.startsWith("..") || path.isAbsolute(relativePath) || relativePath.length === 0) {
237-
throw new Error(`unable to resolve Multipass mounted path for ${hostPath}`);
237+
throw new Error(
238+
`qa suite --runner multipass requires --output-dir to stay under the repo root (${repoRoot}), got ${hostPath}.`,
239+
);
238240
}
239241
return path.posix.join(MULTIPASS_MOUNTED_REPO_PATH, ...relativePath.split(path.sep));
240242
}

0 commit comments

Comments
 (0)