Turntable

Release lane

Why signing and publishing run in a separate process, what it holds, and how to deploy it.

Turntable runs untrusted workflow code and reads untrusted pull requests, so the process that does that must never be the process that can sign a release or publish one. The release lane is that second process. Everything that can make a signature or a publish lives in it, and in nothing else.

Status. Built and tested: the role split, the request queue, the lane’s checks, the boundary tests, the lane’s wiring to the signing service with the built-in key backend, and strict and compat publishing to npm, GitHub Releases and a registry image. KMS backends are not wired into the lane yet (the signing service has them; the lane has no credential configuration for them).

Roles

turntable serve --roles <list> chooses what one process runs:

RoleWhat it runs
webThe HTTP server: API, UI, webhooks, the OIDC issuer.
workerThe job scheduler and runner (what --worker starts).
pollerThe GitHub poller (what --poll starts).
releaseThe release lane, alone.

--roles all is web,worker,poller. Without --roles, the long-standing flags decide: web, plus worker with --worker and poller with --poll. release cannot be combined with any other role: it is its own process, with its own keys.

What only the release lane holds

Held by the release lane aloneWhere
The signing backend configuration and its KMS or OIDC credentialsThe lane’s environment, never the main process’s
The release master key and the publish credentials sealed with itTURNTABLE_RELEASE_MASTER_KEY_FILE, a key file the main role’s user cannot read
The forge credential it uses to re-check a releaseTURNTABLE_RELEASE_GITHUB_TOKEN
Its record of artifact digestsTURNTABLE_RELEASE_DATA_DIR, its own SQLite file
The only call to SigningService.signReleaseOnly src/release/ and src/signing/ mention it, enforced by a test

A main process ignores every TURNTABLE_RELEASE_* variable, even when one is set (it warns that it did). A test starts the main runtime with all of them present and asserts it holds none of them. Another is a source guard: no file outside the lane reads those variables or calls the signer.

Publish credentials are vault secrets for release-class jobs. The main lane’s vault refuses to use any of them (release_lane_only) before it decrypts anything, and they are sealed with the release master key, which the main process does not have. Set them with turntable secret set --master-key-file <release key>.

How a release flows

  1. An incident freeze of the org or project stops all of it: the lane does not claim requests of a frozen scope, re-checks the freeze when it decides and again just before it signs (frozen), and request_release is refused while frozen. Requests wait and are processed when the freeze clears.
  2. An operator or pipeline with release_operator calls request_release (REST and CLI only, never an MCP tool) with a run, the tag and the artifact names. The main process writes a pending row in release_requests and does nothing else.
  3. The release lane claims the oldest pending request. It trusts nothing in that row or in the main database for what to sign:
    • the run must have been built from refs/tags/<tag>;
    • the run’s repository must equal the one pinned for the project in the lane’s own file (turntable release pin-repo --org <slug> --project <slug> --repo <owner/name>); a project with no pin, or a run row naming another repository, is refused before the forge is asked;
    • it asks the forge itself, with its own credential, about that pinned repository: which commit the tag points at (annotated tags followed to the commit), and that must be exactly the run’s sha. A tag that does not exist, or has moved, is refused;
    • it reads the artifact bytes and recomputes the digests. They must equal what the build recorded, and equal what the lane attested for that release the first time, kept in a file the main process cannot write. The attestation is keyed by the release identity (org, project, pinned repository, tag, artifact name), not by the run, so a second run for an attested tag gets no fresh first sight: a different digest, an added artifact or a missing one is refused as an attestation mismatch, and the same tag signs again only with identical digests (an idempotent re-sign is fine).
  4. Only then does it call the signing service, passing what it verified: the forge’s commit, the pinned repository and the digests it computed from the bytes. The service signs only if its own read of the stored run and artifacts is exactly that (a row edited between the lane’s check and the signature is refused as verification_mismatch), applies its own policy on top (release class, release ref, approvals), builds the statement with only those verified subjects (the run’s other artifacts and pinned actions are unverified reads of rows, so a lane-signed statement leaves them out), and the lane accepts the result only if the signed subjects are exactly what it verified.
  5. It writes the outcome (signed with the key id and envelope, or refused with a short reason) and an audit entry with what it saw at the forge and in the bytes.

A compromised main process can write any row it likes, including a finished, signed-looking request. The lane never reads results back as truth; whoever consumes a release verifies the envelope under the release public key (turntable verify), which a forged row cannot satisfy.

Releasing from a tag

