spawn/packages/cli/src/shared
A fbf7aaa067
Some checks are pending
CLI Release / Build and release CLI (push) Waiting to run
Lint / Biome Lint (push) Waiting to run
Lint / macOS Compatibility (push) Waiting to run
Lint / ShellCheck (push) Waiting to run
fix(security): use temp file for GitHub token to avoid process listing exposure (#3301)
* fix(security): use temp file for GitHub token to avoid process listing exposure

Fixes #3300

Agent: security-auditor
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix(security): pass GitHub token via heredoc instead of local temp file

The previous fix wrote the token to a temp file on the LOCAL host, but
the command string was executed on the REMOTE server via runner.runServer(),
so `cat` would fail with 'No such file or directory'. Switch to a heredoc
which is parsed by the remote shell and never appears in /proc/*/cmdline.

Agent: pr-maintainer
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix(security): upload token to remote via SCP instead of heredoc

The previous heredoc approach (`cat <<'EOF'`) doesn't work because all
cloud runners wrap commands in `bash -c ${shellQuote(cmd)}`, and heredocs
are not valid inside single-quoted bash -c strings.

Use runner.uploadFile() (SCP) to place the token on the remote server as
a temp file (mode 0600), then cat+rm it in the remote command. This is
the same proven pattern used by uploadConfigFile(). The local temp file
is always cleaned up after upload, and the remote temp file is cleaned up
both on success (inline rm) and on failure (best-effort rm).

Agent: security-auditor
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-14 21:56:13 +07:00
..
agent-setup.ts fix(security): use temp file for GitHub token to avoid process listing exposure (#3301) 2026-04-14 21:56:13 +07:00
agent-tarball.ts fix: extract tarballs directly to $HOME on non-root VMs (#3253) 2026-04-10 13:45:16 +07:00
agents.ts feat(security): add periodic security scan cron for VMs (#3214) 2026-04-06 23:29:14 -07:00
billing-guidance.ts fix: standardize ESM import extensions across 35 production files (#2827) 2026-03-20 08:51:40 -07:00
cloud-init.ts refactor(test): extract shouldSkipCloudInit helper and add unit tests (#2958) 2026-03-24 22:32:53 +07:00
cursor-proxy.ts fix(cursor): update proxy model list to current models (#3105) 2026-03-29 21:25:58 -07:00
oauth-constants.ts fix: restore hyphens in OAuth code regex + add regression test (#2171) 2026-03-03 22:52:29 -08:00
oauth.ts fix(spawn-fix): load API keys via config file, not just process.env (#3095) 2026-03-31 03:03:47 +07:00
orchestrate.ts fix(security): validate env var keys in skill injection (#3270) 2026-04-11 17:47:14 -07:00
parse.ts refactor: remove dead deepMerge export from parse.ts (#2663) 2026-03-15 13:57:47 -07:00
paths.ts fix(update): cache successful update checks for 1 hour (#2755) 2026-03-17 23:08:05 -07:00
result.ts refactor: replace indiscriminate try/catch with guarded Result helpers (#2477) 2026-03-10 18:55:07 -07:00
shell.ts feat: add Windows PowerShell support — remove bash dependency for local execution (#2727) 2026-03-17 16:35:23 -07:00
skills.ts fix(security): validate remotePath in injectInstructionSkill to prevent shell injection (#3276) 2026-04-11 17:50:05 -07:00
spawn-config.ts refactor: remove dead exported types from picker.ts and spawn-config.ts (#2553) 2026-03-12 21:43:05 -04:00
spawn-skill.ts fix: add pi agent and daytona cloud to embedded skill lists (#3172) 2026-04-04 14:52:05 +07:00
ssh-keys.ts fix: handle missing ssh-keygen in getSshFingerprint (#2926) 2026-03-24 06:50:45 +07:00
ssh-runner.ts fix: complete VM recovery rewrite for spawn fix command (#3178) 2026-04-05 11:27:47 +07:00
ssh.ts fix(ux): reduce SSH wait verbosity and clarify agent handoff (#3056) 2026-03-27 15:22:46 +07:00
star-prompt.ts feat(cli): add star-the-repo nudge after successful spawns (#3025) 2026-03-27 03:15:12 +07:00
telemetry.ts fix(security): add upper bound to base64 scrub regex to prevent ReDoS (#3251) 2026-04-10 10:16:34 +07:00
ui.ts feat: add PostHog telemetry for CLI errors and warnings (#3242) 2026-04-08 18:02:39 -07:00