Skip to content

Conversation

@triepod-ai
Copy link

Summary

Adds input validation to the CLI to prevent potential command injection vulnerabilities.

Changes

  • Add isValidEnvVarName() - validates env var names match [a-zA-Z_][a-zA-Z0-9_]*
  • Add isValidEnvVarValue() - rejects values containing null bytes
  • Add validateEnvVars() - filters invalid env vars with warnings
  • Add validateServerUrl() - validates URL protocol, warns on private IPs
  • Add validateCommand() - checks for shell metacharacters, verifies command exists
  • Apply validation in runWebClient() and runCli() functions
  • Add 11 integration tests for validation functions

Security Impact

  • Prevents command injection via malicious env var names
  • Prevents string truncation via null bytes in values
  • Warns users about connecting to internal addresses

Test plan

  • Build passes (npm run build)
  • CLI validation tests pass (11/11)
  • Manual testing of edge cases
  • Existing CLI functionality works

🤖 Generated with Claude Code

- Add isValidEnvVarName() to validate env var names match [a-zA-Z_][a-zA-Z0-9_]*
- Add isValidEnvVarValue() to reject values with null bytes
- Add validateEnvVars() to filter invalid env vars with warnings
- Add validateServerUrl() to validate URL protocol and warn on private IPs
- Add validateCommand() to check for shell metacharacters and verify command exists
- Apply validation in runWebClient() and runCli() functions
- Add 11 integration tests for validation functions

Security Impact:
- Prevents command injection via malicious env var names
- Prevents string truncation via null bytes in values
- Warns users about connecting to internal addresses

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants