how-to deployersecurity-reviewer

Signing a release

In plain words. Countries follow a line of releases called stable. Before a release joins that line, a person signs a small file saying “I checked this, and it is fit for a country to run”. This page is how that signature happens: who holds the keys, how they are created, and what the signer checks before signing. It also covers the one-time ceremony of creating the keys, which has not happened yet.

One key today. The end state is two signers plus an offline recovery key, but those are gated on the first country rather than on the first signature — part 6 says why, and why deferring them is safe exactly until then.

Design behind it: docs/specs/2026-08-12-release-channels-and-signing-trust.md (divergence D48), part B.


Why a person signs, and not the pipeline

The build pipeline already signs the container images it builds. That signature says we built this, and it is worth having.

It cannot say this is fit for a country to run, and here is the reason, which is about custody rather than preference: anyone with write access to this repository can edit a workflow so that it signs whatever they like with the pipeline’s key. So the effective authority behind anything the pipeline signs is “repository write access”. This repository is private on GitHub’s free tier, where branch protection is unavailable, so pushing a tag is not an approval act either.

A country acts on stable. That claim therefore needs a key no workflow can reach — one held by a person, created on their own machine, never uploaded anywhere.

One key now; the rest before the first country. The end state is two holders plus an offline recovery key. Today there is one key, and that is a deliberate staging rather than a shortcut.

The reason is that the deferred pieces all guard against bus factor and key loss — and neither can hurt anyone yet. The sandbox is the only thing consuming releases and it follows edge, which the pipeline signs. Losing the single stable key today costs one command to replace. The day a country follows stable that stops being true, which is why completing the set is a prerequisite of onboarding rather than of signing: see part 6.

What one key already buys is the entire point of the mechanism: repository write access stops being authority over what a country runs. A second holder adds availability; it does not add that.

Why not three signers, ever. Verification accepts any one key in the set, so a third signer would buy availability we already have while adding a third laptop an attacker could take. What would genuinely tighten things is requiring two signatures rather than one, and that is a change to the manifest and the verifier, recorded in the spec as a possible later step rather than the start.


Part 1 — Minting your signing key (about five minutes)

One key now. No safe, no second person, no offline recovery key — those are part 6, gated on the first country rather than on today.

Done once, on 2026-08-15 — deploy/registry/trusted-keys/stable/ holds one key. Repeat this when a second holder joins, or to rotate.

This part cannot be done by any agent or pipeline. A key a pipeline could create is a key anyone with repository write could use, which is the exact thing being avoided. A person does it, on their own machine.

# On your own machine, in a directory that is NOT a checkout of this repository.
printf 'passphrase: ' && read -rs COSIGN_PASSWORD && echo && export COSIGN_PASSWORD
cosign generate-key-pair

Why the prompt instead of COSIGN_PASSWORD=…. Typing the passphrase into the command line writes it to your shell history, and to the transcript of any tool you happen to be running the command through. read -rs does not echo it and does not store it. This page tells you a passphrase must never reach a chat message; an example that puts it in your history would be contradicting itself.

Record the passphrase in your password manager, separately from the key file.

That writes two files:

  • cosign.key — the private half. Yours. It never goes into this repository, never into a GitHub secret, never into a chat message, never onto a shared drive. It is already encrypted with the passphrase you just chose, so your password manager is enough — with the passphrase kept somewhere else, because both in one place is one copy rather than two.
  • cosign.pub — the public half, which is safe to publish and is what everything verifies against.

Rename the public half to say who and when, then note its fingerprint:

mv cosign.pub 2026-08-<your-name>.pub
openssl pkey -pubin -in 2026-08-<your-name>.pub -outform DER | openssl dgst -sha256

Keeping the passphrase (macOS)

Keep the passphrase and the key file in different places. The key file is already encrypted with the passphrase, so putting both in one vault makes the passphrase decorative — whoever opens the vault has both halves.

A reasonable split on a Mac is the passphrase in the login keychain and the key file backed up somewhere else. Store it through Keychain Access → File → New Password Item (name opengov-stable-signing, account your username), which keeps the secret off the command line entirely. The command-line equivalent, if you prefer it:

