Skip to content

feat: make managed ssh config path configurable - #10

Merged
Hureru merged 2 commits into
mainfrom
feature/configurable-managed-ssh-config
Jun 5, 2026
Merged

feat: make managed ssh config path configurable#10
Hureru merged 2 commits into
mainfrom
feature/configurable-managed-ssh-config

Conversation

@Hureru

@Hureru Hureru commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Managed SSH config now defaults to the executable's directory instead of ~/.ssh/sshwarden_config.
    • Users can customize the managed SSH config location via the [ssh_config].managed_path configuration option.
    • Path expansion support for tilde (~) in configuration paths.
  • Documentation

    • Updated guides to reflect new managed SSH config defaults and configuration options.
    • Improved SSH config integration documentation with updated file-layout information.

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Hureru, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 46 minutes and 38 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d4a9eb1a-c0f4-46f9-b6d5-ae27959414f2

📥 Commits

Reviewing files that changed from the base of the PR and between 778c553 and f1cff15.

📒 Files selected for processing (2)
  • crates/sshwarden-config/src/lib.rs
  • src/main.rs
📝 Walkthrough

Walkthrough

This PR shifts SSHWarden's managed SSH config from ~/.ssh/sshwarden_config to the executable directory, adds configurable override via [ssh_config].managed_path with tilde expansion, implements marker-based include line management for safer SSH config editing, and enables binding synchronization by importing host patterns from the managed snippet.

Changes

Managed SSH Config Marker System

Layer / File(s) Summary
Configuration schema and path resolution helpers
crates/sshwarden-config/src/lib.rs, src/main.rs (lines 1258–1266)
Config gains ssh_config: SshConfigConfig with optional managed_path. New path helpers resolve managed config location (default: executable directory), legacy path, user config path, and expand tilde forms (~, ~/..., ~\...) with validation and home directory resolution.
Managed SSH config marker system and binding import
src/main.rs (lines 1768–1921, 1951–1953, 6638–6719)
Introduces SSHWARDEN_KEY_MARKER_PREFIX to mark cipher blocks in managed snippet. load_host_bindings_importing_managed reads managed SSH config, extracts cipher UUIDs from markers and legacy headers, validates edited host patterns, and syncs bindings back to HostBindingsFile. Snippet generation emits marker lines before key blocks. Sync path uses import workflow to carry forward manually edited bindings. Unit tests validate marker-based importing, include replacement, and marker removal.
Include write/removal with marker-based safety
src/main.rs (lines 1986–2206)
write_sshwarden_include_line checks for existing include and safely replaces only marked includes to avoid duplicates. remove_sshwarden_include_line removes include and retroactively drops preceding marker. Shared helpers validate managed path safety and create directories with correct permissions.
Binding command integration with managed import
src/main.rs (lines 2704–2916, 5874–5986)
All binding commands (cmd_keys_list, cmd_bindings_add, cmd_bindings_remove, cmd_sshcfg_status) and bind-hosts dialog flows use load_host_bindings_importing_managed instead of direct file loading, enabling operations to incorporate host patterns edited in managed snippet.
Documentation across README, ADR, guides, and design docs
README.md, docs/adr/0023-host-bindings-and-managed-ssh-config.md, docs/host-bindings.md, docs/host-bindings-followup.md, llmdoc/guides/how-to-use-cli-commands.md
Documentation updated to reflect new managed SSH config default location (<exe-dir>/sshwarden_config), configurable override via [ssh_config].managed_path with tilde expansion, marker-based include management, binding import behavior, permission handling, and integration test coverage expectations.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • Hureru/SSHWarden#8: Both PRs modify src/main.rs's SSH config command wiring—this PR extends the offline ssh-config redesign with marker-based include replacement and managed-path configuration.

Poem

🐰 A hop to the home of the executable we go,
No more ~/.ssh for our config to flow!
With markers to guard and imports to trust,
The managed paths bend to what users adjust.
SSH config now safer, bindings now heard—
In sshwarden_config, a rabbit's preferred word! 🌲

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.78% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main feature: making the managed SSH config path configurable, which is the primary objective of the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Hureru

Hureru commented Jun 5, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 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.

Inline comments:
In `@crates/sshwarden-config/src/lib.rs`:
- Around line 436-445: The function managed_ssh_config_path currently treats a
present but all-whitespace ssh_config.managed_path as None; instead, update
managed_ssh_config_path to treat Some(value) that trims to an empty string as an
error: inspect config.ssh_config.managed_path.as_deref(), trim it, and if it is
Some("") return an Err (use anyhow::bail! or Err(anyhow::anyhow!(...))) with a
clear message like "ssh_config.managed_path is present but empty"; only when the
option is truly None fall back to default_managed_ssh_config_path(), otherwise
call expand_config_path(path) for non-empty values.

In `@docs/host-bindings.md`:
- Line 41: Replace the short command invocation "ssh-config show" with the full
command "sshwarden ssh-config show" in the documentation text that mentions
regenerating the managed file; update the single occurrence of the command
string so it matches neighboring docs and prevents copy-paste errors.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 81e7afb6-2387-488d-b0ef-6e21f72d9985

📥 Commits

Reviewing files that changed from the base of the PR and between 820aa88 and 778c553.

📒 Files selected for processing (7)
  • README.md
  • crates/sshwarden-config/src/lib.rs
  • docs/adr/0023-host-bindings-and-managed-ssh-config.md
  • docs/host-bindings-followup.md
  • docs/host-bindings.md
  • llmdoc/guides/how-to-use-cli-commands.md
  • src/main.rs

Comment thread crates/sshwarden-config/src/lib.rs
Comment thread docs/host-bindings.md
Comment thread src/main.rs
@Hureru
Hureru merged commit 406bbd2 into main Jun 5, 2026
6 checks passed
@Hureru
Hureru deleted the feature/configurable-managed-ssh-config branch June 5, 2026 08:09
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.

1 participant