A tag push becomes a release run through the poller. Nothing about it is automatic: a project opts in with turntable policy set --ingest on --tag-refs 'refs/tags/v*' ..., a local, audited, CLI-only setting whose patterns are an exact tag or refs/tags/<literal prefix>* (never refs/tags/*). The webhook for a tag push only wakes the poller; the poller reads every fact from GitHub itself. The full rules are in the poll config; what matters for a release is this.

  • Which tags. A tag is ingested once per (name, commit), only if its commit is on the default branch’s first-parent history (not an intermediate commit of a merged branch), and its workflow is read at that commit. A tag that moves to another commit creates nothing and is audited as tag_moved.
  • Protection. Anyone with write access can push a tag, so a tag run starts at once only when an active GitHub ruleset on tags has creation, update, deletion and non_fast_forward rules that cover the pattern, exclude nothing, and can be bypassed only by organization or repository admins. The ruleset’s bypass list is returned only to a token with administration: read: without that every ruleset is unverifiable and every tag run is held. GitHub’s * in a ruleset does not match /, and neither does ours: an include refs/tags/v* covers v1 but not v1/evil, so it covers a pattern only when the pattern’s literal part does not run past a / beyond the include’s own. The ruleset must also have been in force when the tag was made. The poller reads the rulesets before it lists tags, writes a persisted marker when it first sees a pattern protected (and removes it at the first poll that does not), and records when each tag was first listed. A tag first listed in or before the poll that first saw protection is predates: held, because it may have been made before the ruleset. When the ruleset reports an updated_at later than the persisted marker, the marker is reset to now, so every tag listed up to that poll counts as predating. Only times this server observed count as evidence: a tag’s own dates (the tagger’s, the commit’s) are chosen by whoever creates it, so they are never read. A reading that shows protection is never reused by a later poll; one that shows none is reused for a minute. The run records which applied (facts.tagProtection: ruleset, predates, none or unknown) and the poller audits it (poll_tag_run).
  • Holds. A tag no ruleset protects, or that may predate the ruleset, is created held. approve_run (bound to the run’s sha and workflow hash, and needing a release operator whatever the org set for pull requests) lets it proceed, but it does not stand in for an environment’s own gate: a job in a gated environment such as release still waits for that environment’s approval. Turntable’s own .github/workflows/release.yml gates its publishing jobs (github-release and image) on environment: release; the dry-run jobs have none. Every step of those jobs that publishes (the GitHub release and its assets, the attestations, the image push and its SBOM) also needs the repository variable PUBLISH_FROM_GITHUB to be true and TURNTABLE_CI not to be: on GitHub it is unset, so nothing is published from there, and Turntable publishes through the release lane. The whole image job (and image-dry-run) is skipped under Turntable, whose sandboxes have no Docker: the image is deferred for the first alpha. While it waits, a held run sits in a concurrency group of its own (held:<tag>:<group>), so a run that may never start cannot cancel or queue behind the default branch’s runs. Approving it moves it into the workflow’s real group, and with cancel-in-progress it then cancels older runs of that group, but only when its jobs start at once (one waiting on its environment’s own gate takes no one’s place yet).
  • No author. A tag run has no actor. An annotated tag’s tagger is free text, not a verified identity, so it is kept only as facts.taggerLabel for display, never as the actor that the author check and the OIDC claims read (a token minted for the run has no actor claim).
  • Quorum. With no known author the environment’s “the author cannot approve” rule cannot be checked. For a run the poller made from a tag (its stored trust facts name the tag, set by ingest and never by input, and its ref is that tag’s ref) no approver is excluded, whoever tagged, and the environment needs one more distinct identity than its required: at least required of the approvers are then not the author. A quorum of 2 needs 3 distinct approvers, a quorum of 1 needs 2. The audit log records approval_author_unknown, “author unknown; required N distinct approvers (R+1)”. The tagger’s name is free text the tag’s creator chose, so it is display only and never excludes an approver. With allowAuthorApproval (the solo setup) the author rule is off and required applies. Any other run with no author stays refused whatever the quorum. Lightweight and annotated tags behave the same.

Solo release on a hosted instance. A one-person org has no shell to run turntable approvals policy, and with the default quorum of 2 a tag run needs 3 distinct approvers. The operator sets the solo policy for release in turntable.toml instead:

toml
[orgs.acme.approval_policy.release]
required = 1
allow_author_approval = true

A tag run then needs one approver, and the setting is locked: the CLI and instance_set_setting refuse to change it until the file does. The instance administrator can set the same value without the file when nothing locks it (instance_set_setting with key: "approval_policy" and target_org). Both are audited and flagged as a loosening; see Human approvals.

Publishing

After signing, the lane publishes the bytes it verified to the targets declared for the project. Declarations live in the lane’s own file, never in the main database:

sh
turntable release publish-target set --org acme --project web --key npm \
  --kind npm --package @acme/web --artifact web-1.0.0.tgz --secret NPM_TOKEN \
  --accept-long-lived-token
turntable release publish-target set --org acme --project web --key release \
  --kind github-release --assets cli-linux,cli-darwin
turntable release publish-target list --org acme --project web
  • npm needs --accept-long-lived-token: npm trusted publishing does not accept self-hosted issuers, so the lane holds a long-lived granular token in the vault (release trust class, destination registry.npmjs.org, no environment). The lane builds the publish request from the tarball it hashed: the package name, the version and the tag must all match, private packages are refused, and an existing version is accepted only if its integrity equals ours.
  • GitHub Releases are created as a draft, the assets are uploaded, every asset is downloaded again and hashed, and only then is the draft published. The provenance envelope is attached as provenance.intoto.json unless disabled. A published release is never modified: it is accepted if its assets match, refused if not. The write credential is TURNTABLE_RELEASE_GITHUB_PUBLISH_TOKEN, held by the lane only.
  • A target names only artifacts the request asked for. Each target’s state is stored per tag, so a partial publish resumes and a finished target is not repeated. An incident freeze stops publishing target by target.
  • Credentials are never audited or stored in results. Every outcome is audited as publish:<key>:<state>.

Targets run in key order and a failed target does not undo a signed release.

Compat mode: the job publishes, the lane holds the credential

A workflow that already runs npm publish, docker push or gh release upload can keep doing so. Declare the target with --mode compat (an image, --kind oci-image, is always compat). The lane signs as usual and records the target as pending. It also remembers, in its own file, that it signed this run’s release.

The lane hosts a release proxy (TURNTABLE_RELEASE_PROXY_PORT, optionally _BIND and _ADVERTISE_HOST): the worker’s proxy code with the release vault as its secret source. A publish job is given a proxy credential and rules only by the lane, and only when all of these hold: the lane signed this run, the repository is still the pinned one, the tag still points at the signed commit at the forge, and no incident freeze is on. A freeze is checked again on every request and revokes running jobs’ credentials. The rules come from the project’s compat targets and the digests the lane attested, never from the workflow:

TargetWhat the job may do, and only this
npmGET and PUT on the exact package path (/@scope%2Fname, the one encoded slash the proxy accepts), and the PUT body must be the document the lane derived from the verified tarball’s own package.json: the one version, the name, a version manifest equal to that package.json plus dist (integrity required and correct), dist-tags exactly { <tag>: <version> }, and no other field. The few fields the npm client adds on its own are each constrained: _id is exactly <name>@<version>; readme is empty or exactly the text of a top-level README file of the tarball (the lane reads them from the verified tarball; any of them is accepted, since the client picks one), readmeFilename names one of those files and goes with its text; gitHead is absent or the approved tag’s commit; _nodeVersion and _npmVersion are semver-shaped only. Text shown on npmjs.com therefore always comes from the tarball. A package whose package.json npm publish rewrites (normalised repository, bin, bugs) will not match: publish it in strict mode.
GitHub releaseRead releases of the one repository, and upload assets on uploads.github.com to one release only: the draft the lane itself created for the tag before the job ran, pinned by its release id. A job creates no release, edits none, and can never attach to a published one. The credential is the lane’s own, never the job’s.
Container imageRegistry version ping, and each endpoint of a push anchored to its own shape: POST /v2/<repo>/blobs/uploads/, PATCH/PUT on one upload-session segment, GET/HEAD of blobs/sha256:<64 hex>, GET/HEAD of one manifest segment. A longer path that merely starts like one (a repository named <repo>/blobs/x) is not the approved repository’s. PUT of a manifest only under the approved references and only if its sha256 is the attested one: the release’s own version tag and its digest always, and a mutable tag (latest, 1.2) only when this is the project’s newest approved release. The proxy answers the registry’s token challenge itself, so the job never sees a bearer token.

After the job, ReleaseLane.finalize checks the result against the lane’s own record: a GitHub draft is listed in full and published only if its asset set equals the wanted one exactly, by name and digest (assets that are missing or differ are replaced from the verified bytes first; an extra asset a job attached makes the lane refuse, leave the draft and audit the names), an npm version that exists is accepted only with the approved integrity and is published by the lane if the job did not. A version or published release with other bytes is refused, never accepted.

How a job gets its credential: the release channel

The worker does not hold or see any publish credential. For an attempt of a release-class run it asks the lane over the release channel, and runs the job behind the release proxy if the lane agrees (replacing the worker’s own proxy for that job; such a job runs with the same no-other-route egress as any secret-bearing job). Because the lane grants rules per run, every job of that run that starts after the lane signed is eligible, so keep jobs that should not publish out of a release-class run’s tail or give them no network.

  • Transport. A unix socket by default (TURNTABLE_RELEASE_CHANNEL_SOCKET, default <data dir>/channel.sock, mode 0600 in a 0700 directory), or TCP with mutual TLS for split hosts (TURNTABLE_RELEASE_CHANNEL_TCP=host:port with _TLS_CERT_FILE, _TLS_KEY_FILE, _TLS_CA_FILE). A client without a certificate from that CA is not served at all.
  • Request key. Lane and worker share a key (TURNTABLE_RELEASE_CHANNEL_KEY_FILE on the lane, TURNTABLE_PUBLISH_CHANNEL_KEY_FILE on the worker, plus TURNTABLE_PUBLISH_CHANNEL_SOCKET or _URL with _TLS_*_FILE). Every request carries an HMAC over its fields and a timestamp; a stale, forged, altered or replayed request is refused. The key lets a process ask. It cannot publish.
  • An approval is not standing. It lasts six hours from the signing, ends when the release is finalized (every target published), and is replaced when a newer release of the project is approved. A later request for the same run, or for an older release, is refused (approval_expired, already_finalized, superseded), so an old approval cannot be used to publish old bytes under a name that has moved on, such as rolling latest back. Signing the same run again does not reopen a finalized release, extend its window once it is replaced, or move it in the order of approvals (its place is fixed at the first approval), so re-signing an older release never makes it the newest. A registration lasts no longer than its approval, and every request through it re-checks: a release finalized, expired or replaced gets nothing more: the request is refused (a 502 the job can read, audited as release_proxy_refuse with the reason) and the registration is ended by the next sweep, never from inside the refused request, which would cut the connection the refusal is written on.
  • The lane re-verifies. The attempt must be running, in that job and run, with the release trust class. Then the lane’s own file decides: it signed this run, the pin holds, the tag still points at the signed commit, a compat target exists, no freeze is on, and (for GitHub) the draft exists or can be created. Nothing the worker says counts for those.
  • The reply is the proxy endpoint and an attempt-scoped proxy credential. Never a publish credential.
  • Ending. The worker revokes at the end of the attempt (and when it is aborted); the proxy credential also expires on its own TTL, and a freeze revokes it at once.

Checking an image after the push

When the job is done, finalize looks at what the registry now holds for an image target. It answers the registry’s token challenge with the release-class credential (the realm must be on the registry’s host, or on the one exact host the target names with --realm-host, as for Docker Hub’s auth.docker.io; always https), fetches the manifest by every approved tag and by the attested digest, and hashes the bytes itself. Every reference must hold exactly the attested manifest: a tag that was moved to other bytes is refused (image_digest_mismatch, with both digests audited), and an image the job never pushed is a failed target.

The lane then attaches its own signed provenance as an OCI 1.1 referrer of the image: an artifact manifest (artifactType: application/vnd.in-toto+json) whose subject is the image manifest and whose one layer is the signed envelope. A repeat run finds the referrer already listed and pushes nothing. A registry that has no referrers API cannot carry it: the target still succeeds (the image is verified) and says what happened to the provenance. Images are processed after the project’s release targets, and provenance_as_release_asset is recorded only when a GitHub release target that carries the provenance was published or is already on record as done in that pass, so the asset was uploaded and read back on the release. Otherwise (no such target, or it failed or was refused) it records provenance_unattached. Blob uploads for images are not pinned: they are content-addressed, and the manifest decides what a tag means.

Artifacts from jobs

With the artifact store on (TURNTABLE_ARTIFACTS_URL, see Compatibility), a build job’s actions/upload-artifact records the artifact for the run and writes its bytes to <data dir>/artifacts/<run id>/<name>, which is the layout the lane reads. Point TURNTABLE_RELEASE_ARTIFACT_DIR at that directory, read-only for the lane’s user. The uploaded blob is only transport. The lane recomputes its digest and length from the bytes and refuses a mismatch with the record, as before. Then, if it is a zip, the lane unpacks it into a fresh private directory under unpackRoot (default: turntable-release-unpack in the system temp directory), and the provenance subjects are the files inside: each file’s path in the zip and the sha256 of its bytes. Release targets name those files. An artifact that is not a zip (archive: false) is its own subject, by artifact name. The unpacked files are removed when the request is done.

Unpacking refuses, with unpack_failed and the reason in the detail, and signs nothing:

  • an absolute path, a drive letter, a backslash, a NUL, an empty, . or .. segment, or a name outside A-Za-z0-9._/+- (up to 190 characters, starting with a letter or digit);
  • a symlink, a device, a fifo, a socket or a Windows reparse point (a zip has no hardlinks, so an entry claiming any link type is refused);
  • a duplicate name, also one that differs only in case, or a name that is both a file and a directory;
  • more than 10,000 entries or more than 2 GiB of uncompressed data in total. Sizes are checked from the archive’s declared sizes before anything is inflated, and again while inflating, so an archive cannot expand past its own claim. These are constants in release/unpack.ts;
  • encryption, zip64, split archives, a method other than stored or deflate, a local header that disagrees with the central directory, overlapping entries, a bad CRC, or bytes after the end record.

Two files with the same name across the request’s artifacts are refused as duplicate_subject. The signing service checks each zip’s digest against its own record and signs the lane’s file subjects only alongside those zip digests (verified.archives); with no zip in the request it signs exactly the recorded artifacts as before.

The class recorded with each artifact is the control plane’s own, taken from the attempt that wrote it, and the signing service already refuses an artifact below the release class (artifact_not_release_class). The artifact service applies the same rule to downloads, so a job in a release run never receives what a lower class wrote.

Deployment

Run the release lane as its own service, with its own volume or directory and its own secrets. On Railway that is two services from the same image:

Main serviceRelease service
Commandserve --roles web,worker,poller (or the flags you use today)serve --roles release
Public portYesNo (it listens on nothing)
TURNTABLE_MASTER_KEY_FILEThe main keyNot set
TURNTABLE_RELEASE_*Not setAll of those below
Signing backend and KMS credentialsNot setSet
DatabaseThe main data volumeReads the main data volume for requests (SQLite: shared file; see below), plus its own TURNTABLE_RELEASE_DATA_DIR

The release service’s variables:

VariableMeaning
TURNTABLE_RELEASE_MASTER_KEY_FILEThe release master key file (turntable keys init), on the release service’s own volume. Or set TURNTABLE_RELEASE_MASTER_KEY (base64 or hex) instead, not both; see Hosted deployment.
TURNTABLE_RELEASE_DATA_DIRIts own state: the attested digests.
TURNTABLE_RELEASE_GITHUB_TOKENA read-only token for repository contents and refs, used only to re-check tags.
TURNTABLE_RELEASE_ARTIFACT_DIRRead-only artifact bytes, <dir>/<run id>/<name>. The lane refuses a symbolic link at any component, checks containment on real paths and reads through an open descriptor, so a link planted in the directory cannot make it hash (and sign) another file.
TURNTABLE_RELEASE_BUILDER_IDThe instance URL, written into the provenance as the builder id.
TURNTABLE_RELEASE_POLL_MSHow often it looks for requests. Default 5000.

Key custody. The release master key and the signing credentials exist only on the release service. Do not put either on the main service’s volume or in its environment. KMS keys should be granted to the release service’s identity alone, so the main service has no permission to sign even if its environment is read.

Database. On SQLite the two processes read and write one file for the request queue, so they share a data directory mount; everything the lane itself holds (keys, attestations) is in its own files. A separate database role per process arrives with Postgres: the main role gets insert on release_requests, the release role gets read on runs and artifacts and update on release_requests, and neither gets the other’s.

Upgrading

Builtin signing keys are stored per org (the org’s id is part of the stored name; see Signing). A key created with an earlier turntable release init-key --name <key> was stored under the bare name and is no longer found, and nothing falls back to it. Create it again with turntable release init-key --org <slug> --name <key> and pin the new public key. Releases signed with the old key still verify against the old public key.

Limits

  • The lane’s artifact attestation is first use: it protects against changes after the lane first saw an artifact, not against a build that recorded bad bytes in the first place. An independent record of digests written by the build is future work.
  • Only the built-in key backend is wired into the lane. Create its key once, on the release service, with turntable release init-key --org <slug> --name release (the key is stored under the org’s id, so another org’s builtin:release is a different key; it prints the public key to pin; the private key is sealed under the release master key in the lane’s own directory), and point the project at it with turntable policy set --signing-key builtin:release.
  • Approvals are read from the main database and re-verified from their signatures, so the lane does not trust a stored “approved” flag either.

Type to search…

↑↓ navigate↵ openesc close