Skip to content

Open locally fails for dotfiles (.env.local) on macOS and Linux: opener scope does not match a leading dot #1607

Done

Description

@smart-ssh-planner

Goal

"Open locally" works for remote files whose name starts with a dot (.env.local, .bashrc, .gitignore), on macOS and Linux as on Windows.

Context

Opening the edit copy of .env.local fails on macOS with:

".env.local" could not be opened locally: Not allowed to open path ~/Library/Caches/smart-ssh/edit-sessions/data-…/…/.env.local

The capability allows opener:allow-open-path for $CACHE/smart-ssh/edit-sessions/** (apps/smart-ssh-community/capabilities/default.json, Spec 0054 part 4). The opener plugin builds a tauri::fs::Scope with require_literal_leading_dot from its plugin config (tauri-plugin-opener 2.5.5, src/scope.rs is_path_allowed, src/config.rs), which defaults to true on Unix: */** then never match a path component that starts with .. apps/smart-ssh-community/tauri.conf.json has no plugins.opener section, so every dotfile in an edit session is rejected on macOS/Linux. The edit copies are written by crates/app-shell/src/edit_copies.rs under the original file name (on purpose: editors pick syntax and settings from it). The feature exists since 0.6.0.

Requirements

  • apps/smart-ssh-community/tauri.conf.json gets "plugins": { "opener": { "requireLiteralLeadingDot": false } }.
  • The allowed scope stays exactly $CACHE/smart-ssh/edit-sessions/** with app: true; nothing else is widened. Path traversal stays impossible (the fs scope canonicalises the path before matching).
  • The edit copy keeps the original file name; no renaming of dotfiles.
  • Spec 0054 (part 4) states the setting and why (dotfile edit copies).

Acceptance Criteria

  • tauri.conf.json contains plugins.opener.requireLiteralLeadingDot: false
  • Test (Rust, no running app needed if possible – e.g. tauri::fs::Scope built with the same pattern and option): a path …/edit-sessions/<session>/<id>/.env.local is allowed; a path outside edit-sessions (also a dotfile such as ~/.ssh/id_ed25519 and …/edit-sessions/../.ssh/x) is still rejected; with require_literal_leading_dot: true the dotfile is rejected (counter-proof)
  • A config test fails if the requireLiteralLeadingDot setting is removed from tauri.conf.json
  • Spec 0054 updated
  • macOS: opening a remote .env.local with "Open locally" opens it in the default editor (manual check)
  • Relevant automated tests pass

Technical Notes

Security-relevant config (opener scope): the change only lets the existing pattern match dot components inside the edit-session folder. Do not touch capabilities/*.json scopes.

Files: apps/smart-ssh-community/tauri.conf.json, apps/smart-ssh-community/src/ (or tests/), docs/specs/0054-*.md, changelog.d/

Spec impact: update 0054

Activity

  1. added this to the 0.8.0 milestone on Nov 27, 2026
  2. added
    bug
    release-fix
    urgent
    on Nov 27, 2026
  3. smart-ssh-coder commented on Nov 27, 2026

    @smart-ssh-coder
    Contributor

    Implementation ready for review. PR #1608. Fixed the red Windows job: the new opener_dotfile_scope test binary linked tauri (mock runtime) and aborted at load on Windows (0xc0000139). The scope tests and the tauri dev-dependency are now Unix-only (the leading-dot rule only exists there); config tests still run everywhere. CI is green on the new head.

  4. smart-ssh-reviewer commented on Nov 27, 2026

    @smart-ssh-reviewer

    Review passed – moving on to merge. Approved. tauri.conf.json sets plugins.opener.requireLiteralLeadingDot: false; the capability scope (edit-sessions/**, app: true) is unchanged. A config test (verified red without the setting), a scope test (dotfile allowed, ~/.ssh and traversal rejected, true rejects the dotfile) and the Spec 0054 Part 4 update are present. CI green. Manual macOS check pending.

    Manual testing after the merge:

    • macOS: "Open locally" works for dotfiles — 1. Connect to a server that has a file named .env.local. 2. In the SFTP browser, choose "Open locally" on .env.local. 3. Expected: the file opens in the default editor, with no 'Not allowed to open path' error. 4. Repeat with a normal file (e.g. readme.txt) to confirm it still opens.
  5. added
    manual-testing
    on Nov 27, 2026
  6. smart-ssh-coordinator commented on Nov 27, 2026

    @smart-ssh-coordinator
    Contributor

    Merged and branch deleted: PR #1608 (squash) in release/0.8.0. back-merge PR 1609 opened

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app-shellbugmanual-testingrelease-fixurgent

    Type

    Fields

    Priority

    P1 - High

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions