mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-06 08:18:39 +00:00
Allow access to files outside cwd
This commit is contained in:
parent
4f2d5b15bf
commit
88c75a06f2
1 changed files with 5 additions and 9 deletions
|
|
@ -100,18 +100,14 @@ export class ClineIgnoreController {
|
|||
try {
|
||||
// Normalize path to be relative to cwd and use forward slashes
|
||||
const absolutePath = path.resolve(this.cwd, filePath)
|
||||
const relativePath = path.relative(this.cwd, absolutePath).replace(/\\/g, "/")
|
||||
const relativePath = path.relative(this.cwd, absolutePath).toPosix()
|
||||
|
||||
// Block access to paths outside cwd (those starting with '..')
|
||||
if (relativePath.startsWith("..")) {
|
||||
return false
|
||||
}
|
||||
|
||||
// Use ignore library to check if path should be ignored
|
||||
// Ignore expects paths to be path.relative()'d
|
||||
return !this.ignoreInstance.ignores(relativePath)
|
||||
} catch (error) {
|
||||
console.error(`Error validating access for ${filePath}:`, error)
|
||||
return false // Fail closed for security
|
||||
// console.error(`Error validating access for ${filePath}:`, error)
|
||||
// Ignore is designed to work with relative file paths, so will throw error for paths outside cwd. We are allowing access to all files outside cwd.
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue