Repository navigation
feat(nodes): run transcode nodes without database, Redis or shared secrets - #4337
Conversation
Adds the per-node credential that thin transcode nodes will sign with.
Nothing signs with it yet, so existing nodes behave as before.
- stream_nodes.node_key_ciphertext holds the key encrypted under the row
AAD. It is a credential, not configuration: issuing one moves neither
the admin revision nor the pool generation.
- POST /api/v2/admin/nodes/{id}/key issues or rotates a key and returns it
once. Node rows gain key_issued, and the node capabilities gain
node_keys. Proxies take no key (409).
- nodepool.KeyRegistry holds every node's credential, disabled nodes
included, on API servers and proxies. It reloads on node_pool_changed,
every minute, and on a lookup miss at most once a second. A proxy that
starts before the column is migrated keeps running and loads it later.
- Two transcode nodes can no longer be saved at one canonical URL, since
the registry finds a node by that address.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The core now signs every request to a transcode node with that node's key, and the node verifies with the same key from SILO_NODE_KEY. The shared secret signs only requests to proxies. - nodeauth splits signing by direction: core to node and node to core use separate HKDF labels and canonical versions, so a request captured in one direction never verifies in the other. The node-to-core signature also covers the source grant header. - Senders name the kind of node they target. The registry's keyring gives a transcode target only that node's key and gives a proxy target the shared secret only for a URL registered as a proxy. An unknown URL and a keyless node are errors; neither falls back to the shared secret. - A transcode node without a usable key stays listed and health-checked but takes no new work. - The node's signed routes accept no legacy bearer. - HTTP clients that call a node refuse redirects explicitly. The node still holds its database and Redis; later commits remove them. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Adds the routes a thin transcode node will call instead of reading the database and Redis itself. Nodes do not call them yet. - nodecontrol.RequireNode verifies a node-signed request against the key registry and puts the node id in the request context. Handlers take the node's identity only from there. A disabled node is accepted; a deleted, keyless or proxy row gets 401. - GET /api/internal/nodes/self/config returns the calling node's settings with its row overrides applied, with the revision as a strong ETag. A test fails when the node reads a config field the document lacks. - POST .../self/report replaces the node's session records and telemetry snapshot, fenced on (boot_id, seq) so a replayed or older report changes nothing. Keys are scoped by the authenticated node id. - POST .../self/logs stores a log batch under the authenticated node and clamps entry timestamps to the core's clock. - POST .../self/health-changed publishes node_drain_changed. - Report, logs and health-changed share a per-node request budget. - The routes stay out of the request log, the activity log and response compression, and the worker protocol contract lists them as node_signed. miniredis is added for tests: CI has no Redis, and the report fence and session replacement are Lua scripts. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Each transcode node shows whether it has a key, with a warning that a node without one takes no work. On a server that can issue keys, an admin can issue or rotate the key. Rotation asks for confirmation and says the node's running streams fail until it restarts with the new key. The new key is shown once, with the SILO_CORE_URL and SILO_NODE_KEY settings the node starts with. It is kept in the dialog's state only, and the dialog cannot be closed while the request is in flight. A refusal shows the server's reason; a lost answer says the key may have rotated. Creating a transcode node offers to issue its key. The translation pin names a local catalog commit. Re-sync to a published release before this merges. Co-Authored-By: Claude Fable 5.2 <[email protected]>
The core now makes the decisions a transcode node made from Redis and the shared secret. Nodes do not call the new routes yet. - POST /api/internal/nodes/self/resolve answers the recipe and playback identity for a node rebuilding a lost HLS session or serving a progressive remux: deny checks, token verification, and a recipe bound to the calling node. A complete stored card wins over a complete token, because a move rewrites the card while the client keeps its old token. A recipe store read error is 503. - POST /api/internal/nodes/self/revoke-recipes revokes the calling node's recipes, for the node to call inside its own force-reload teardown. - A remote stop deletes the transport's stored recipe before it tells the node, unless the recipe names another node URL. A release deletes nothing. jellycompat reuses a transport id across start candidates, so a late stop on one must not remove the next one's recipe. - Every dead-node move writes the stored recipe naming the new executor, for sessions whose URLs carry a token too. jellycompat recipes bind the node they started on. - Every relay that signs a request to a transcode node checks the deny marker first, and a move rechecks it before it commits and before it serves. - A node's 401 and a failure to sign for a node reach clients as the node being unavailable, not as a client auth failure. Neither moves the transcode: a replica with a stale key registry cannot sign for any node. /api/v2 delivery maps a relay 502 to dependency_unavailable. Co-Authored-By: Claude Fable 5.2 <[email protected]>
The core now signs a source grant for every job it sends a transcode node: a stateless capability to use one revision of one catalog file, or theme file, through one node. Nodes do not use grants yet and still approve paths against the catalog themselves. - A grant names the node, the file or theme id, the fspath-encoded catalog path, the size and the modification time, and lasts an hour. Its key is derived from auth.jwt_secret under its own label. Revisions compare the modification time at microseconds, the catalog's precision. - Native and Jellyfin-compatible starts, dead-node moves, download preparation, trickplay, chapter thumbnails and subtitle-sync samples carry source_grant. A move sends the replacement node a fresh grant. When no grant can be minted the work fails over or runs locally as a failed dispatch does. - POST /api/internal/nodes/self/sources/open exchanges a grant for the approved path and a renewed grant. It refuses another node's grant (403), a source that left the catalog or the disk (410) and a changed size or modification time (412). - Resolve checks that the catalog still has the recipe's file or theme and adds a grant for the calling node. - nodesource.Opener is the node side: it opens a grant against the node's own mount, refuses a mount whose revision differs, and renews the grant while the source is open. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…crets A transcode node now starts with two settings, SILO_CORE_URL and SILO_NODE_KEY, and holds no database, Redis, data cipher, event bus or shared secret. There is one transcode node type and no legacy mode: nodes from before this change cannot work with an updated core, or the reverse. Proxies are unchanged. - MODE=transcode branches before the bootstrap. DATABASE_URL, REDIS_URL, SECRET_KEY, NODE_URL and NODE_NAME are ignored with one warning. A plain-HTTP core URL off the host logs a warning, because the node takes its FFmpeg path, directories and input paths from the core's answers. - The node reads its configuration from the core, polls it every 30 seconds, and rereads it when the core pushes a reload. The core pushes after a drain request or resume and after a change to a node's overrides. An unchanged poll keeps the configuration pointer. - Sessions and stream telemetry stay in memory and go to the core in a report every second. Logs, FFmpeg output included, ship to the core. Drain changes are reported to the core instead of the event bus. - The node verifies no stream token and reads no deny marker or recipe. A lost HLS session and every progressive remux request ask the core's resolve route, after the node's own stop fences. A force reload asks the core to revoke the node's recipes first. - Every job opens its input with the source grant it carries, at the approved path on the node's own mount. A mount whose file differs from the core's answers 409. The catalog path authorizers are gone. - Health carries the node control version and key_rejected. The core treats a transcode node without the version, or with a rejected key, as unhealthy, so a node on an older build is not placed. - The omnibus init and the shipped Compose file no longer ask a transcode node for database or Redis settings. Co-Authored-By: Claude Fable 5.2 <[email protected]>
- config now shares the per-node background budget, and resolve and sources/open get a budget of their own (200 a second, burst 600), so a node key cannot loop catalog reads without bound. A node treats 429 as transient on every route. - Log entries a node ships are normalized before they are stored: an address that does not parse is cleared and node-supplied text is capped. A bad row no longer makes the core retry the batch row by row, and the dropped-entries warning is logged at most once a minute per node. - Issuing a key publishes node_pool_changed even when the pool reload fails, and a node's 401 asks the credential registry to reload, so a replica holding a replaced key heals in seconds. - A dead-node move writes the new node's stored recipe as soon as the move commits, then retires the old node. Nodes no longer delete recipes, so the wait left a window where the new node could not rebuild. - A chapter thumbnail job a node cannot serve reports the reason the core falls back to local extraction for. - A rejected key is described with both causes: a replaced key or a clock more than 30 seconds off. - A progressive remux request checks the node's own state before it asks the core. - make dev-transcode starts a node with SILO_CORE_URL and SILO_NODE_KEY. Co-Authored-By: Claude Fable 5.2 <[email protected]>
docs/architecture/transcode-nodes.md is the authority for the design: node keys, signing in both directions, the node control routes, playback authority on the core, source grants, failure behavior and security properties. docs/update-to-1.0.md gains the operator steps for the coordinated node upgrade. Other documents link to the new one and no longer say that a transcode node reads the database, Redis or the shared secret. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…e rejects - Creating, updating or deleting a node now reloads this server's credential registry before the response and publishes node_pool_changed, and reconciliation invalidates the registry when the node list changes. A deleted node kept signing and being signed for until the registry's 60-second reload. - A transcode node shutting down on SIGTERM no longer waits for its sessions while the main server rejects its key: no relay can reach them and nothing will stop them. After a key rotation without a drain, the restart waited out the 10-minute drain timeout. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…te-transcode-nodes - .silo-translations, web/src/locales/*, .silo-translations-files: took main's, then regenerated with sync-translations --local from the rebased silo-translations branch (pin local-de1af480da75). - go.mod/go.sum: kept miniredis/gopher-lua beside main's bumped go-keyring and xxh3; go mod tidy. - scripts/ci/db-contracts.txt: kept both sides' entries. - contracts/api/v2/openapi.json: regenerated; the node protocol's playback_RecipeCard schema gains main's adaptation_reasons. - internal/transcodenode: main's new spawnReconstruct test passes a nodecontrol.Resolution, as this branch's spawnReconstruct takes. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 11 minutes. View limit details
|
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
Security findingsAdvisory findings (3)
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
- A source grant check that fails for a reason other than a missing file (an I/O error, a stale network mount) now answers 503, which the node retries. It answered 410, which ends the job, so a transient stat error on the API server stopped a transcode of an unchanged file. Minting a grant classifies the error the same way. - A full log throttle searches for expired keys at most once per interval. A flood of unknown node ids paid for a pass over all 4,096 keys on every refused request. - The resume primer test from main set no node keys, so its proxy route was never taken and it passed only where a local FFmpeg was installed. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…swers Co-Authored-By: Claude Fable 5.2 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Here are some automated security review suggestions for this pull request.
Reviewed commit: 34dfeb1436
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
…te-transcode-nodes # Conflicts: # .silo-translations # web/src/locales/keys.ts
A node's request budget admits twenty log batches a second, and one batch may be 1 MiB, so a node key could write about 20 MiB a second into the operational log. Log batches now also spend a per-node byte budget on each API server: 128 KiB a second with bursts of 4 MiB. A node past it gets 429, which it already retries. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Here are some automated security review suggestions for this pull request.
Reviewed commit: 6ad9f778c6
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
| deps.wireNodeSources(&nodeControlOptions) | ||
| nodeControl := nodecontrol.NewServer(nodeControlOptions) | ||
| r.Route("/api/internal/nodes/self", func(r chi.Router) { | ||
| r.Use(nodecontrol.RequireNode(deps.NodeKeyRegistry)) |
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Security: Rate-limit signed node bodies before buffering them
A compromised transcode node, or anyone holding its node key, can bypass the intended 20/200 req/s budgets at the expensive stage. RequireNode runs before both limiters, and VerifyFromNode reads, allocates, and hashes up to 1 MiB before invoking the next middleware. An attacker can replay one valid signed 1 MiB request concurrently; excess requests are rejected only after every body is consumed, allowing API memory, CPU, and network exhaustion. Apply per-node byte/concurrency limits before buffering the body.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The body is not read for an unauthenticated request. Verification checks the MAC over the method, path, query, timestamp and claimed body hash first, then the 30-second window, and only then reads the body to compare its hash. Reaching the read therefore takes a valid signature from the node's key, and each such request is held to the 1 MiB bound. A holder of the key replaying one signed request can make the server read and hash those bodies before the request budget refuses them. Moving the budget ahead of the read means putting each route's budget inside the authentication step; I'm leaving that decision to the maintainer and have not changed it.
🤖 Claude Code (claude-fable-5-2)
A log line with a remote_addr attribute put the address and its port into client_ip, an inet column, and the insert of the whole batch failed. A refused node request logs one, so an update with transcode nodes still on the old version lost unrelated log lines. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
…te-transcode-nodes
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Here are some automated security review suggestions for this pull request.
Reviewed commit: 472809a4f7
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
| if err != nil || (parsed.Scheme != "http" && parsed.Scheme != "https") || parsed.Host == "" { | ||
| return transcodeNodeEnv{}, fmt.Errorf("%s must be an absolute http or https URL", envCoreURL) | ||
| } | ||
| env.insecureCoreURL = parsed.Scheme == "http" && !loopbackHost(parsed.Hostname()) |
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Security: Authenticate node-control responses
When a transcode node uses a non-loopback http:// SILO_CORE_URL and an attacker can modify that link, this branch only warns and still trusts unsigned response bodies. The request HMAC does not authenticate responses. An attacker can replace the initial config with playback.transcode_dir: "/"; NewServer snapshots it and the startup orphan sweep recursively removes writable child directories older than 24 hours. The shipped read-only media mount and service UID limit damage, but writable node data remains exposed. Require HTTPS off-loopback or MAC responses, and reject unsafe cleanup roots.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
This is the trust boundary the design states: the node takes its FFmpeg path, directories and input paths from the server's answers, so the link to SILO_CORE_URL must be a trusted network or HTTPS, and the node warns at startup for plain HTTP to another host. The pull request's Risks section and the update guide say so. Refusing a few cleanup roots would not close it, since an attacker on that link controls every path the node uses. Signing the server's answers with the node key would, and it is a reasonable follow-up; it is not part of this change.
🤖 Claude Code (claude-fable-5-2)
Problem
Related issue: #1176
Validation tasks: changes #1177 C1, C2, C3; changes #1178 C1, C2
Other clients: Apple N/A; Android N/A; Roku N/A (node administration is web-only; the one answer clients can see is under Risks, and no parity issue is filed for it)
A remote transcode node today is the full
silobinary with the main server's Postgres connection, Redis,SECRET_KEYand the sharedauth.jwt_secret, which also signs login and stream tokens. A self-hoster who adds a GPU box to their server puts credentials for the whole deployment on that box.This change removes them from the node. A transcode node starts with two settings,
SILO_CORE_URLandSILO_NODE_KEY, and holds no database, Redis or shared secret. An admin issues the key on the web Nodes page. There is still one transcode node type and no legacy mode; proxies are unchanged. The node still reads media from its own library mount at the catalog's paths. Reading through the API servers instead is #4338, stacked on this one.This replaces the draft #2525. It is rebuilt on current
mainand split in two.The validation cases above passed on build 1804 and need another run after this merges. Registering a transcode node now includes issuing its key and starting it with the two settings (#1177 C1, #1178 C1). Session counts and telemetry reach the server in the node's reports instead of the node writing Redis (#1177 C2, #1178 C2). A dead node's session still moves to another node; the rebuild there now asks the API server for the recipe (#1177 C3).
Approach
POST /api/v2/admin/nodes/{id}/keyand stored encrypted on itsstream_nodesrow. The answer shows the key once, and every call rotates it immediately. The node list reportskey_issued, and anode_keyscapability marks the feature. Every API server and proxy keeps a registry of the keys and reloads it on node changes, every 60 seconds, and when a node rejects a signature./api/internal/nodes/self, outside user auth, the node pulls its configuration, posts a session and telemetry report every second, ships its logs (FFmpeg output included) to the operational log, and reports its drain state. Each node has a request budget on each API server.resolve, which runs the stop and token checks and returns the recipe only to the node the session belongs to. Stopping a session deletes its stored recipe unless the session has moved to another node, and every move writes the stored recipe immediately so the new node can rebuild.docs/architecture/transcode-nodes.mdholds the protocol, the security properties, the failure table and the known limits.docs/update-to-1.0.mdhas the upgrade steps.Three choices a reviewer may ask about:
SILO_CORE_URLis plain HTTP to another host.miniredisis a new test dependency. The report fence is a Lua script, and unit tests need something to run it against.Validation
mainatc11b0a968f, with these exceptions: two tests that run real FFmpeg (ininternal/mediasampleandinternal/playback) fail the same way onmainwith the FFmpeg 6.1 used here; the backup tests skip withoutpg_dump; ShellCheck and the Prometheus rules check were not run because the tools are not installed. The only commits since are the locale syncs, now pinned to silo-translations release2026.11.15-0d604d4; the web typecheck passes on them.resolvedecisions, recipe deletion on stop, source grants, and the node's configuration loader. One in-process test starts an API server and a node together and plays through them. They do not cover real FFmpeg on a remote node or a GPU.0bb7f9a314and again at5f9ffeb1c0, on two existing transcode nodes with Intel GPUs (FFmpeg 8.1.3-Jellyfin). The first upgraded them in place: after the API server was upgraded and before their keys were issued, the old-binary nodes showed as unhealthy and took no work. With keys and the two settings they ran VAAPI decode withh264_qsvencode, HDR10 and Dolby Vision tone mapping in hardware, PGS and text subtitle burn-in, copy remux, progressive remux through a proxy, a Jellyfin-surface transcode, and one session in the web player. The node processes held no Postgres or Redis connection. A killed node rebuilt its session on the next segment request, a dead node's session moved to the other node with no failed request, and drain behaved as documented. A key rotation showed askey_rejectedin the node's health answer within 3 seconds, and the node came back healthy with the new key. Node log lines kept arriving with no log batch refused. VobSub burn-in failed in the hardware overlay;mainbuilds the same FFmpeg command. Shared dev is back onmain.main: it set no node keys, so it passed only where a local FFmpeg was installed. Fixed in717abc7afc; CI passes on the commit before the last push.717abc7afc), a full log throttle rescanned on every refused request (717abc7afc), and a node key could write about 20 MiB of logs a second (6ad9f778c6). Two describe a race thatmainhas too, a late node stop ending a newer job with the same transport id; [bug] A late transcode node stop can end a newer job with the same transport id #4359 tracks it. One is open for a maintainer decision: a holder of a node key can make the server read and hash request bodies before the request budget refuses them. The rest were not defects.155319ab64, after that run.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/thin-transcode-nodes/
Surface and build: web admin Nodes page on desktop, and the end-to-end run, both at
76e212b2eeof this branch on a local stack. The fixes that came out of the run are in948ec3e2ff. The shared-dev run is linked from that page.Risks
docs/update-to-1.0.md.stream_nodes.node_key_ciphertextcolumn. A proxy started before the main server has migrated warns and retries.SILO_CORE_URLmust be a trusted network or HTTPS./api/v2delivery request relayed to an unavailable transcode node now answers503 dependency_unavailableinstead of500 internal_error. A progressive remux request for a transport that is already running now gets its 409 before the 401 or 410 it could also have got.main. Killing a node with SIGKILL leaves its FFmpeg child running, also as onmain.Checklist
AI Disclosure
mainbefore any code was written. That review changed recipe deletion on stop, recipe writes on a move, the precision of the file revision check, and what the node-to-server signature covers. The playback-authority stage had its own independent review, and the finished branch had two more, one of the node side and one of the API server and its security. Their findings are fixed: request budgets missing on three node routes, node log entries not normalized, a key issue that did not publish the change, a moved session's recipe written late, a signing failure that triggered a move, and a force reload that revoked recipes before the node had reloaded. None found a way past authentication or into another node's sessions. What remains is under Risks.🤖 Generated with Claude Code
Note
Run transcode nodes without database, Redis, or shared secrets
Transcode nodes now get configuration, playback authority, and source access entirely from the core server via new node-control endpoints, so they need no local database, Redis, or shared JWT secret.
stream_nodes.node_key_ciphertextcolumn), signs all core-to-node requests per target, and verifies node-to-core requests vianodeauth.VerifyFromNode. Keyless transcode nodes are excluded from work planning./api/internal/nodes/self/sources/open, which validates the grant against the catalog and renews it;input_pathis replaced bysource_grantin the transcode-start, chapter, trickplay, media-sample, and download-preparation protocols.MODE=transcodestandalone entrypoint (runTranscodeNodein transcode_node.go) configured bySILO_CORE_URLandSILO_NODE_KEY; lost HLS sessions and remux are resolved through the core instead of local recipe stores and deny markers.ErrTranscodeNodeURLTaken.NodeHandler,PlaybackHandler, proxy relays, download/trickplay/chapter/subsync remotes) — any consumer still using the old secret path breaks. Transcode nodes without an issued key are excluded from all work placement (TranscodePool.HasKey).Macroscope summarized 472809a.