Skip to content

Runtime, Storage & Gateway Security

When an administrator installs an app, FynnCloud’s orchestrator (FynnCloud AIO or the legacy Docker socket proxy) provisions an isolated runtime and routes all browser and server traffic through the App Gateway (/api/apps/:appId/proxy/**).

Every app container starts with strict defaults:

  • Per-app isolated network (AIO): Each app is attached to its own fynncloud-app-net-<appId> network (internal: true by default via AIO_APPS_NETWORK_INTERNAL=true), reachable only from fynncloud-server (and fynncloud-postgres if database is enabled). Apps have zero lateral visibility into other installed apps or Redis.
  • Read-only root filesystem: Enabled by default (read_only_rootfs: true), with writable tmpfs mounts on /tmp and /run and a persistent volume at storage.mount_path (default /data) if requested.
  • Dropped capabilities & non-root execution: cap_drop: [ALL], no-new-privileges:true, and non-zero UID enforced.
  • Healthcheck readiness: The gateway probes deploy.healthcheck.path (default /health) with a 1500ms timeout, caches results for 15 seconds, and treats any HTTP status < 500 as healthy.

FynnCloud automatically injects these variables into every running app container:

Variable Description
FYNNCLOUD_APP_ID Your app’s manifest id
FYNNCLOUD_APP_SECRET Cryptographically random per-install secret (authenticates backend API calls, webhook HMAC signatures, and Gateway HMAC identity proofs)
FYNNCLOUD_INTERNAL_API_URL Internal HTTP base URL to fynncloud-server (e.g. http://fynncloud-server:8080)
FYNNCLOUD_PUBLIC_URL Public browser origin of the FynnCloud instance (APP_FRONTEND_URL)
PORT Internal HTTP listen port matching deploy.port (default 8080)
DATABASE_URL Provisioned isolated PostgreSQL schema/role connection string (when database is enabled)
STORAGE_PATH / DATA_DIR Persistent volume mount path (when storage is enabled, default /data)

The App Gateway (/api/apps/:appId/proxy/**) supports 14 HTTP methods (GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, plus WebDAV methods PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK), WebSocket upgrades, streaming uploads/downloads, and long-lived SSE streams with a 30-minute timeout and a 128-connection soft pool per host (redirectConfiguration = .disallow).

  • Traversal rejection: Segments decoding (even double-encoded %252e%252e) to ., .., /, \, or NUL are immediately rejected with 400 Bad Request so gateway policy and your app router always see identical paths.
  • Forbidden response headers: The gateway strips Set-Cookie, Set-Cookie2, and all Access-Control-* headers returned by your app (apps can never write cookies onto the FynnCloud origin or override CORS).
  • Mandatory sandbox CSP: Every proxied response carries (or merges with) Content-Security-Policy: sandbox allow-scripts allow-forms allow-popups allow-downloads allow-modals. Notice allow-same-origin is intentionally omitted so the app always executes in an opaque (null) origin—even if a user navigates directly to /api/apps/:appId/proxy/ outside an iframe—and frame-ancestors is intentionally omitted so apps like draw.io can embed sub-iframes from their own proxy subpath.
  • Iframe allow attribute: The host grants microphone, camera, and display-capture only when the app declares media:capture (and routes capture through the host media relay).

Verifying Gateway HMAC-SHA256 Identity Signatures

Section titled “Verifying Gateway HMAC-SHA256 Identity Signatures”

On every authenticated request forwarded through /api/apps/:appId/proxy/**, FynnCloud Core injects trusted identity headers and signs them with your FYNNCLOUD_APP_SECRET:

Header Description
X-FynnCloud-User-ID Authenticated FynnCloud user UUID (empty on anonymous public_paths / static shell requests)
X-FynnCloud-Caller-App Caller’s appId when invoked through the cross-app proxy (empty on direct user requests)
X-FynnCloud-Gateway-Timestamp Unix timestamp (seconds) when the gateway signed the request
X-FynnCloud-Gateway-Signature sha256=<lowercase hex> HMAC-SHA256 over the 5-line canonical payload
<timestamp>\n<METHOD>\n/<subpath>\n<userID>\n<callerAppID>
  • <METHOD> is uppercase (e.g. GET, POST).
  • /<subpath> is the normalized path forwarded to your app starting with / (without query string).
  • <userID> and <callerAppID> are empty strings "" if absent.

Node.js / TypeScript Verification Middleware

Section titled “Node.js / TypeScript Verification Middleware”

Always verify X-FynnCloud-Gateway-Signature (with a ±300s timestamp window and constant-time comparison) before trusting X-FynnCloud-User-ID or X-FynnCloud-Caller-App:

import crypto from 'node:crypto';
import type { IncomingMessage } from 'node:http';
export function verifyFynnCloudGateway(req: IncomingMessage, appSecret: string): boolean {
const ts = String(req.headers['x-fynncloud-gateway-timestamp'] ?? '');
const sig = String(req.headers['x-fynncloud-gateway-signature'] ?? '');
if (!ts || !sig.startsWith('sha256=')) return false;
const age = Math.abs(Math.floor(Date.now() / 1000) - Number(ts));
if (!Number.isFinite(age) || age > 300) return false;
const url = new URL(req.url || '/', 'http://localhost');
const userId = String(req.headers['x-fynncloud-user-id'] ?? '');
const callerApp = String(req.headers['x-fynncloud-caller-app'] ?? '');
const canonical = [
ts,
(req.method || 'GET').toUpperCase(),
url.pathname,
userId,
callerApp,
].join('\n');
const expected =
'sha256=' + crypto.createHmac('sha256', appSecret).update(canonical, 'utf8').digest('hex');
const a = Buffer.from(sig, 'utf8');
const b = Buffer.from(expected, 'utf8');
return a.length === b.length && crypto.timingSafeEqual(a, b);
}

Apps can call other installed FynnCloud apps safely without sharing secrets or opening lateral network routes by declaring target apps in compatibility.apps:

1. From an App Frontend (@fynncloud/app-bridge)

Section titled “1. From an App Frontend (@fynncloud/app-bridge)”
const cal = fynncloud.getIntegration('calendar');
if (cal?.available) {
const res = await fynncloud.fetchApp('calendar', '/api/events?range=week');
const events = await res.json();
}

Send the request through FYNNCLOUD_INTERNAL_API_URL/api/apps/<targetAppId>/proxy/<path> with:

  • X-FynnCloud-App-ID: <your-app-id>
  • X-FynnCloud-App-Secret: <your-FYNNCLOUD_APP_SECRET>
  • X-FynnCloud-User-ID: <acting-user-uuid>
  1. Verifies the calling app declared targetAppId in compatibility.apps, that the installed target version satisfies the SemVer range, and that access: "read" blocks non-GET/HEAD methods.
  2. Mints a fresh 60-second target-scoped AppAccessToken for the target app and attaches it as Authorization: Bearer <targetToken>.
  3. Sets X-FynnCloud-Caller-App: <callerAppId> and signs the request with the target app’s FYNNCLOUD_APP_SECRET via X-FynnCloud-Gateway-Signature.
  4. Returns 403 / 404 / 503 cleanly if the integration is unauthorized, uninstalled, or unhealthy.