Skip to Content
FleetKiteFleetKite

External Plugins

The packaging rules, the zero-trust governance loop and how to call JavaScript and Go/Wasm plugins.

When the 27 built-in plugins do not cover a particular cloud provider API, an internal configuration format, a webhook notification or a bespoke inspection, an external plugin package extends the task types without recompiling the FleetKite core.

Every external plugin goes through the same zero-trust execution flow. Plugin code that has not been authorised is never executed.

The two ways to implement a plugin

DimensionJavaScript script plugins (Goja runtime)Go / Wasm compiled plugins (WASI runtime)
Where it fitsLightweight script logic, webhook notifications, cloud APIs, configuration file generation, quick custom inspectionsComplex, strongly typed business logic; anything that needs the Go standard library; single-file offline cross-platform distribution
Entry fileA plain JS script (such as index.js) exporting module.exports = function (host, args) { ... }A plugin.wasm compiled with GOOS=wasip1 GOARCH=wasm (calling fkplugin.ServeTyped)
manifest.yaml declarationsruntime.type: goja; apiVersion: fleetkite.io/v1 (base capabilities) or fleetkite.io/v1.5 (adds assets/, std.* and extended asset capabilities)runtime.type: wasm-wasi, runtime.entry: plugin.wasm; apiVersion: fleetkite.io/v2 (the full host surface)
Package size limitsEach non-executable member such as manifest.yaml is <= 512 KiB; metadata and assets/ (at most 64 files) together stay <= 4 MiBplugin.wasm <= 32 MiB; metadata and assets/ are bounded by the same 4 MiB
Host sandboxNo Node, filesystem or direct network access; every outside effect must go through the frozen host.* surface, and only after local scope approvalNo host filesystem and no network sockets; the core is reached through a limited host ABI with budget control

The packaging rules

A valid plugin package is a directory or a ZIP with the same structure, whose root holds a manifest.yaml (unknown fields are rejected; exactly one YAML document):

apiVersion: fleetkite.io/v1.5          # protocol and capability level: fleetkite.io/v1 | fleetkite.io/v1.5 | fleetkite.io/v2
kind: Plugin                            # always Plugin
id: fleetkite/feishu-webhook            # format: <publisher>/<name> (lower-case letters, digits, hyphens)
version: 0.1.0                          # strict SemVer
title: Feishu bot notification
description: Sends a text message to an approved Feishu webhook.
runtime:
  type: goja                            # goja or wasm-wasi
  entry: index.js                       # *.js for goja, always plugin.wasm for wasm-wasi
permissions:
  - http.request                        # the minimal permission set the plugin declares
argsSchema:                             # JSON Schema Draft-07; the root must be an object with additionalProperties: false
  type: object
  additionalProperties: false
  required: [text]
  properties:
    text: { type: string, minLength: 1 }
    secret: { type: string, x-sensitive: true }   # x-sensitive: true redacts it end to end
examples:                               # at least one valid example, tried against argsSchema during install and verification
  - name: Send the deployment notification
    args: { text: "Deploy succeeded" }

An argument marked x-sensitive: true is redacted end to end and never echoed in a log or a diff.

The governance loop: install, lock, sign and approve

# 1. (optional) verify the package's integrity and signature offline
fleetkite plugins verify ./my-plugin

# 2. (publisher, optional) generate an Ed25519 key and sign a directory or ZIP
fleetkite plugins keygen --out ~/publisher.key --pub-out ~/publisher.pub
fleetkite plugins sign ./my-plugin --key ~/publisher.key --output ./my-plugin-signed.zip

# 3. install into the local content-addressed cache ($FLEETKITE_DATA_DIR/plugins/cache/<sha256>)
fleetkite plugins install ./my-plugin-signed.zip

# 4. bind the version and full SHA-256 digest in the project (writes plugins.lock.json)
fleetkite plugins lock acme/my-plugin --project /path/to/project

# 5. approve that SHA-256 and its minimal scope on this machine (writes the local trust.json)
fleetkite plugins trust acme/my-plugin --scopes /path/to/scopes.json

