Skip to content

fix(app): open dotfile edit copies locally on macOS and Linux - #1608

Merged
smart-ssh-coordinator[bot] merged 3 commits into
release/0.8.0from
issue-1607-open-locally-fails-for-dotfiles-env
Nov 27, 2026
Merged

smart-ssh-coordinator[bot] merged 3 commits into
release/0.8.0from
issue-1607-open-locally-fails-for-dotfiles-env

Conversation

@smart-ssh-coder

Copy link
Copy Markdown
Contributor

Closes #1607

Summary

The opener plugin's fs scope defaults require_literal_leading_dot to true on Unix, so ** never matched .env.local in an edit session. tauri.conf.json now sets plugins.opener.requireLiteralLeadingDot: false. The capability scope is unchanged ($CACHE/smart-ssh/edit-sessions/**, app: true); file names are unchanged.

Acceptance Criteria

  • config contains the setting: met (tests/opener_dotfile_scope.rs:config_disables_literal_leading_dot_for_opener)
  • scope test: met (dotfile_edit_copy_allowed_and_everything_else_rejected covers allowed dotfile, .ssh/id_ed25519, .. traversal; counter_proof_literal_leading_dot_rejects_dotfile for true)
  • config test fails when removed: met (same config test; also capability_scope_stays_the_edit_session_folder)
  • Spec 0054 updated: met
  • macOS manual check: needs manual check on macOS
  • automated tests pass: met locally (cargo test -p smart-ssh-community)

Tests

Counter-proof: the Some(true) case rejects the dotfile. The config test asserts the exact value.

Assumptions

serde_json became a normal dependency of the app crate (needed by generate_context! once a plugins section exists); tauri test feature added as dev-dependency for the scope test. The test uses a temp dir with the same pattern shape, since $CACHE must not be touched.

Spec: updated 0054
Threat model: no change – only dot components inside the already allowed edit-session folder now match.

Manual test steps

  1. On macOS, open a remote .env.local via 'Open locally'; it opens in the default editor.

Follow-ups

None.

🤖 Generated with Claude Code

smart-ssh-coder Bot and others added 3 commits November 27, 2026 10:54
The Windows test binary linked tauri's webview and aborted at load.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

@smart-ssh-reviewer smart-ssh-reviewer 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.

Review

Verdict: approved
Review level: normal

Blocking

None.

Non-blocking

  • apps/smart-ssh-community/tests/opener_dotfile_scope.rs:55-80: the scope tests rebuild tauri::fs::Scope the way the plugin does (tauri-plugin-opener 2.5.5 scope.rs::is_path_allowed). They do not go through the plugin itself. The config test covers the wiring from tauri.conf.json, and I checked in the plugin source that plugins.opener.requireLiteralLeadingDot is read into Opener::require_literal_leading_dot and passed to the scope. Together that is enough for this issue.

Verified

  • AC1, the config contains the setting: tauri.conf.json has plugins.opener.requireLiteralLeadingDot: false (read: diff).
  • AC2, the scope test: opener_dotfile_scope.rs:scope::dotfile_edit_copy_allowed_and_everything_else_rejected checks four paths. .env.local inside edit-sessions is allowed. .ssh/id_ed25519 and smart-ssh/other/.env are rejected. edit-sessions/../../.ssh/id_ed25519 is rejected; the target file exists, so canonicalisation really runs. The counter-proof is scope::counter_proof_literal_leading_dot_rejects_dotfile, which sets Some(true) and expects a rejection (read + executed).
  • AC3, the config guard: config_disables_literal_leading_dot_for_opener; capability_scope_stays_the_edit_session_folder also pins the capability scope.
  • AC4, the spec: updated (see Spec).
  • AC5, macOS: manual check pending.
  • Counter-proof: I restored tauri.conf.json from origin/release/0.8.0. config_disables_literal_leading_dot_for_opener then failed, and passed again once the PR version was back (executed: cargo test --locked -q -p smart-ssh-community --test opener_dotfile_scope config_disables).
  • Plugin wiring: in tauri-plugin-opener 2.5.5, lib.rs reads the setting from api.config(), and scope.rs::is_path_allowed and commands::open_path use it. The frontend opens edit copies through openPath (useLocalEditSession.ts:126), so this is the path that gets checked (read).
  • Widening: the only opener path scopes are default.json and mobile.json, both $CACHE/smart-ssh/edit-sessions/** with app: true, and neither changed. opener:default adds URL scopes and reveal_item_in_dir, which has no path scope; neither is affected by the leading-dot setting (read: capabilities, plugin permissions/default.toml, commands.rs).
  • Edge cases (read): a symlink or .. in the path is canonicalised before matching, so it stays rejected. On Android/iOS the mobile capability has the same scope, so dotfiles now open there too, which matches the goal. On Windows the setting is a no-op, because the default there is already false.
  • Callers checked: tauri_plugin_opener::init() (2 registrations in app-shell/src/lib.rs) gets the config automatically; diagnostics_export.rs uses the Rust open_path, which has no scope check, so it is unaffected.
  • Dependencies: serde_json is now a normal dependency, which generate_context! needs; it was already in the workspace. The tauri test feature is only a Unix dev-dependency. Cargo.lock is unchanged and --locked passes.
  • Tests run locally: cargo test --locked -q -p smart-ssh-community --test opener_dotfile_scope → 4 passed, run 5 times in a row (executed).
  • CI: all checks green on head 79e66f98 (executed: gh pr checks 1608).
  • files read: 1/1 logic files (plus Cargo.toml, tauri.conf.json, spec, changelog).
  • UI: not a UI change (config only).
  • Data: not touched.

Timing analysis

  • 1 test file analysed: no likely timing dependency. One possible point: the two scope tests build two mock apps in parallel; each uses its own temp directory. That is non-blocking, and 5 local runs were stable.

Spec

  • Visible behaviour changed: dotfile edit copies can now be opened locally on macOS and Linux.
  • Spec search: rg -il 'lokal öffnen|Bearbeitungskopie|open locally|Punkt-Datei' docs/specs/ → 0054 Part 4 covers it.
  • Verdict: the spec change is present at the end of 0054 Part 4 and matches the code. It names the setting and the reason, as the issue asks, and says the scope is not widened.

Security checks

  • Review level normal: the PR touches no path in security-paths.txt. The opener scope is a trust boundary for the webview, so I checked it by hand. The leading-dot setting applies only to the opener plugin, and the scope still allows only the edit-session folder. I tried 5 paths against it: ~/.ssh/id_ed25519, edit-sessions/../../.ssh/x, a sibling folder's .env, a symlink inside edit-sessions, and a Windows path. All stay rejected through canonicalisation or the pattern prefix.
  • Threat model: the PR body says Threat model: no change – only dot components inside the already allowed edit-session folder now match. That reason holds.
  • Release branch: the change stays within the issue, with no scope creep. The changelog fragment is in English and named per changelog.d/README.md. Its file name differs from the one in open PR #1606, so the two do not collide.
  • Public boundary: title, body and commits are in English; no internals.

Manual checks pending

  • macOS: opening a remote .env.local with "Open locally" opens it in the default editor.

Follow-ups

None.

@smart-ssh-coordinator
smart-ssh-coordinator Bot merged commit 2c982e4 into release/0.8.0 Nov 27, 2026
10 checks passed
@smart-ssh-coordinator
smart-ssh-coordinator Bot deleted the issue-1607-open-locally-fails-for-dotfiles-env branch November 27, 2026 12: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.

0 participants