Skip to content

Feat: Implement SSH Host Key verification#1579

Open
phantompatch wants to merge 1 commit into
zhanghai:masterfrom
phantompatch:issue-544
Open

Feat: Implement SSH Host Key verification#1579
phantompatch wants to merge 1 commit into
zhanghai:masterfrom
phantompatch:issue-544

Conversation

@phantompatch

Copy link
Copy Markdown

Currently, accessing an SFTP server through Material Files leaves users vulnerable to man-in-the-middle attacks, since the app does not verify Host Keys after the first use.

This PR introduces a class that implements SSHJ's HostKeyVerifier. It extends SftpServerAuthenticator to also handle Host Keys, and adds a SftpHostKeyChangedDialog* so users can explicitly confirm when a Host Key has changed.

All changes are kept as simple as possible and try to follow the existing code style closely.

Fixes #544.

I understand that the project maintainer prefers not to accept Pull Requests because of copyright concerns. However, I believe these changes are very important, so I felt it was necessary to submit them. If @zhanghai prefers to retain full copyright over Material Files, I would be happy to release my changes into the public domain.

Please feel free to adjust this code to your liking. I am also open to change requests.

This PR made use of LLM assistance.

jsvk added a commit to jsvk/MaterialFiles that referenced this pull request Jul 7, 2026
Squash-merge of upstream PR zhanghai#1579.

Adds a HostKeyVerifier implementation so SFTP connections verify host
keys after first use, protecting against man-in-the-middle attacks.
Introduces SftpHostKeyChangedDialog* so users can explicitly confirm
when a host key has changed. Fixes upstream issue zhanghai#544.

Original work by phantompatch (https://github.com/phantompatch).

Co-authored-by: phantompatch <289516701+phantompatch@users.noreply.github.com>
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.

Verify host keys for SFTP

1 participant