Changelog
v0.6.5 · Check every row, by digest
Upgrading
No migration. Deploy as usual.
Checking every row
With the wrapping key set, GET /admin/api/verify decrypts every master-key row and its data-keyed
copy inside the Worker. For each secret it reports whether each one decrypts, whether the copy is
current and holds the same value, and a digest in place of the value: an HMAC under a key derived
from the wrapping key.
The digest doesn’t depend on the master key, so it stays the same across a master key rotation, a restore or a Time Travel rollback. Save the JSON before a recovery and compare it row by row afterwards. It changes nothing, so it also answers in maintenance. See Checking every row.
v0.6.4 · Backups hold the data keys
Upgrading
No migration. Deploy as usual. The first daily run afterwards writes a format-2 backup. An earlier
release can still restore a format-1 backup, but not a format-2 one, so keep portona-restore from
this release or later once the first format-2 backup exists.
One snapshot, format 2
The daily backup is now read in one transaction and holds:
- the environment ledger, with which environments read data keys;
- every master-key secret row, with its details;
- each environment’s data keys, still wrapped, and the secrets under them;
- every federation;
- the ids of the master key and the wrapping keys the rows need.
portona-restore reads format 2 and every earlier backup, and prints the backup’s format and the
key ids it needs before you run the batch. See Backups and recovery.
What a restore brings back
- Data keys fill gaps only, like the ledger. A key the database already holds stays as it is.
- A data-keyed copy comes back only beside the data key it was encrypted with. A copy left out counts as not copied, and the next backfill copies it again from its master-key row.
- Nothing of a retired environment ID: its data keys and copies stay gone, as its secrets already did.
Backups hold no wrapping key. Keep each one’s escrow for as long as a backup names its id.
v0.6.3 · Backfill data keys, and reads from them
Upgrading
Apply migration 0005, which adds one nullable column to environments, before deploying. An
earlier release keeps working on the migrated database: the master-key rows stay complete.
Backfill data keys
With the wrapping key set, the Keys view has Backfill data keys. Each pass copies up to 50
existing secrets of PORTONA_ACCESS environments the environment ledger
holds, under the environment’s own data key. A secret changed while the pass runs is never
overwritten with the value read before the change; the next pass copies it. Run it until nothing
remains.
- Quarantined, never adopted: secrets of
PORTONA_POLICIESbundles and of names no longer configured. Move the environment toPORTONA_ACCESSwith an ID to copy them. - Refused: secrets of an environment whose ID disagrees with the ledger, and any the master keys can’t decrypt.
Once every secret of an environment is copied, its exchanges read the data-keyed copies. A copy is read only while it matches its master-key row’s version and IV, so a write by an earlier release, or a restore, falls back to the master-key row. So does an exchange whose wrapping key fails to load, or whose copy fails to decrypt. Admin writes still go to both.

Maintenance pauses the daily cron
With PORTONA_MAINTENANCE on, the daily cron now does nothing. Before, a cron run during a
fresh-database recovery could replace the day’s backup with a copy of the empty database, and record
the configured environments ahead of the ledger being restored. See
Backups and recovery.
v0.6.2 · Wrapping key escrow, pushed before the key is set
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/mainholds 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--recipientsoption is gone. - needs two recipients, unless you pass
--single-recipient. - narrows races. Git refuses the second of two racing pushes, and
initchecks 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.
v0.6.1 · Wrapping key escrow to the team's SSH keys
Upgrading
If you already created a wrapping key with 0.6.0, keep its 1Password copy: nothing changes for it.
Otherwise, before running portona-keys init, add portona-recipients.pub to your deployment
repository with the public keys of the people who can recover the key. Each must be an RSA key of
3072 bits or more, because Ed25519 keys can only sign. There are no migrations.
Escrow instead of 1Password
portona-keys init no longer needs the 1Password CLI. It encrypts the new key to every recipient
with RSA-OAEP (SHA-256) and writes the result to keys/<worker>-wrapping-<key id>.json, which you
commit. Only then does it set the Worker secret. It needs only a cf login that can write Workers,
so an agent can run it without anyone’s password-manager session. It never overwrites an escrow
and still refuses to replace a wrapping key the Worker already has.
portona-keys recover <file> --check is the recovery drill: pipe one recipient’s private key in,
for example from op read, and it prints the key’s id. Any recipient can also open their entry with
plain openssl. See Wrapping key.
The Keys view’s wrapping key card now says the key is escrowed to your team’s SSH keys.
v0.6.0 · A wrapping key and per-environment data keys
Upgrading
Apply the new migration to each deployment’s D1 before deploying 0.6.0, as for earlier releases (see Deploying your own). It only adds tables, so 0.5 keeps working on the migrated database and you can roll back without undoing it.
Nothing else is required: without the new PORTONA_WRAPPING_KEY, 0.6 works exactly as 0.5.
The wrapping key
portona-keys init creates a deployment’s wrapping key from its deployment repository. It
generates the key in memory, saves it to 1Password, reads it back, and only then sets the Worker
secret. It prints only the key’s id and refuses to replace a wrapping key the Worker already has.
See Wrapping key.
The admin page’s Keys view (formerly Master key) shows the wrapping key’s id, and on phones its master-key table and re-encrypt button now fit the card.


