Skip to content

v0.6.2: Wrapping key escrow, pushed before the key is set

·All releases ·GitHub release

Upgrading

portona-keys init now needs two or more recipients in portona-recipients.pub (or --single-recipient), a clean checkout at origin/main, and permission to push to main, because it commits and pushes the escrow itself. Protect main: what’s on it decides who can read the next key. There are no migrations, and escrows written by 0.6.1 still open with portona-keys recover.

A safer portona-keys init

A review of 0.6.1’s escrow found ways the only copy of a new key could be lost, or a reader added, before anyone noticed. In 0.6.2, init:

  • pushes the escrow first. It commits only the escrow file, pushes it, and checks origin/main holds it byte for byte before setting the Worker secret. Before, the escrow was a local file until someone pushed it.
  • reads only what’s reviewed. It refuses a checkout with local changes or one that isn’t exactly origin/main, and reads the recipients from that branch. The --recipients option is gone.
  • needs two recipients, unless you pass --single-recipient.
  • narrows races. Git refuses the second of two racing pushes, and init checks the Worker again just before setting the key. It reads cf’s list of secret names and fails closed if it can’t.
  • keeps the escrow on failure. If cf fails to set the key, the message says to keep the pushed escrow, never to delete it, and cf’s output is no longer relayed.
  • refuses malformed recipient keys: non-canonical encodings, whose fingerprint wouldn’t match the private key, and duplicates.

New escrows use format portona-escrow/2, which names the Cloudflare account and encrypts with an OAEP label naming the account, Worker, binding and key id, so an escrow relabelled for another Worker or key won’t decrypt. recover imports the private key without making it extractable, and now also accepts PKCS#1 (BEGIN RSA PRIVATE KEY) keys.

The new Wrapping key escrow page has a diagram of the flow, the recovery drill, how to put a key back on a Worker, recovery with plain OpenSSL, and the limits.