Repository navigation
Write app secrets without a fingerprint of their values - #419
Merged
Merged
Conversation
Each prepared secret revision stored an unkeyed SHA-256 of its plaintext values next to the ciphertext, only to reject a second preparation of the revision with other values. The control plane reads a revision together with its values, so a retry always sends the same values. Other values for a used revision come only from a control plane that lost its counter, for example after a database restore, and the check then blocked its deployments. Preparation now writes the current values for the revision.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
widefleet-docs | 973e3b9 | Nov 26 2026, 10:52 AM |
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.
Each prepared app secret revision in
app-secrets/<appId>/<revision>.jsonstored an unkeyed SHA-256 of its plaintext values next to the ciphertext. Anyone who could read the bucket could test guessed values against it offline. The hash served only one purpose: rejecting a second preparation of the same revision with other values (App secret revision is immutable).That case does not happen in normal operation. Only the control plane can call the preparation endpoint, and it reads a revision together with its values from the same app row, while every change increments the revision. A retried deployment therefore always sends the same values. A used revision with other values comes only from a control plane that lost its revision counter, for example after a database restore. The check then failed every deployment of the app until the counter passed the revisions left in storage.
Changes
prepareAppSecrets(app-secrets.ts). Preparation encrypts the values and writes the revision's file, without a fingerprint, comparison or conditional write. A retry writes the same values again; after a restore, the control plane's current values replace the earlier ones.fingerprintfield that files written before this change still contain, until their revision is prepared again or the app is removed.Rollback
Runtimes before this change require the
fingerprintfield when they read or prepare a revision. Once an app is deployed with this runtime, its secret file has no fingerprint, so rolling the runtime back to an earlier version breaks that app's secret reads and deployments. Rollbacks to earlier runtimes are not supported across this change. Updating the runtime to this version again restores them, because it reads files written by either version.Testing
pnpm checktests/app-services-runtime.test.tson workerd: preparing a used revision with other values succeeds, the app reads the new value, and no stored file contains a fingerprint. The case fails without the change withApp secret revision is immutable.tests/cloudflare/runtime.test.ts:refreshes secrets in warm pinned workflows🤖 Generated with Claude Code