printf 'passphrase: ' && read -rs PW && echo &&
  security add-generic-password -a "$USER" -s opengov-stable-signing -w "$PW" -U &&
  unset PW

Your shell history records "$PW" rather than the value, though the expanded value is briefly visible to ps while security runs. On a single-user machine that is a small price; if it bothers you, use the GUI.

security stores an empty password if you omit -w. It does not prompt and it does not read standard input — it reports success and stores nothing, so you end up with an entry that looks right and is empty. Always pass -w.

Then signing never asks you to type it again, and the secret reaches neither your history nor any process argument list:

export COSIGN_PASSWORD="$(security find-generic-password -a "$USER" -s opengov-stable-signing -w)"

What this does not solve. A keychain protects the passphrase against a leaked backup or casual disk access. It does nothing about the failure that actually loses you the key — the machine dying. The key file needs a copy that is not on this Mac: a password-manager attachment or an encrypted disk image, kept apart from wherever the passphrase lives.

If you mint it in the wrong place

Minting inside a checkout of this repository is the common slip, and it is caught rather than shipped: the commit-time guard reads the file’s header and refuses any private key — verified against a real cosign key, not assumed. Move the file out of the tree and carry on.

Committing the public half

  1. Commit the public half to deploy/registry/trusted-keys/stable/, keeping the existing README.md.
  2. Record its fingerprint in that pull request’s description. This is the copy an onboarding country later compares against — see part 4.
  3. When a second holder joins, they repeat part 1 on their own machine and the two of you exchange fingerprints out of band — read them to each other on a call, or by any route that is neither this repository nor the channel the key file travelled on. Someone who tampered with the file in transit would have had to tamper with the fingerprint too, on a different route.

The lead time that catches people out

A deployment verifies with the trust set it already has, not the one arriving in the release being verified. If it used the incoming copy, a release could carry the key that approves it.

So: a new key must be committed at least one applied release before it signs anything. Commit the keys, let a release ship carrying them, and only then sign with them. Skipping this means deployments reject the very release that would have taught them the key.


Part 2 — Signing a release

One command. It walks the checklist in order and refuses to sign when a step does not hold, so the signature means exactly the list below and nothing more.

make sign-release VERSION=0.2.0

The version, not the tag — no leading v. Nothing needs exporting by hand:

  • The key. It asks, showing ~/opengov-signing/cosign.key as the default — press return to take it, or type another path (a leading ~ works). Set OPENGOV_STABLE_KEY to skip the question entirely.
  • The passphrase. Taken from the login keychain if it is there, otherwise asked for without echoing. It is asked for last, after every check that can refuse — so a tag you have not cut yet costs you nothing but a message.

Run it against a version that was never tagged and it says so immediately:

--- 1/5  the release workflow at v99.99.99
REFUSED — there is no tag v99.99.99. A release is a tag; cut it first.
Nothing was signed and nothing was pushed.

Nobody will chase you to run this. Cutting a tag publishes a release on GitHub and stops there — a deployment only learns a release exists once it is on a channel. The release workflow opens an issue asking whether this version should go to countries, and that issue is the only reminder; closing it is a legitimate answer, and means countries stay where they are.

What it checks, and why each one earns its place:

#The checkWhat it refuses
1the release workflow is green at v0.2.0a tag that disagrees with pyproject.toml, or a version CHANGELOG.md has no section for
2the merge train’s full backend suite passed on exactly the tagged content (its verdict/backend mark, whose candidate is this commit’s own content — a batch’s last member, or a batch of one — or the nearest such commit with only bookkeeping commits since); the newest execution at or before the tag of each check that now runs on main after merging (schema fuzz, Keycloak, image build, migrations) passed; and CI is green at the tagged commita release cut from a red tree, or from content no full test run covered exactly — a green CI alone no longer proves the suite ran, and the after-merge checks block nothing on their own. Only the train’s account marks a commit: a verdict recorded by hand does not count; land the release commit through the train. Run it from a checkout where make setup has run: the check reads the policy file from git with the project’s own Python — main’s copy for the bookkeeping commits since, and the copy at the marked commit’s first parent (the bookkeeping folder list the train read) for the content key, so a later change to that list does not refuse a tested commit. The tagged commit must be on main: for a marked commit that is not on main’s own line the check answers unknown, which refuses
2ano security advisory names a version in the locks of the tagged commit (scripts/ci/advisory_watch.py check). An answer that is not known refuses.a flagged version that reaches a country during the advisory window
3the image digests come from that commit’s publish runthe store’s current contents, which anything on that host can write
4the sequence is the current manifest’s plus onetwo holders signing different content under one number — and it forces you to read the current manifest first
5min_upgrade_from is a floor someone has actually upgraded froma jump nobody has tested

