This commit is contained in:
1 parent
d5022d2d59
commit
cd2394dd22
19 files changed
+1757
-32
No files matched your search
@@ -53,6 +53,8 @@ async function resolveGrantedFile(grants, rootId, relativePath, options = {}) {
|
||||
if (typeof relativePath !== 'string' || relativePath.includes('\0') || path.isAbsolute(relativePath)
|
||||
|| /(?:^|[\\/])\.\.(?:[\\/]|$)|:/.test(relativePath)) throw new McpAccessError('PATH_NOT_GRANTED');
|
||||
const realRoot = await fs.realpath(grant.path);
|
||||
const expectedRoot = path.resolve(grant.path);
|
||||
if (process.platform === 'win32' ? realRoot.toLowerCase() !== expectedRoot.toLowerCase() : realRoot !== expectedRoot) throw new McpAccessError('PATH_NOT_GRANTED');
|
||||
const target = path.resolve(realRoot, relativePath || '.');
|
||||
if (!within(realRoot, target)) throw new McpAccessError('PATH_NOT_GRANTED');
|
||||
const realTarget = await fs.realpath(target);
|
||||
|
||||
Reference in new issue
Block a user