Graphrt

SFTP

SFTP (ssh2) with a pinned host key and env-only, redacted credentials, list, stat and read remote files inside SFTP_ROOT, download to an allowed local directory, staged uploads that never overwrite unless a node asks, agent writes opt-in, deletes node only, timeouts

Beta v0.1.0 Node.js 7 actions
Use in Graphrt Desktop

About

A Graphrt plugin for one SFTP server: list, stat and read remote files, download them to a local directory and upload local files, using the ssh2 package. The server's host key is pinned, credentials come only from the environment, remote paths stay inside SFTP_ROOT and local paths inside allowlisted directories.

What it can do

  • list_directory: name, type, size, modified time and permission bits, sorted, limit with truncated.
  • stat: one remote path.
  • read_file: UTF-8 or base64, offset and max_bytes (never more than SFTP_MAX_READ_BYTES), truncated and next_offset.
  • download: a remote file to a new file with a generated name (<name>-<timestamp>-<random>.<ext>) in SFTP_OUTPUT_DIR, size-capped, nothing local is overwritten.
  • upload: a local file from SFTP_INPUT_DIRS to a remote path, create_parents makes missing remote directories. overwrite: true (workflow nodes only) replaces an existing regular file.
  • make_directory, and delete_path (workflow nodes only: one file, symlink or empty directory).

Actions

Each action is a step you can add to a workflow. Agents can also use most of them as tools.

  • List a remote directory sftp.list_directory
  • Stat a remote path sftp.stat
  • Read a remote file sftp.read_file
  • Download a file sftp.download
  • Upload a file sftp.upload
  • Make a remote directory sftp.make_directory
  • Delete a remote file or empty directory sftp.delete_path

Settings

Graphrt starts plugins with a clean environment. Only these values reach the plugin, and secrets stay out of logs.

  • SFTP_HOST (required), 22
    The server
  • SFTP_USERNAME (required)
    Login name
  • SFTP_PASSWORD
    Password authentication
  • SFTP_PRIVATE_KEY
    Private key as text, or the path of a key file, SFTP_PRIVATE_KEY_PASSPHRASE if it is encrypted
  • SFTP_HOST_FINGERPRINT (required)
    The server's host key, SHA256:... as ssh-keygen -l prints it, comma-separated for a key rotation
  • SFTP_ROOT (required)
    Absolute directory on the server that every remote path stays inside
  • SFTP_INPUT_DIRS
    Comma-separated local directories that uploads may read from
  • SFTP_OUTPUT_DIR
    Existing local directory that downloads are written to
  • SFTP_MAX_INPUT_BYTES 1 GiB
    Largest upload / download
  • SFTP_MAX_READ_BYTES 1 MiB
    Most bytes one read_file returns
  • SFTP_TOOL_ALLOW_WRITES (off)
    1 lets agents call upload (new files only) and make_directory
  • SFTP_CONNECT_TIMEOUT_MS 15000
    Handshake time limit
  • SFTP_OPERATION_TIMEOUT_MS 600000
    Whole-call time limit (connect + work), the connection is closed when it passes
  • SFTP_PORT
  • SFTP_PRIVATE_KEY_PATH
  • SFTP_PRIVATE_KEY_PASSPHRASE
  • SFTP_MAX_OUTPUT_BYTES

How to use it

In Graphrt Desktop

  1. Open Plugins and search for SFTP.
  2. Click Install and approve it.
  3. Follow the setup steps on the plugin's page, then paste the settings it needs.
  4. Describe a job that needs it, and the builder adds the steps.
Plugins in Graphrt Desktop

With the CLI

terminal
$ graphrt plugin install sftp
workflow.yaml
- id: sftp
  type: sftp.list_directory
Plugins in the docs