Repository navigation
Give apps keys they can use but not read - #237
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
widefleet-docs | 1420cb9 | Nov 20 2026, 01:54 PM |
tnkuehne
force-pushed
the
feat/app-keys
branch
from
November 20, 2026 11:42
ab1c066 to
e37cae7
Compare
Apps get a WIDEFLEET_KEYS binding to encrypt, decrypt, sign and verify with named keys. Each key is random, stored only wrapped with AES-KW under a key derived from the installation key and the app ID, and never reaches app code. Removing an app deletes its keys.
tnkuehne
force-pushed
the
feat/app-keys
branch
from
November 20, 2026 13:53
b3b8cfd to
1420cb9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
Every app gets a
WIDEFLEET_KEYSbinding:[a-z0-9][a-z0-9-]{0,62}) and created on first use.app-keys/{appId}/{name}.jsonin runtime storage. The wrapping key is derived with HKDF from the installation key and the app ID, so a wrapped key copied to another app fails AES-KW's integrity check.Why
Apps such as the connector templates need a stable key to sign cookies and encrypt stored account tokens. Today an administrator generates
AUTH_SECRETby hand and the app holds it in code. This binding is the base for removing it.Tests
packages/app-runtime/src/keys.test.ts: round trips, binding to app, name and additional data, copied wrapped keys, racing first use across isolates, another installation key, signatures, invalid names.apps/control-plane/tests/app-services-runtime.test.ts(workerd and celld): an app uses its keys, another app cannot decrypt them, storage holds only wrapped keys.apps/control-plane/tests/cloudflare/deployment.test.ts: app removal deletes stored keys.Documentation follows in a separate draft PR.


Confidence Score: 5/5
The PR appears safe to merge with no new actionable issues.Summary
Adds
WIDEFLEET_KEYSso apps can encrypt, decrypt, sign, and verify without receiving key material.tnkuehne accepted the remaining removal race because app IDs are never reused and leftover keys cannot be read by another app. No new actionable issues were found. Tests were inspected, not run.
Diagram
sequenceDiagram participant App participant Binding as WIDEFLEET_KEYS participant Store as Runtime storage App->>Binding: Encrypt or sign with a key name Binding->>Store: Read wrapped key opt Key does not exist Binding->>Store: Check app is published Binding->>Store: Conditionally store wrapped random key Binding->>Store: Read winning wrapped key end Binding->>Binding: Unwrap and derive purpose keys Binding-->>App: Ciphertext or signatureReviews (5) · Last reviewed commit: "Bound derived app keys and refuse keys f..." · Reviewed by Greptile