mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 16:02:32 +00:00
fix(preflight): reject Windows paths from WSL agent lookup (#7994)
* fix(preflight): reject Windows paths from WSL lookup WSL agent discovery previously treated path.win32 absolute results as valid guest paths, so a Windows absolute path like C:\spoof could be counted as a found agent. Only POSIX absolute paths are valid inside WSL. * docs(preflight): explain WSL path boundary * docs(preflight): correct WSL path rejection rationale Co-authored-by: Orca <help@stably.ai> --------- Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -78,11 +78,11 @@ describe('detectWslCommandsOnPath', () => {
|
||||
|
||||
it('ignores commands whose resolved path is not absolute', async () => {
|
||||
execFileAsyncMock.mockResolvedValue({
|
||||
stdout: '__ORCA_AGENT_PATH__claude\tclaude\n',
|
||||
stdout: '__ORCA_AGENT_PATH__claude\tclaude\n' + '__ORCA_AGENT_PATH__codex\tC:\\spoof\n',
|
||||
stderr: ''
|
||||
})
|
||||
|
||||
const found = await detectWslCommandsOnPath({ distro: 'Ubuntu' }, ['claude'])
|
||||
const found = await detectWslCommandsOnPath({ distro: 'Ubuntu' }, ['claude', 'codex'])
|
||||
|
||||
expect(found).toEqual(new Set())
|
||||
})
|
||||
|
||||
@@ -114,7 +114,9 @@ function parseWslDetectedCommands(stdout: string): Set<string> {
|
||||
}
|
||||
const command = payload.slice(0, separatorIndex)
|
||||
const resolvedPath = payload.slice(separatorIndex + 1)
|
||||
if (path.posix.isAbsolute(resolvedPath) || path.win32.isAbsolute(resolvedPath)) {
|
||||
// Why: a real guest executable always resolves to a POSIX-absolute path, so
|
||||
// a Windows-style C:\ path here is spoofed/non-guest output, not an install.
|
||||
if (path.posix.isAbsolute(resolvedPath)) {
|
||||
found.add(command)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user