chore: fix resolveProjectPath whitelist-root bypass
The scope check at routes/projects.ts:56 short-circuited when real === whitelistReal, allowing the whitelist directory itself to resolve as a valid project root. Dropped the `real !== whitelistReal` half of the && so the predicate becomes the strict prefix check. Flipped the unit test from a "BEHAVIOR GAP" assertion (documenting the bug) to a strict-rejection assertion. 23/23 tests still pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -53,7 +53,7 @@ export async function resolveProjectPath(
|
||||
return { error: 'path does not exist' };
|
||||
}
|
||||
const whitelistReal = await realpath(whitelist);
|
||||
if (real !== whitelistReal && !real.startsWith(whitelistReal + sep)) {
|
||||
if (!real.startsWith(whitelistReal + sep)) {
|
||||
return { error: `path must be under ${whitelist}` };
|
||||
}
|
||||
if (!(await isDir(real))) return { error: 'path is not a directory' };
|
||||
|
||||
Reference in New Issue
Block a user