(absPath: string)
| 44 | } |
| 45 | |
| 46 | private isOutsideWorkspace(absPath: string): boolean { |
| 47 | // fix the /app/ vs /app mismatch bug and keep it secure |
| 48 | if (this.isRootTopRath()) return false; |
| 49 | const realTop = resolveRealPath(this.topPath); |
| 50 | const realPath = resolveRealPath(absPath); |
| 51 | if (!realTop || !realPath) return true; // If the path cannot be resolved, treat it as outside for safety |
| 52 | const relative = path.relative(realTop, realPath); |
| 53 | return relative === ".." || relative.startsWith(".." + path.sep) || path.isAbsolute(relative); |
| 54 | } |
| 55 | |
| 56 | toAbsolutePath(fileName: string = "") { |
| 57 | const topAbsolutePath = this.topPath; |
no test coverage detected