Skip to content

Commit 5c334a6

Browse files
Stvadclaude
andcommitted
fix(qa): fail closed if vite-qa can't find a deps root
If no ancestor of the worktree has node_modules/vite, the walk-up loop exits with depsRoot at the filesystem root, so `fs.allow: [worktreeRoot, '/']` would re-open the arbitrary-file-read hole the previous commit closed. Throw instead, refusing to start rather than allow-listing `/`. Verified: a path with no vite ancestor throws; the real worktree still resolves to the main checkout and boots (/@fs//etc/hosts stays 403). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 20ea57c commit 5c334a6

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

scripts/vite-qa.config.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ while (
3939
) {
4040
depsRoot = path.dirname(depsRoot)
4141
}
42+
// Fail CLOSED. If no ancestor has node_modules/vite, the loop above exits with
43+
// depsRoot at the filesystem root — allow-listing `/` would re-open the very
44+
// arbitrary-file-read hole this config exists to prevent. Refuse to start.
45+
if (!existsSync(path.join(depsRoot, 'node_modules', 'vite'))) {
46+
throw new Error(
47+
`vite-qa.config: no ancestor of ${worktreeRoot} has node_modules/vite — ` +
48+
`refusing to start rather than allow-list the filesystem root. ` +
49+
`Run from a worktree nested under an installed checkout.`,
50+
)
51+
}
4252

4353
export default defineConfig(async (env) => {
4454
const resolved = typeof base === 'function' ? await base(env) : base

0 commit comments

Comments
 (0)