Skip to content

05 · Forge & supply-chain security

Status: Implemented (T9) · Owner: Platform

Connectors are code that touches customer data (design 04). Forge makes sure runners only execute connector builds that came from our CI, unchanged, and that an administrator explicitly chose. Decisions are in ADR-0004.

Piece Where Role
Bundle format + signing engine/crates/flux-forge (library) Pack, sign, verify, unpack
flux-forge binary same crate serve, plus keygen, pack, sign, publish, verify, revoke for CI and operators
Forge service flux-forge serve, ClusterIP only Stores blobs and metadata, history, revocations
Runner cache flux_forge::Cache, flux_exec::connect::ForgeResolver Install pinned bundles, re-verify before every launch
Connector catalog config kind connector-catalog (control plane) Pins name → version → sha256
Forge UI /app/forge (via /api/forge) Packages, versions, files, build, SBOM, history, revoke

A bundle is a gzip’d tar. The first entry is manifest.json; the rest are the files it lists, each with sha256, size and mode:

{
"schema": 1,
"name": "flux-connector-adbc-snowflake",
"version": "0.3.1",
"platform": "linux-x86_64",
"entrypoint": "flux-connector-adbc",
"files": [
{"path": "flux-connector-adbc", "sha256": "…", "size": 9876543, "mode": 493},
{"path": "drivers/libadbc_driver_snowflake.so", "sha256": "…", "size": 45678901, "mode": 420}
],
"build": {"commit": "…", "ref": "master", "pipeline_url": "…", "built_at": "…"},
"sbom": {"bomFormat": "CycloneDX", "components": []}
}
  • Packing is deterministic (sorted paths, zero mtimes and owners), so the same inputs always give the same digest.
  • Names, versions and platforms are validated; paths must be plain relative paths (no .., absolute paths, backslashes, symlinks or devices).
  • Unpacking accepts only regular files listed in the manifest with a matching digest and size, rejects extras and duplicates, and fails if anything listed is missing.
  • Unpacked files are read-only (0555 executables, 0444 data).
  • Limits: 512 MiB per bundle, 2 GiB unpacked.

The artifact digest is sha256 of the whole bundle, so it covers the manifest and every file.

Ed25519 over a domain-separated payload:

"flux-forge/v1\0" name "\0" version "\0" platform "\0" sha256 "\0"

Binding the identity into the payload means a signature for one artifact can’t be replayed for another name, version or platform. Key ids are fk- plus 16 hex characters of sha256(public key).

  • The signing key (32-byte seed, base64) is a masked, protected CI variable, FLUX_FORGE_SIGNING_KEY, available only on protected branches.
  • Verifiers trust public keys from their own configuration (FLUX_FORGE_TRUSTED_KEYS), never from Forge. Forge holds no signing key and can’t mint artifacts.
  • Verification uses verify_strict (rejects malleable signatures and weak keys).

CI builds each connector, then:

Terminal window
flux-forge pack dist/postgres --name flux-connector-postgres --version "$VERSION" -o pg.bundle
flux-forge sign pg.bundle # FLUX_FORGE_SIGNING_KEY
flux-forge publish pg.bundle # FLUX_FORGE_URL, FLUX_FORGE_PUBLISH_TOKEN

The service re-checks everything before storing: contents against the manifest, and the signature against its trusted keys. Versions are immutable: publishing the same name/version/platform again is idempotent for identical bytes and refused (409) for different bytes. Rejected publishes are recorded in the history with the reason.

Blobs are content-addressed at blobs/<sha256>.bundle in the flux-forge bucket and written with create-only semantics. When serving a blob, Forge re-hashes it and refuses to serve bytes that no longer match (storage isn’t trusted either).

The connector-catalog config item (versioned, with rollback, design 10):

{"platform": "linux-x86_64",
"connectors": {"flux-connector-postgres": {"version": "0.3.1", "sha256": "…"}}}
  • Only admins can create, change, activate or roll it back (KindSpec.write_role).
  • Saving checks the shape. Activating checks every pin with Forge: it must exist, have exactly that digest, and not be revoked. A wrong or revoked pin can be saved as a draft but never becomes active.
  • New builds reach runs only when an admin activates a catalog version that pins them.

Before a run starts, the orchestrator passes the active catalog’s pins to the runner, which calls ForgeResolver::install:

  1. Fetch the revocation list. Fail closed: if Forge can’t answer, nothing installs and the run fails with a clear error.
  2. For each pin: reuse the cached bundle or download it, then verify digest = pin, signature by a trusted key over (name, version, platform, digest), and that the manifest identity matches the pin. This runs on every install, cached or not.
  3. Unpack into a temporary directory, rename into place, re-hash.

Then every connector launch (ConnectorResolver::resolve) re-hashes every file of the bundle and rejects extra files before spawning the process. A connector that isn’t pinned is refused. A modified file is refused (refusing to run … changed since it was verified), matching the requirement to decline mismatched binaries.

Hashing on every launch costs about 0.1 s per 100 MB of bundle; that’s small next to connector start-up and network I/O. The remaining window between hashing and exec is covered by the cache being read-only and private to the runner pod.

POST /v1/artifacts/{name}/{version}/{platform}/revoke with a reason (admin token; the app calls it for admins and records who). Effects:

  • The digest appears in /v1/revocations; runners refuse to install it, including from their cache.
  • Catalog versions pinning it can’t be activated. The currently active catalog keeps pinning it until an admin activates a fixed version, and runs fail loudly until then.
  • Revocation is permanent; publish a new version to fix a build.

All endpoints need a bearer token. There are three distinct tokens: read (runners, control plane), publish (CI; can also read), admin (control plane; can read and revoke, but not publish).

Method Path
GET /v1/packages Package summaries (latest version, platforms, counts, downloads)
GET /v1/packages/{name} Every version and platform
GET /v1/artifacts/{name}/{version}/{platform} Metadata, manifest, signature, downloads, history
GET /v1/blobs/{sha256} Bundle bytes (re-hashed before sending)
GET /v1/revocations Revoked digests
GET /v1/events?name=&limit= Activity feed
GET /v1/keys Trusted key ids
POST /v1/artifacts Publish (body: bundle; headers x-forge-key-id, x-forge-signature)
POST /v1/artifacts/{name}/{version}/{platform}/revoke Revoke ({"reason"})

Metadata lives in Postgres (schema forge): artifacts and events. The service refuses to start with missing trusted keys, short tokens, or tokens that are equal.

  • Library: deterministic packing, round trip, signature binding (replay for another version, wrong digest, untrusted key, tampered bytes), unsafe and unlisted entries.
  • Service + cache (tests/forge.rs, against Postgres): auth per token, untrusted signer, idempotent and immutable publishing, install, tamper detection and repair, wrong pin, views and history, revocation, fail-closed when Forge is unreachable.
  • Engine (flux-exec/tests/connectors.rs): the protocol test connector packed, signed, published, installed through ForgeResolver and run in a pipeline preview; unpinned and tampered binaries refused.
  • Control plane (tests/test_forge.py, against the real binary): admin-only catalog changes, activation checks against Forge, revocation through the API, views.
  • Key rotation ceremony: add the new public key to every verifier, sign new builds with it, then remove the old key. Old builds signed only by the old key stop verifying, so rotation means re-signing or rebuilding pinned versions first.
  • Signing from an HSM or a separate signing service instead of a CI variable.
  • Generating CycloneDX SBOMs in CI (cargo cyclonedx); the format already supports them.

See the architecture overview.