# to withdraw the approval:
fleetkite plugins revoke acme/my-plugin

A signature is not an approval

  • signature.json (Ed25519) only verifies the publisher's key fingerprint; it does not replace the local permission approval. A tampered package or a broken signature is refused outright, with no downgrade path.
  • Every version upgrade (a change in the content SHA-256) requires plugins lock and plugins trust to run again, even when the id and version fields are unchanged.

The permission list and the scope model

The full capability permissions

  • Base read-only and restricted text: facts.read, service.status, text.ensure;
  • Extended files and services: fs.read, fs.manage, service.ensure;
  • Network and outbound requests: http.request (limited to preset allowlisted aliases, methods and query keys; HTTPS or unauthenticated loopback HTTP), net.probe;
  • Controlled fixed commands and package artifacts: cmd.query, cmd.change (only the Core's pre-approved command profiles, such as disk-usage, ufw-status, ufw-allow-port, firewalld-state, firewalld-add-runtime-port and systemd-daemon-reload), pkg.query, pkg.ensure, artifact.fetch, archive.extract (which requires artifact.fetch).

Modifier permissions

These do not provide a host.* function of their own; they act as capability gates:

  • text.ensure.become (requires text.ensure), fs.become (requires fs.read / fs.manage / archive.extract);
  • cmd.validate (requires fs.manage; currently the pre-write validator for host.fs.write, such as json, yaml and nginx-site).

Built-in helpers that need no extra permission

  • host.log (progress logging), host.sleep (a cancellable wait of 0–30000 milliseconds, usable in check mode), host.bundle.readAsset (reads a locked assets/ file as read-only UTF-8 text);
  • the std.* pure-computation library (YAML / TOML / INI / Base64 codecs, Bcrypt / SHA-256 / HMAC-SHA256, SemVer, CIDR, path normalisation and bounded Go template rendering), bounded by <= 64 KiB of input, four bcrypt calls per task, and a budget.

The scopes.json approval file

{
  "textRoots": [
    {
      "target": { "address": "192.0.2.10", "port": 22, "user": "ops" },
      "become": { "method": "sudo", "user": "root" },
      "roots": { "site": "/etc/nginx/fleetkite-sites" }
    }
  ],
  "httpEndpoints": {
    "webhook": { "method": "POST", "url": "https://hooks.example.test/services/T00/B00", "location": "control" }
  },
  "probeEndpoints": {
    "tls": { "host": "api.example.test", "port": 443, "location": "target", "tls": true }
  },
  "serviceUnits": {
    "nginx.service": ["reload"]
  },
  "commandProfiles": ["ufw-status", "ufw-allow-port"],
  "firewallPorts": [{ "port": 8443, "protocol": "tcp" }],
  "packages": ["nginx"],
  "artifactSources": {
    "release": {
      "url": "https://example.test/tool.tar.gz",
      "sha256": "<64 lower-case hex>",
      "format": "tar.gz",
      "redirectHosts": ["cdn.example.test"]
    }
  }
}

Calling an external plugin from a playbook

global:
  transfer_security:
    # with fs.* / text.ensure / archive.extract, the remote root must be allowlisted
    allowed_directories:
      - /etc/nginx/fleetkite-sites

plays:
  - name: Apply and verify the custom site plugin
    hosts: all
    become: true
    tasks:
      - name: Render and reload the site configuration
        type: fleetkite/nginx-site
        args:
          root: site
          path: healthz.conf
          serverName: localhost
          listenPort: 18080
        register: site_out

      - name: Print the summary of the managed operations
        type: debug
        args:
          var: site_out.host_operations

How external plugins are constrained

External plugin tasks currently run only under connection: ssh; connection: local is refused by the executor. If a plugin contains a target file that was not pre-approved, or an argument that exceeds its limits, the run is refused before it starts.

Next steps

  • Security practices — where plugin governance sits in the wider security model
  • CLI and MCP — the full argument list of the plugins subcommand

On this page