Skip to content

Remove the readers for secrets from before the keyrings - #447

Merged
tnkuehne merged 3 commits into
mainfrom
chore/remove-keyring-migration
Nov 27, 2026
Merged

tnkuehne merged 3 commits into
mainfrom
chore/remove-keyring-migration

Conversation

@tnkuehne

@tnkuehne tnkuehne commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Values stored before the runtime keyring (#428) and before the control plane's keys per kind (#435) stayed readable through temporary readers until they were rewritten. This removes those readers.

Changes

  • Runtime. legacy-runtime-ciphertext.ts goes: values sealed with the raw key and app keys wrapped with AES-KW no longer open. Stored values and app keys accept only the keyring format, so the rewrite no longer special-cases app key records.
  • Control plane. The reader for JWEs whose kid names only a key version goes, together with earlierFormat in secret-encryption status. A value still in that format counts as failed.
  • Tests. The fixtures and cases for the earlier formats go. The workerd test of the rewrite route now moves a value from a read-only key version to the active one. Rejection and missing-key cases use values in the current format, so each fails only for the property it tests.

Upgrade

Rewrite both stores on the previous release before upgrading:

  • A runtime deployment reports 0 rewritten, 0 unreadable, 0 conflicts.
  • node tools/secret-encryption.ts status reports earlierFormat: 0 and failed: 0.

Managed OAuth values that clients still hold from before the runtime keyring are no longer accepted; those connections need a new authorization.

Testing

  • svelte-check (control plane), tsc (app runtime), oxlint, oxfmt
  • packages/app-runtime: secrets.test.ts, keys.test.ts, rekey.test.ts, oauth.test.ts, workload-keys.test.ts
  • apps/control-plane: secret-encryption.test.ts, secret-reencryption.integration.test.ts, runtime-rekey.test.ts, app-services-runtime.test.ts with RUN_SERVICE_TESTS=1 (workerd and celld), cloudflare/deployment.test.ts -t "removes an undeployed app" with RUN_CLOUDFLARE_TESTS=1

Runtime values sealed with the raw key, app keys wrapped with AES-KW and
control-plane JWEs whose kid names only a key version were readable until
rewritten. The runtime rewrite and secret-encryption reencrypt move them to the
keyring format, so their readers go. A control-plane value still in the earlier
format now counts as failed in secret-encryption status.

The workerd test of the rewrite route moves a value from a read-only key
version to the active one instead of a value from before the keyring.
The algorithm and missing-key cases used kids that name only a key version, so
key lookup rejected them before the property under test mattered. Each case now
differs from a readable value in one header field, and missing-key values are
sealed by a keyring that the reader does not hold. Fixtures no longer write the
retired app key record shape.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
widefleet-docs ae6ab07 Nov 27 2026, 09:48 AM

The derived key fails A128GCM and A256KW on its own, so the rejection test
passed without the allowlist. It now expects the allowlist's error from the
shared sealing core for both.
@tnkuehne
tnkuehne merged commit 21dc54b into main Nov 27, 2026
15 checks passed
@tnkuehne
tnkuehne deleted the chore/remove-keyring-migration branch November 27, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant