test: cover Vite fs deny hardening

This commit is contained in:
blowing-a-raspberry committed 2026-10-18 15:55:56 -05:00
1 parent 1b641fde9f
commit e3e4fc7284
4 files changed
+23 -3

No files matched your search

+5 -1
View File
@@ -18,7 +18,11 @@ const REPO_ROOT = fileURLToPath(new URL('..', import.meta.url))
.replace(/\\/g, '/')
.replace(/\/$/, '');
const REPO_ROOT_GLOB = REPO_ROOT.replace(/[()[\]{}*?!+@|]/g, '\\$&');
export function escapeFsDenyPath(path) {
return path.replace(/[()[\]{}*?!+@|]/g, '\\$&');
}
const REPO_ROOT_GLOB = escapeFsDenyPath(REPO_ROOT);
/**
* Content-Security-Policy for every document the dev/preview server serves.