Repository navigation
Description
Summary
The documented HOMELAB_PI_KEY_PATH=~/.ssh/id_ed25519 never loads, because ~ is not expanded before readFileSync. Anyone who copies the README config gets every tool failing with ENOENT.
Where
mcp-server/src/utils/ssh-api.ts:170(execSSH,privateKey: keyPath ? readFileSync(keyPath) : undefined)mcp-server/src/utils/ssh-api.ts:42,:58(key path read from env /HOMELAB_NODESas-is)- Docs that use
~:README.md:151,mcp-server/README.md:76,112,.env.example:4,docs/index.html/site.json .github/workflows/e2e.yml(HOMELAB_PI_KEY_PATH: ~/.ssh/pi_key, a literal string inenv:)
Details
MCP clients pass env values literally (no shell), and GitHub Actions env: values are literal too. Node does not expand ~, so readFileSync('~/.ssh/id_ed25519') throws ENOENT. Nothing in mcp-server/src uses os.homedir().
The throw also happens inside the Promise executor after the 30s timer is armed (ssh-api.ts:111-115), so the timer is never cleared and the error surfaces as a raw ENOENT instead of an SSHAuthError with a suggestion.
Impact
First-run failure for anyone following the README. The weekly live-Pi e2e workflow also cannot load its key.
Steps to reproduce
- Set
HOMELAB_PI_KEY_PATHto~/.ssh/id_ed25519exactly as inREADME.md:151. - Call
homelab_sshTest. - Result:
ENOENT: no such file or directory, open '~/.ssh/id_ed25519'.
Suggested fix
- Expand a leading
~(~/or~\) withos.homedir()andpath.resolvefor both the default config andHOMELAB_NODESentries. - Read the key before creating the timer/Promise, and wrap read failures in an
SSHAuthErrorthat names the path. - In
e2e.yml, use an absolute path (for example${{ runner.temp }}/pi_key).
Acceptance criteria
-
~/...key paths work on Linux, macOS, and Windows - A missing key file gives a clear auth error and leaves no pending timer
- Unit test covers tilde expansion
- e2e workflow uses an absolute key path
Getting started
- Relevant files:
mcp-server/src/utils/ssh-api.ts,.github/workflows/e2e.yml - How to run tests:
cd mcp-server && npm install && npm test
Filed by repo-audit/full-audit at 9cfe5e3. Severity: high. Effort: S. audit-key: bug|mcp-server/src/utils/ssh-api.ts|execSSH.privateKey
Activity
ShahadatTest commentedon Nov 3, 2026
I'll take this — expand leading ~ in HOMELAB_PI_KEY_PATH / node key paths, wrap missing-key reads as SSHAuthError before arming the timer, and use an absolute path in e2e.
TMHSDigital commentedon Nov 3, 2026
I completely missed this, sorry! On the road but will review ASAP.