Skip to content

feat: add SFTP monitor type with password and private key authentication#7034

Open
eXtgmA wants to merge 7 commits intolouislam:masterfrom
eXtgmA:sftp-monitor-type
Open

feat: add SFTP monitor type with password and private key authentication#7034
eXtgmA wants to merge 7 commits intolouislam:masterfrom
eXtgmA:sftp-monitor-type

Conversation

@eXtgmA
Copy link
Copy Markdown

@eXtgmA eXtgmA commented Feb 23, 2026

Summary

In this pull request, the following changes are made:

  • New monitor type added for SFTP connections
  • Resolves SFTP/FTP as a new monitor #2877
  • No Breaking changes
  • Added new testcases, but without a testcontainer, since I couldn't find an sftp container for node. If there is a better solution here, I'll be happy to correct this
  • english translation
Please follow this checklist to avoid unnecessary back and forth (click to expand)
  • ⚠️ If there are Breaking change (a fix or feature that alters existing functionality in a way that could cause issues) I have called them out
  • 🧠 I have disclosed any use of LLMs/AI in this contribution and reviewed all generated content.
    I understand that I am responsible for and able to explain every line of code I submit.
  • 🔍 Any UI changes adhere to visual style of this project.
  • 🛠️ I have self-reviewed and self-tested my code to ensure it works as expected.
  • 📝 I have commented my code, especially in hard-to-understand areas (e.g., using JSDoc for methods).
  • 🤖 I added or updated automated tests where appropriate.
  • 📄 Documentation updates are included (if applicable).
  • 🧰 Dependency updates are listed and explained.
  • ⚠️ CI passes and is green.

For the private key, I decided against a hidden input because it is much more readable with a text area.

New dependencies

  • ssh2-sftp-client v12.0.1

Screenshots for Visual Changes

image image image

Copilot AI review requested due to automatic review settings February 23, 2026 17:13
@github-actions
Copy link
Copy Markdown
Contributor

Hello and thanks for lending a paw to Uptime Kuma! 🐻👋
As this is your first contribution, please be sure to check out our Pull Request guidelines.
In particular: - Mark your PR as Draft while you’re still making changes - Mark it as Ready for review once it’s fully ready
If you have any design or process questions, feel free to ask them right here in this pull request - unclear documentation is a bug too.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new SFTP monitor type to Uptime Kuma, including backend connectivity checks (password or SSH private key auth), UI configuration fields, persistence via DB migration, and backend unit tests.

Changes:

  • Implemented a new backend monitor type (sftp) using ssh2-sftp-client, including optional remote path existence checks.
  • Added SFTP configuration UI to the monitor editor and new i18n strings.
  • Added DB columns + serialization/persistence wiring and backend tests for SFTP scenarios.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
server/monitor-types/sftp.js New SFTP monitor type implementation.
server/uptime-kuma-server.js Registers the new sftp monitor type.
server/server.js Persists SFTP fields when saving a monitor.
server/model/monitor.js Serializes/deserializes SFTP fields (incl. sensitive fields).
db/knex_migrations/2026-02-23-0000-add-sftp-monitor.js Adds DB columns for SFTP configuration.
src/pages/EditMonitor.vue Adds SFTP to monitor type list and renders SFTP-specific form fields.
src/lang/en.json Adds English translations for SFTP UI strings.
test/backend-test/monitors/test-sftp.js Adds backend unit tests for SFTP monitor behavior.
package.json / package-lock.json Adds ssh2-sftp-client dependency.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment on lines +4 to +8
table.string("sftp_password");
table.string("sftp_path");
table.text("sftp_private_key");
table.string("sftp_passphrase");
table.string("sftp_auth_method").defaultTo("password");
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Except sftp_path, I think it should called ssh_*. In case someone implement ssh monitor in the future, they can reuse the fields.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

we also likely already have username and password fields for monitors -> reuse those

@louislam
Copy link
Copy Markdown
Owner

Added new testcases, but without a testcontainer, since I couldn't find an sftp container for node. If there is a better solution here, I'll be happy to correct this

This package seems to provide a basic working sftp server, not tested, but feel free to add to devDependencies.
https://www.npmjs.com/package/@micham/sftp-mock-server

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SFTP/FTP as a new monitor

4 participants