Repository navigation
Add SSH key support - #16
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe PR adds an optional ChangesSSH Key Account Support
Sequence Diagram(s)sequenceDiagram
participant User
participant add_command as add (manual flow)
participant scan_ssh_keys
participant Account
User->>add_command: select "SSH Key" auth type
add_command->>scan_ssh_keys: scan_ssh_keys(username, email)
scan_ssh_keys-->>add_command: (display_items, key_paths, default_idx)
add_command->>User: show key selection menu
User->>add_command: choose key or enter custom path
add_command->>Account: construct with ssh_key = chosen_path
sequenceDiagram
participant gitas_git as gitas git
participant utils
participant git_process as git
gitas_git->>utils: resolve account → ssh_key present?
alt ssh_key present
gitas_git->>utils: git_ssh_command(ssh_key)
utils-->>gitas_git: "ssh -i <key_path>"
gitas_git->>git_process: git -c core.sshCommand="ssh -i <key_path>" <args>
else no ssh_key
gitas_git->>utils: git_args_use_http_transport(args)?
gitas_git->>git_process: git <args>
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/commands/git.rs (1)
23-28: 💤 Low valueConsider escaping special characters in SSH key paths.
The
git_ssh_commandutility wraps the path in double quotes, which handles spaces. However, if a manually-entered path contains embedded double-quote characters, the resulting command string would be malformed. While rare in practice (and low-risk since this is a local CLI tool with user-provided input), you could add basic validation or escaping.One option: reject paths containing
"characters during input, or escape them:let sanitized = ssh_key.replace('"', r#"\""#);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/commands/git.rs` around lines 23 - 28, The SSH key path passed to the git_ssh_command function in the code block handling account.ssh_key may contain embedded double-quote characters, which would break the resulting command string even though spaces are handled. Either validate and reject SSH key paths that contain double-quote characters during input, or escape those characters in the ssh_key variable before passing it to git_ssh_command by replacing any double-quote characters with their escaped equivalent before the format! call is executed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/commands/git.rs`:
- Around line 23-28: The SSH key path passed to the git_ssh_command function in
the code block handling account.ssh_key may contain embedded double-quote
characters, which would break the resulting command string even though spaces
are handled. Either validate and reject SSH key paths that contain double-quote
characters during input, or escape those characters in the ssh_key variable
before passing it to git_ssh_command by replacing any double-quote characters
with their escaped equivalent before the format! call is executed.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d3b74a2f-23d7-48a8-99e2-cd5bca827a8d
📒 Files selected for processing (5)
src/commands/add.rssrc/commands/git.rssrc/commands/list.rssrc/models.rssrc/utils.rs
Add SSH support using
git config core.sshCommand "ssh -i SSH_KEY_PATH -o IdentitiesOnly=yes"Closes #13
Summary by CodeRabbit
New Features
~/.ssh, with an option to enter a custom key pathImprovements
Bug Fixes