spawn/cli/src
A 06351d6ea0
fix: validate connection parameters to prevent command injection (#1381, #1380) (#1392)
Add input validation for SSH connection parameters (IP, username, server_name)
and server identifiers used in delete operations. This prevents command injection
attacks if ~/.spawn/history.json is corrupted or tampered with.

Changes:
- Add validateConnectionIP() - validates IPv4/IPv6 addresses and sentinels
- Add validateUsername() - validates Unix username format
- Add validateServerIdentifier() - validates server names/IDs
- Update cmdConnect() to validate all connection params before use
- Update buildDeleteScript() to validate server IDs before interpolation
- Update mergeLastConnection() to validate data from bash scripts
- Add comprehensive test coverage for all validation functions
- Bump CLI version to 0.3.3 (security patch)

Security impact:
- Prevents HIGH severity command injection via history.ip/user (issue #1381)
- Prevents MEDIUM severity command injection via server_id (issue #1380)

Agent: security-auditor

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 06:32:24 -05:00
..
__tests__ fix: validate connection parameters to prevent command injection (#1381, #1380) (#1392) 2026-02-17 06:32:24 -05:00
commands.ts fix: validate connection parameters to prevent command injection (#1381, #1380) (#1392) 2026-02-17 06:32:24 -05:00
guidance-data.ts refactor: extract error guidance data structures into separate module (#1335) 2026-02-16 19:45:28 -08:00
history.ts fix: validate connection parameters to prevent command injection (#1381, #1380) (#1392) 2026-02-17 06:32:24 -05:00
index.ts fix: improve error handling by capturing error objects in catch blocks (#1360) 2026-02-16 20:27:35 -05:00
manifest.ts fix: prevent test fixtures from leaking into manifest cache (#1220) 2026-02-15 19:02:21 -08:00
security.ts fix: validate connection parameters to prevent command injection (#1381, #1380) (#1392) 2026-02-17 06:32:24 -05:00
unicode-detect.ts fix: Switch build target from node to bun to fix UTF-8 mojibake 2026-02-10 09:36:28 +00:00
update-check.ts fix: prevent command injection in update-check reExecWithArgs (#951) 2026-02-13 08:34:04 -08:00