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.
