{"id":"XE-13240","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"369","source_url":"https://github.com/xeprotocol/xe/issues/369","reporter_id":2,"title":"[SDK] jobs: runJob builds remote Linux guest paths with host node:path, breaking uploads and result collection from Windows","area":"sdk-docs-web","claimed_tier":null,"assessed_tier":null,"verdict":"duplicate","duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"closed","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-14T20:42:02.715281+00:00","updated_at":"2026-11-20T00:07:05.736919+00:00","source_created_at":"2026-11-11T10:12:12+00:00","told_at":"2026-11-20T00:05:04+00:00","status_changed_at":"2026-11-20T00:04:39.163786+00:00","url":"https://bounty.xe.network/XE-13240","body":"### Summary\n\n`@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`.\n\n### Impact (`sdk-docs-web`, Medium)\n\n1. **Broken uploads & result collection from Windows hosts**:\n   - On Windows (`path.sep === '\\\\'`), `join('/root/job', 'src/app.py')` produces `'\\\\root\\\\job\\\\src\\\\app.py'` and `dirname(...)` produces `'\\\\root\\\\job\\\\src'`.\n   - `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'`).\n2. **Unbounded relative path traversal out of `JOB_DIR`**:\n   - 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`.\n3. **Browser test runner config**:\n   - `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.\n\n### Rule\n\nEvery 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`).\n\n### Reproduction\n\nOn 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/...`.\n\n### Proposed Fix\n\nReady-to-merge patch + unit/browser regression suite submitted in https://github.com/xeprotocol/sdk/pull/15.\n","patch_refs":[],"thread":[{"id":12812,"source":"github","source_ref":"7025802236","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, file a new report that links https://bounty.xe.network/XE-13240 and says what differs; it is read like any other.","created_at":"2026-11-20T00:05:04+00:00"}]}