Step 5 is the one that needs your judgement rather than a command. Name the oldest version someone has really upgraded to this one from and watched come back healthy. A deployment older than that floor refuses the upgrade in plain words, which is the correct outcome — better than migrating and hoping.

What the signature does not say. It does not attest that every line behind the commit is honest; that rides review on main. It attests the five checks above, scoped exactly.

If the push is rejected

The channel is a chain: each publication takes the previous one as its parent. A rejected push means another holder published while you were reading, so your parent is stale. Re-run the script — it will read the new current manifest and give you the next number. Nothing was signed twice and nothing was overwritten.

Check restore and vault erasures before you sign

make sign-release does not check Nightly restore drill or scripts/restore_vault_proof.py. Before you sign a stable release, complete two checks:

  1. Check that the latest run of Nightly restore drill on main is green. That run tests scripts/restore.sh with the world-model archive, both login realms, and post-backup vault erasures.
  2. Run the vault proof on a host with Docker and the shared test Postgres:
export OPENGOV_RESTORE_PROOF_DB_PASSWORD='<the password of the test account>'
.venv/bin/python scripts/restore_vault_proof.py

The last line of a good run is <n> checks, 0 failed, and the exit status is 0. If either check fails, do not sign the release. Read “Proving that a restore repeats the vault erasures” in docs/runbooks/backup-restore.md.


Part 3 — Rotating a key

Rotation is meant to be routine, and this is the design’s main purpose.

To rotate, mint a new key as in part 1, commit its public half beside the old one, wait the lead time above, then start signing with the new one. Every release signed with the old key keeps verifying, because the old key is still in the directory. Remove the old key later, on purpose, when nothing needs it.

If a key is compromised, delete its file. Everything it signed stops verifying immediately, which is what you want.

The limit, stated rather than discovered. Deleting a key only reaches a deployment that applies a release — and applying is the act being protected. A deployment that has not upgraded keeps trusting the deleted key, and whoever holds it can sign the release that would have removed it. This is a real limit of keeping the trust root in the repository. What bounds it is the freshness window on each manifest: past it, a deployment stops treating the announcement as actionable. If a key is compromised, tell the countries out of band. Do not wait for the mechanism.

Losing a key is a different problem from a key being stolen, and it has a different answer. Part 5.


Part 4 — What an onboarding country does with this

When a country’s team is set up, they check the fingerprints of the keys in deploy/registry/trusted-keys/ against a copy that did not travel with the code — the pull-request description from part 1, read to them on a call, or any route independent of the checkout.

This matters because the first install has no previous release to verify against, so the trust set that arrives in its own checkout is the trust root. That is the floor every distribution system stands on; the out-of-band fingerprint check is the cheap hardening for it.

They keep their own copy of what they verified. Steps in docs/runbooks/provision-deployment.md, section “Handover to the country’s govtech team”.


Part 5 — Losing a key

In plain words. A key being stolen and a key being lost look similar and are not. Part 3 covers stolen. This covers lost: a laptop that dies, a passphrase nobody wrote down, a holder who leaves. One lost key costs nothing. Every key lost is the only failure in this design with no automatic way back, which is why an offline recovery key becomes a prerequisite of onboarding the first country — part 6.

Right now, none of this can hurt anyone. There is one key, and if it is lost you mint another and commit it. Nothing follows stable yet: the sandbox reads edge, which the pipeline signs. The paragraphs below describe the world you enter on the day a country subscribes, and they are the reason part 6 exists.

One holder loses their key — nothing breaks

Losing a signing key loses nothing that was already signed. Every release it signed keeps verifying, because the public half is still in the trust set.

The other holder signs the next release. The one who lost theirs mints a fresh key, commits its public half, and waits the lead time. That is rotation, exactly as part 3 describes it, and it is meant to be unremarkable.

