<!-- XE-13240 · [SDK] jobs: runJob builds remote Linux guest paths with host node:path, breaking uploads and result collection from Windows · testnet -->
*Markdown view of <https://bounty.xe.network/XE-13240>. The page is the record; this is the same page for reading.*

XE-13240 · Bounty

# \[SDK\] jobs: runJob builds remote Linux guest paths with host node:path, breaking uploads and result collection from Windows

Closed · duplicate
—
[xe#369](https://github.com/xeprotocol/xe/issues/369)
filed 2026-11-11 10:12 UTC
by Khanhtnq

Verdict
:   Duplicate

Tier
:   —

Claimed
:   —

Area
:   SDK / docs / web

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-20 00:07 UTC

Told
:   2026-11-20 00:05 UTC

### Patches

None linked.

### History

- [543906](https://bounty.xe.network/log/543906) 2026-11-20 00:06 UTC github.state\_pushed
- [543901](https://bounty.xe.network/log/543901) 2026-11-20 00:06 UTC github.labels
- [543763](https://bounty.xe.network/log/543763) 2026-11-20 00:05 UTC reply.mirrored
- [543517](https://bounty.xe.network/log/543517) 2026-11-20 00:04 UTC proposal.adopted
- [543516](https://bounty.xe.network/log/543516) 2026-11-20 00:04 UTC reply.sent
- [543515](https://bounty.xe.network/log/543515) 2026-11-20 00:04 UTC ticket.status new → closed
- [542065](https://bounty.xe.network/log/542065) 2026-11-20 00:04 UTC proposal.adopted
- [542064](https://bounty.xe.network/log/542064) 2026-11-20 00:04 UTC ticket.facts area
- [542063](https://bounty.xe.network/log/542063) 2026-11-20 00:04 UTC proposal.adopted
- [542062](https://bounty.xe.network/log/542062) 2026-11-20 00:04 UTC ticket.facts
- [542061](https://bounty.xe.network/log/542061) 2026-11-20 00:04 UTC proposal.adopted
- [542060](https://bounty.xe.network/log/542060) 2026-11-20 00:04 UTC ticket.facts

[Full history](https://bounty.xe.network/log?ref=XE-13240) · [JSON](https://bounty.xe.network/v1/tickets/XE-13240) · [markdown](https://bounty.xe.network/XE-13240.md)

### Report

### Summary

`@xeprotocol/sdk/jobs` (`src/jobs/index.ts` in `xeprotocol/sdk`) runs jobs on a Linux VM where `JOB_DIR` is `'/root/job'`, but `runJob` constructs remote SFTP and `mkdir -p` paths using host `node:path` (`join`, `dirname`) instead of `node:path/posix`.

### Impact (`sdk-docs-web`, Medium)

1. **Broken uploads \& result collection from Windows hosts**:
   - On Windows (`path.sep === '\\'`), `join('/root/job', 'src/app.py')` produces `'\\root\\job\\src\\app.py'` and `dirname(...)` produces `'\\root\\job\\src'`.
   - `exec(vm, 'mkdir -p ...')` creates literal backslash-named entries on the Linux guest rather than `/root/job/src`, and `writeRemote` / `readRemote` (`sftp.writeFile` / `sftp.readFile`) fail with SFTP `No such file` (`stage: 'upload'` or `'collect'`).
2. **Unbounded relative path traversal out of `JOB_DIR`**:
   - Caller-supplied keys in `options.files` (e.g. `'../.ssh/authorized_keys'` or `'/etc/cron.d/x'`) and `options.collect` were passed directly into `join(JOB_DIR, rel)` without verifying that the normalized remote path stays inside `/root/job`.
3. **Browser test runner config**:
   - `vitest.config.ts` included `test/**/*.test.ts` unconditionally even when invoked with `--browser`, where Node-only `@xeprotocol/sdk/jobs` (`ssh2` \+ `node:fs/promises`) cannot load.

### Rule

Every remote path resolved from `options.files`, `options.collect`, or `listRemote` for the Linux guest is normalized with `node:path/posix` and confined within `/root/job` (while host `saveTo` writes continue to use host `node:path`).

### Reproduction

On Windows (or simulating backslash inputs / parent segments in unit tests), call `runJob` with nested `files: { 'sub/input.txt': 'hello' }` and `collect: 'out'`. Observe `mkdir -p` and SFTP `writeFile`/`readFile` receive backslash-separated paths instead of `/root/job/sub/input.txt` and `/root/job/out/...`.

### Proposed Fix

Ready-to-merge patch \+ unit/browser regression suite submitted in https://github.com/xeprotocol/sdk/pull/15.

### Thread

**Joseph Denne**team2026-11-20 00:05 UTCgithub

Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the
first verifiable submission, so this one closes as a duplicate. If you believe it is a different
bug, file a new report that links https://bounty.xe.network/XE-13240 and says what differs; it is read like any other.
