Add shell command execution on client #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Implements secure shell command execution from server to client as requested in #8.
git status,bundle exec)chdir) validated against path entitlementsUser Configuration
Users can configure permissions via a config file at
~/.terminalwire/authorities/{authority}/config.yml:This allows users to grant permissions to specific servers without modifying code.
Server API
Security Design
Array-based execution - Uses
Open3.capture3(cmd, *args)which bypasses the shell entirely. Shell metacharacters like&&,;,|, backticks are treated as literal strings.Command prefix allowlist - Commands are permitted by prefix matching (e.g.
"git status"allowsgit status --shortbut notgit push). No glob patterns to avoid bypass vulnerabilities.Path entitlement for chdir - If
chdiris specified, it must be a permitted path.Resource limits - Timeout (max 300s) and output size (max 10MB) prevent exhaustion attacks.
User-controlled permissions - All permissions are configured by the user, not the server. The server can only use what the user has explicitly allowed.
Test Plan
Closes #8
🤖 Generated with Claude Code