Skip to content

fix: handle SFTP host key confirmation - #2015

Open
alvinwin wants to merge 2 commits into
pop-os:masterfrom
alvinwin:fix/sftp-host-key-question
Open

fix: handle SFTP host key confirmation#2015
alvinwin wants to merge 2 commits into
pop-os:masterfrom
alvinwin:fix/sftp-host-key-question

Conversation

@alvinwin

@alvinwin alvinwin commented Aug 26, 2026

Copy link
Copy Markdown

Summary

GIO asks the mount operation to confirm an uncached SFTP host key, but COSMIC Files did not handle that question and reported Login dialog cancelled.

  • forward generic mount-operation questions to the application
  • display the backend-provided message and ordered choices
  • return the selected choice without interpreting SSH policy
  • prevent delayed dialog input from affecting a newer queued question

Fixes #580.

Testing

  • cargo test --offline --all-features --lib --bins — 45 passed
  • cargo check --offline --features gvfs
  • git diff HEAD^ --check
  • first-connection SFTP verification against a disposable server with a fresh host key

Live verification on c499cb9 was captured across two runs: one confirmed that Escape leaves the first-connection fingerprint question visible, and another confirmed that the same build can open the remote SFTP root. The combined Escape → continued mount sequence was not captured as one run. Automated coverage verifies that Escape preserves the active question and cannot dismiss the next queued question.

  • I have disclosed use of any AI generated code in my commit messages.
    • If you are using an LLM, and do not fully understand the changes it is making to the code base, do not create a PR.
    • In our experience, AI generated code often results in overly complex code that lacks enough context for a proper fix or feature inclusion. This results in considerably longer code reviews. Due to this, AI authored or partially authored PRs may be closed without comment.
  • I understand these changes in full and will be able to respond to review comments.
  • My change is accurately described in the commit message.
  • My contribution is tested and working as described.
  • I have read the Developer Certificate of Origin and certify my contribution under its conditions.

@alvinwin
alvinwin marked this pull request as ready for review August 27, 2026 01:19
@jacobgkau
jacobgkau requested review from a team September 1, 2026 19:26
@jacobgkau jacobgkau self-assigned this Sep 1, 2026
AI-assisted: OpenAI Codex helped investigate, implement, test, and review this change. I reviewed and understand the final changes.
AI-assisted: OpenAI Codex helped investigate, implement, test, and review this change. I reviewed and understand the final changes.
@jacobgkau
jacobgkau force-pushed the fix/sftp-host-key-question branch from c499cb9 to e3abc2b Compare September 1, 2026 19:28

@jacobgkau jacobgkau left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is the new dialog:

Screenshot_2026-09-01_13-32-26

I have some problems with the grammar of this message. However, it appears it's coming from GVFS, not COSMIC Files: https://github.com/GNOME/gvfs/blob/061802831d94e8aff45172f3ca18f953cf348b61/daemon/gvfsbackendsftp.c#L1350 So it may not be trivial for us to customize. And passing along GVFS's flawed message is objectively better than our current behavior of erroring out with no way to actually connect without resorting to other apps.

With that said, having both a Cancel Login and a Cancel button is awkward. I understand the former comes from GVFS and the latter comes from COSMIC Files, but users might not understand the difference. Does GVFS have any questions that wouldn't include a Cancel option?

It appears Nautilus, Thunar, and Nemo all pop the dialog with the expectation one of the options will be sufficient (and a lower-level option to abort is unnecessary):

Image Image Image

So we can probably just drop the second Cancel button and rely on GVFS to provide a cancel option in these questions, at least for now.

It would probably also be best to lay the buttons out horizontally, to better match our other dialogs. And if we can get the order flipped so the affirmative is farthest to the right (as those other three GVFS-using apps do), and add an appropriate icon, then that would also better match our other dialogs, e.g.:

Image

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.

SFTP connection fails if host key not cached

2 participants