Per-environment data keys
With the wrapping key set, every admin change to a PORTONA_ACCESS environment also stores the
value under that environment’s own data key, in the same transaction. The data key is wrapped so
that it opens only for its own deployment, environment and version, and it’s created only for an
environment the ledger holds live.
Exchanges still read the master-key rows, which stay complete, so an earlier release can be redeployed at any time. A later release copies existing secrets over and then moves reads across. Backups don’t include the data-keyed copies yet; they hold nothing the master-key rows don’t.
v0.5.0 · An environment ledger
Upgrading
Apply the new migration to each deployment’s D1 before deploying 0.5.0, as for 0.4.0 (see
Deploying your own). 0.5 records environments in the new table, so it fails
exchanges for PORTONA_ACCESS environments on a database without it. The migration only adds a
table, so 0.4 keeps working on the migrated database and you can roll back without undoing it.
The ledger records the ID your configuration gives each environment the first time it’s used. Check that the configuration you deploy with 0.5.0 is the one you mean to keep.
The environment ledger
Secrets are still stored by environment name. Until now, a configuration that renamed an environment, or deleted one and created another with the same name under a new ID, would hand the old name’s secrets to whatever held the name next.
0.5 records the first ID it sees for each name, at its first exchange, admin change or daily cron, and refuses exchanges and admin changes for an environment that disagrees with that record:
- Renamed: an ID now has another name.
- Recreated: a name now has a new ID.
- Retired: an ID was retired and is used again.
The daily cron fails and names each conflict, so a mistaken deploy shows within a day even if nothing
uses the environment. PORTONA_POLICIES environments have no ID and aren’t recorded.
To give a name a new ID on purpose, retire it with the new portona-ledger command. In one audited
transaction it deletes the name’s secrets and federations and frees the name. Backups now include the
ledger, and a restore never brings back a retired name’s secrets. See
Environments and Retiring a name.


v0.4.1 · Safer installs and clearer limits
The Worker is unchanged from 0.4.0. This release corrects the docs after two reviews of 0.4.0, and adds a test for a rule whose test passed for the wrong reason.
Check your workflows
Earlier docs ran bunx broker-run without installing Portona first. Portona isn’t published to npm,
so where it isn’t installed, bunx would download whatever npm package has that name and hand it
the job’s workload token. Install a release tarball and run ./node_modules/.bin/broker-run, or copy
client/broker-run.ts into your repository. If a workflow or script runs a bare bunx broker-run,
change it. See Using an environment.
What 0.4 does and doesn’t cover
- Stored secrets are keyed by the environment’s name. Its ID labels audit rows, nothing more yet. Creating an environment with a name used before, even with a new ID, gives it the old secrets, so never reuse a name. See Environments and grants.
protectedis required on production names but changes nothing else yet, since every grant lives in git.- Rolling back to 0.3 after moving to
PORTONA_ACCESSneeds the oldPORTONA_POLICIEStoo, and those grant whole environments. Deploying your own has the full migration command and how to roll back. expiresAtin an exchange’s reply is when the workload’s token expires, not the secrets, and a secret’s rotate-by date is only a reminder.
A name in both PORTONA_POLICIES and PORTONA_ACCESS is still refused, so a bundle moved to
PORTONA_ACCESS can’t keep its old environment-wide grant. Its test now checks that rule rather than
an unrelated decode error, and a mutation check covers it.
v0.4.0 · Environments, grants and inventory
Upgrading
Apply the new migration to each deployment’s D1 before deploying 0.4.0:
cf d1 migrations apply <database-id> --dir <absolute path to node_modules/portona/migrations>Run it from outside your deployment repository; Deploying your own has the full command.
It only adds columns and a table, so 0.3 keeps working on the migrated database and you can roll
back without undoing it. Once a deployment uses PORTONA_ACCESS, rolling back to 0.3 also needs
its old PORTONA_POLICIES; see Rolling back. 0.4 writes to the new columns, so it fails exchanges on a database without
them. Existing PORTONA_POLICIES keep working unchanged.
Environments and grants
A new PORTONA_ACCESS binding lists environments, named app/environment with an ID that is
never reused, and the grants to them. A grant names one workload, as policies do, and can:
- narrow access to some secret
names; expireat a given instant;- carry a required
notesaying why it exists.
Environments ending in /production must be marked protected.
A request can now ask for specific secrets. Grants add up, and a narrower or expired grant never takes away what another allows. Every name asked for must be granted and must exist, or the whole request is refused before anything is decrypted. Asking for everything needs a grant that covers the whole environment. The audit log records the environment’s ID, the issuer and which grants allowed each exchange.
broker-run now asks for exactly its --env names, and takes --environment as well as
--bundle. Older Workers still answer it with the whole bundle, as long as its request fits
their 1 KiB limit. Each PORTONA_POLICIES entry acts as a grant over its
whole bundle, recorded as policy:<bundle>. See Environments and grants and
Using an environment.