This is worth stating plainly because the instinct is wrong: a signing key is an identity, not an asset. A lost wallet key loses the coins forever, since no new key can own them. A lost signing key loses nothing, because a new key signs the next release just as well.

Every key lost — the one failure with no automatic way back

If every stable key is lost, no deployment can ever accept a stable release again.

The cause is the same lead-time rule that makes everything else safe. A deployment verifies with the trust set it already has; it learns new keys only by applying a release; and applying a release needs a key it already trusts. Fresh keys committed to this repository would sit there, trusted by nobody, with no signed release able to carry them across.

What that costs, precisely. No deployment is bricked and no country goes down. Running deployments keep running, and a person can still upgrade one by hand — verify_checkout.sh is a step an operator runs in docs/runbooks/upgrade-contract.md, not a gate that stops them. What is lost is the automatic path: every country would need a hand-driven upgrade, one at a time, each skipping the verification step, until each has applied a release carrying the new keys. On a fleet of any size that is weeks of coordinated manual work in which the thing protecting countries is switched off.

The way back is the recovery key — which does not exist yet, and is exactly what part 6 requires before a country can be handed over. Once it does: open the safe, sign one release carrying freshly minted holder keys and a new recovery key, let it apply, then put the old recovery key beyond use.

Keeping a key recoverable

cosign.key is already encrypted with the passphrase you chose — that is what BEGIN ENCRYPTED SIGSTORE PRIVATE KEY on its first line means. It is around 650 bytes.

So the backup is unexciting, which is the point:

  • Keep the encrypted file in your password manager, or anywhere you keep credentials of this weight.
  • Keep the passphrase somewhere else. A copy of both in one place is one copy, not two.
  • Never mail it, never put it in a shared drive, never put it in this repository. The commit-time guard blocks a private key if you try (scripts/check_secrets_encrypted.py, verified against a real cosign key), so a slip is caught rather than shipped — but the guard is the net, not the plan.

Why not a seed phrase

It comes up, so here is the answer rather than the argument each time.

Mnemonic seed words are for keys whose loss is irreversible — a wallet, where no new key can recover the old asset. That is not this. A lost key here is replaced by minting another, which is the whole design of part 3.

The costs are real and the benefit is already covered:

  • The word-list standard is defined for a different curve than the one these keys use, so it would mean writing our own key-derivation code — the highest-risk code there is, for a problem rotation already solves.
  • A phrase on paper is a second, permanent, photographable copy of the private key that never expires. It adds an attack surface for good, to insure against a loss that costs a rotation.

The durable-escrow requirement it is reaching for is real, and the recovery key in part 6 meets it with no new code.


Part 6 — Before the first country: complete the key set

In plain words. Parts 1 to 5 work with a single key, and that is enough while the only thing consuming releases is our own sandbox. A country changes the arithmetic, so three things have to exist before one is handed over. This part is a gate, not a wish-list: docs/runbooks/provision-deployment.md will not let a handover finish without it.

Why the wait is safe, and why it must end. A deployment learns which keys to trust only by applying a release. While no deployment follows stable, adding a key costs one commit and reaches everybody, because there is no “everybody” yet. The moment a country subscribes, every key you did not mint becomes a key that takes a release cycle to distribute — and the recovery key specifically becomes one you can no longer add after you need it.

Add before country #1Because
A second holderOne holder is a single point of failure for shipping anything at all. With a country live, “the only person who can sign is unreachable” is an outage with no workaround.
An offline recovery keyThe both-lost case in part 5 has no automatic way back. The recovery key is trusted from a deployment’s first install, so it must be in the trust set before that install happens.
Custody disciplineThe recovery key’s private half offline in a safe — not a laptop, not a password manager — with its passphrase held by someone who is neither signer. Otherwise the safe and its passphrase share a pocket.

The order that saves a release cycle. Mint and commit all of it before the country’s first checkout. Its trust set is taken from that checkout, so keys committed beforehand arrive free; keys committed afterwards need a signed release to carry them, which is the lead time part 1 warns about.

Decided 2026-08-15. The staging is deliberate — one key now buys the property that matters (repository write stops being release authority), and the rest guard against bus factor and loss, which cannot bite until a country exists.