Inventory
On the admin page, each secret can record an owner, a date to rotate it by and notes, and a rotation date within 30 days or past is flagged. Each environment can also record federations: providers such as Entra, AWS or Google Cloud that trust a workload’s token directly, so no secret is stored. Mark a federation verified whenever you check the provider side. Details and federations are in the daily backup and restore with it, and backups from 0.3 still restore. See Admin pages.

v0.3.0 · GitHub Actions as a second issuer
Bundles can now be fetched from GitHub Actions as well as Amp orbs. A policy with
issuer: "github-actions" must pin all six of:
- the repository and its owner, by immutable ID, so a renamed or re-registered repository doesn’t match;
- the branch (
ref) and the GitHub environment the job uses; - the calling workflow file (
workflow_ref), so another workflow in the same repository can’t use the bundle; - the event,
pushorworkflow_dispatch. Pull request events can never match.
Jobs in reusable workflows are refused before any policy runs, and a token from one issuer never matches another issuer’s policy. GitHub tokens get the same checks as Amp’s: RS256 only, the deployment’s audience, at most a one-hour lifetime and single use.
broker-run uses the job’s OIDC token whenever the job has permissions: id-token: write, and an
Amp token otherwise. Portona can’t see your GitHub settings, so protect the pinned branch and give
id-token: write only to the job that needs the secrets. Policies and
Using a bundle have the details and an example workflow.
Upgrading needs no change: existing Amp policies and replay records keep working, and a Worker rolled back to v0.2.3 still refuses a replayed Amp token.
v0.2.3 · Replace a secret in place
Each secret row has a Replace action beside Delete. It opens the secret form with the bundle and name fixed, asking only for the new value, and the secret’s version goes up by one. Bundles that no policy names any longer get no Replace, since setting a secret there is refused.



v0.2.2 · When the admin page last loaded
The top bar shows when the page last loaded its data, such as 9:14am, beside the refresh button. Refresh spins for at least one turn, so a fast reload still shows it happened.


v0.2.1 · Admin pages fit on phones
On phones the sidebar is hidden, and a segmented switcher moves between Bundles, Audit log and Master key. The stat strip becomes one row of four, the tables stack their other columns under the first cell, and the breadcrumb shows only the current page. Desktop is unchanged.



v0.2.0 · Admin pages, backups and recovery
Admin pages
/admin lists bundles, sets and deletes secrets, shows the audit log, and re-encrypts secrets after
a master key rotation. It sits behind Cloudflare Access, and the Worker also checks Access’s token
itself: the team’s keys, the application’s audience and an email allowlist. Values are write-only;
no screen or API response shows one.





Backups and recovery
- A daily cron backs up every secrets row, still encrypted, to R2, and prunes backups after 90 days.
portona-restoreturns a backup into acf d1 query --batchfile.PORTONA_MAINTENANCE: "on"refuses exchanges and admin changes without writing to D1. Because it’s a binding, restoring the database can’t turn it off. See Backups and recovery.
Hardening
- Only
/,/healthzand/v1/exchangeare public. Every other path goes through the Access check, and paths containing%or//are refused. - Re-encryption replaces a row only if its version, key id and IV are unchanged, so a secret deleted and recreated mid-pass keeps its new value.
- Audit rows are written only for tokens whose signature verified, and request bodies are capped while they’re read.
broker-runrequires https (loopback excepted), refuses redirects, never prints Portona’s replies, and fails if the bundle lacks a name passed with--env.- A JWKS that answers with an error is an outage (503), not a refusal.
v0.1.0 · First release
The first working broker: a workload in an Amp orb trades a 60-second token for a bundle of secrets.
POST /v1/exchange. Verifies an Amp workload token (RS256, issuer, audience, expiry, at most a one-hour lifetime), records itsjtiso it works once, matches it against the bundle’s policy, and returns the decrypted secrets. Every refusal is the same 403.broker-run. Mints the token withamp orb id-token, exchanges it, and runs a command with the secrets in its environment. It has no dependencies beyond Bun.- Encryption at rest. Secrets are stored in D1 under AES-256-GCM, with the bundle, name and version bound in as authenticated data.
- Deployments live elsewhere. Policies and Cloudflare settings moved out to deployment
repositories, which install the release tarball and run
portona-assemble. Policies decode strictly, so a misspelt claim fails the build. The tarball ships the migrations too. - Review fixes before release: the replay window, requiring
token_use: "exchanged", JWKS errors, write races, and a byte-order mark in request bodies.