Runbook — Changing the vault encryption key
The platform seals personal values with an encryption key. Each sealed value carries its key version, the number of the key that sealed it. A key change adds a new key and makes its version the active version. After the change, the platform seals each new value with the new key. A key change does not change an older value, so each old key stays necessary.
A key change protects new values only, until you re-encrypt. Each older value stays under its old key until the
re-encryptcommand moves it. Do not remove an old key before theforgetcommand removed its version.
Words
- sealed value — a stored value that an encryption key protects. Each sealed value carries its key version, the number of the key that sealed it.
- active version — the key version that seals each new value. The variable
OPENGOV_VAULT_ACTIVE_KEK_VERSIONnames it. - start-up step — the step that the application container and the worker
container do before they start. In the application container only, it writes
the row of the active version into the database table
platform_kek_versions. In the worker container, it writes no key row. - re-encrypt — to open a sealed value with its old key and seal it with the active key. The content does not change.
- forget a key version — to remove the row of an old version from the table
platform_kek_versions. The start then no longer asks for that key. - verified value — a sealed value in a column that the code declares as sealed. Only a verified value moves at a re-encrypt.
- orphan match — a sealed value in a table or in a column that the code does
not declare. The name of the table starts with
vault_orwm_. No command can move it. - unverified match — text with the form of a sealed value, in each other place. No command opens it, writes it or counts it.
- blind column — a column that the code declares as sealed, with a database type that the count does not read. The output says: the count cannot read the sealed column.
In this runbook, <n> is the active version before the change. <n+1> is the
new version.
Before you start
- The deployment has a key,
OPENGOV_VAULT_KEK_V<n>. The vault can be on or off. The registers seal values with the same key when the vault is off (docs/runbooks/enabling-the-vault.md). - You can set container environment variables out-of-band, in a mounted host env file or in the secret store of the platform. Never send a key through the Coolify API.
- You know the active version. Read
OPENGOV_VAULT_ACTIVE_KEK_VERSIONin the environment of the application container. When the variable is absent, the active version is 1.
Run each command of this runbook in a terminal of the application container. The command is then a process of its own, beside the application. The application serves during the run.
In that container, OPENGOV_WORLDMODEL_DIR names the register model of the
deployment. Each command reads the sealed columns of the registers from that
model. A command that reads a different model refuses to run. “Messages of the
commands” gives its message.
Change the key
Make the new key:
python -c 'from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())'The key has 44 characters.
scripts/generate_secrets.pymakes the key of version 1 only. Do not use it for a later version.Record the new key in your secret store, with its version number.
Add the new key as
OPENGOV_VAULT_KEK_V<n+1>, out-of-band.Keep
OPENGOV_VAULT_KEK_V<n>and each older key.Set
OPENGOV_VAULT_ACTIVE_KEK_VERSIONto<n+1>.Set the variables of steps 3 to 5 on the application container and on the worker container. The two containers seal values, so the two must name the same active version.
Redeploy the application container first. Only the application container writes the active version.
Find the start-up line in the log of the application container:
boot.migrated: migrated + procrastinate schema + seeded 1 deployment row(s); kek_seeded=True; ...kek_seeded=Truetells you that the start-up step changed the active version.kek_seeded=Falseon a later start is correct: the row was already correct.kek_seeded=Trueon a later start, with no key change, is a fault: the variable of the application container changed (limit 10).Redeploy the worker container. Make sure that it started. A worker that started before the change still seals each new value with the old key.
The start-up line of the worker always says
kek_seeded=False. The worker compares its active version with the row of the application. When the two are different, the worker stops (“Messages at the start”).When your tool starts the two containers together, the worker can start first. It then finds the old row, and it stops one time. Its restart policy starts it again. It starts after the application wrote the new row.
On Docker Swarm (
docker-stack.yml), update the application service first. Wait for its start-up line withkek_seeded=True. Then update the worker service.The worker service sets no
failure_action, so Swarm usespause. When the worker stops one time during its update, Swarm can pause the update of the worker service. Thendocker service inspect --format '{{.UpdateStatus.State}}' <stack>_workershowspaused, anddocker service ps <stack>_workershows one failed task. The restart policy (condition: any) still starts the worker again with the new settings. Make sure that the worker task runs. Then rundocker service update <stack>_workerto end the paused update.Run the count in the application container:
python3 -m opengov.platform.sealed_values countMake sure that the total of each older version did not decrease.
The count prints one line for each table, column and key version, then the total of each key version. “Check for old values” shows a real output.
Values of version <n+1> appear when people save new data. The count changes
nothing in the database. It reads in a read-only transaction.
Go back to the old version
Use this procedure when the new version causes a fault.
- Set
OPENGOV_VAULT_ACTIVE_KEK_VERSIONto<n>again, on the two containers. - Keep
OPENGOV_VAULT_KEK_V<n+1>. The values that the platform sealed after the change need it. - Redeploy the application container first. Its start-up step retires version
<n+1>and activates version<n>. - Redeploy the worker container.
Do not remove the variable to go back. A container with no version variable changes no active row. It stops at its start when the active row is not version 1.
The re-encrypt command moves a value forward only, to a higher key version.
After a change back, the values of version <n+1> stay under their key. To move
them, change forward to version <n+2>, then re-encrypt.
Check for old values
python3 -m opengov.platform.sealed_values count --check
After a key change from version 1 to version 2, the command printed this:
vault_consent_receipts.data_categories key version 1 5
vault_consent_receipts.purposes key version 1 5
vault_custodial_keys.private_key key version 1 1
vault_subjects.display_name key version 1 120
vault_subjects.display_name key version 2 8
wm_person.date_of_birth key version 1 1
wm_person.full_name key version 1 1
wm_person.national_id key version 1 1
Total for key version 1: 134
Total for key version 2 (active): 8
The count reads the columns of the types json and text in the current schema only.
These counts cover the live database only. A backup bundle can hold values of each key version up to its own date.
It also printed one line on the error output, and its exit code was 1:
134 sealed values have a key version that is not the active version 2.
The command exits 1 after each key change, until you re-encrypt the old values. This result is correct.
The mark (active) comes from the database: it is the version of the active row
of platform_kek_versions. The terminal must name the same version. The terminal
names the version of OPENGOV_VAULT_ACTIVE_KEK_VERSION, and version 1 when that
variable is absent. When the two versions are different, the count stops with
the exit code 2 (“Messages of the commands”).
Two lines can replace the totals:
| Line | Meaning |
|---|---|
The database holds no sealed value. | The count read each sealed column, and it found no verified value and no orphan match. |
The count found no sealed value in the columns that it can read. | The count cannot read one or more sealed columns. The error output names each one. The count does not know what such a column holds. |
The three groups of the count
The count finds a sealed value by the start of its text. A person can write text with that start into a column that is not sealed. So the count puts each match into one of three groups.
- Verified values. The first lines and the totals show them. Only this group is in a total.
- Orphan matches. The count prints them after the line
Sealed values that no command can move. The code does not declare them:. - Unverified matches. The count prints them after the line
Unverified matches. The code does not know these columns as sealed:.
“Words” gives the meaning of each group.
The exit code of the count
| Exit code | Meaning |
|---|---|
| 0 | With --check: no verified value and no orphan match has an old version. The count can read each sealed column. With no --check, the count gives 0 when it ran. |
| 1 | With --check only. A verified value or an orphan match has a version that is not the active version. Or the count cannot read a sealed column. Or the database holds sealed values and names no active version. |
| 2 | The command did not run. The error output gives the reason. |
An unverified match never changes the exit code.
Exit 0 is no proof about a backup bundle. Exit 0 is also no proof about a store that the count does not read. The count reads the columns of the types json and text, in the current schema of the live database.
--json prints the same count as one JSON object, for a script. The keys
counts and totals hold the verified values only. The key orphan holds the
orphan matches, and the key unverified holds the unverified matches. The key
blind holds each sealed column that the count cannot read. The key
active_key_version is null when the database names no active version.
Re-encrypt the old values
The re-encrypt command opens each old verified value with the key of its
version. Then it seals the value with the active key. The content does not
change.
Make sure that each container started again after the key change (steps 8 and 9 of “Change the key”).
Make a backup (
docs/runbooks/backup-restore.md).Run the dry run:
python3 -m opengov.platform.sealed_values re-encrypt --dry-runRead its result. Continue when the exit code is 0.
Run the command:
python3 -m opengov.platform.sealed_values re-encryptRead its result. The exit code 0 tells you that no verified value has an old version.
Record the time that the command printed. “Forget an old version” uses it.
Run
count --check. Continue when the exit code is 0.
The dry run opens each old value and writes nothing. It proves that each old key is present and correct. It printed this:
134 sealed values open with their key. A real run tries to move them to key version 2. The dry run changed nothing.
Exit 0 is no proof about a backup bundle, and no proof about a store that the count does not read.
The dry run tries no write. So it cannot know that a table refuses the update (“A table that refuses the update”).
The command printed this, with the exit code 0:
Re-encrypted 134 sealed values with key version 2.
vault_consent_receipts.data_categories key version 2 5
vault_consent_receipts.purposes key version 2 5
vault_custodial_keys.private_key key version 2 1
vault_subjects.display_name key version 2 128
wm_person.date_of_birth key version 2 1
wm_person.full_name key version 2 1
wm_person.national_id key version 2 1
Total for key version 2 (active): 142
The count reads the columns of the types json and text in the current schema only.
These counts cover the live database only. A backup bundle can hold values of each key version up to its own date.
The count ended before 2026-10-12T02:47:28Z. It found no verified value with an old key version. A bundle that you start after that time holds none, if each container seals with key version 2.
Exit 0 is no proof about a backup bundle, and no proof about a store that the count does not read.
The command prints the first line when the write pass ends. Then it makes the
count again and prints it. The count --check of step 8 is a second, separate
check.
The count after the run can stop. The command then exits 2. The first line is already there, so you know what the run wrote. Correct the cause, and run the command again: a second run is safe.
The exit code of the command
| Exit code | Meaning |
|---|---|
| 0 | A real run: no verified value has an old version at the end. A dry run: each old verified value opens, and the dry run found no value that a real run leaves. |
| 1 | The run ended. One or more verified values or orphan matches stay under a version that is not the active version. |
| 2 | The run stopped, a table refused the update, or the count cannot read a sealed column. The error output gives the reason. |
A real run takes its exit code from a count that it makes after the run.
The lines of the command
| Line | Meaning |
|---|---|
Re-encrypted <count> sealed values with key version <n+1>. | The number of values that the run wrote. The run counts a value after the database committed its page. |
<count> sealed values open with their key. A real run tries to move them to key version <n+1>. The dry run changed nothing. | The number of values that opened in the dry run. The dry run tried no write. |
The dry run opened no old sealed value. The dry run changed nothing. | The dry run found no old value that opens. |
<table>.<column> key <row key> key version <n> does not open | One value that the key of its version does not open. The line gives its table, its column and the key of its row. |
<count> sealed values do not open with their key. The command did not move them. | The total of such values. The list shows the first 1,000. |
The operator skipped key version <n>: <count> sealed values. The command did not open them. | You gave --skip-version <n>. |
<count> sealed values have a key version above the active version <n>. The command moves a value forward only. | Values that the platform sealed before a change back. |
<count> rows changed during the run. The command left them alone. | A person saved these rows during the run. Run the command again. |
The table <table> has no single key column. The command cannot address its rows. | The command did not read that table. Tell the platform team. |
The count ended before <time>. It found no verified value with an old key version. A bundle that you start after that time holds none, if each container seals with key version <n+1>. | Only with the exit code 0. The time is in UTC, from the clock of the machine that ran the command. You must make sure of the condition: a container with an old environment still seals with the old key (limit 7). |
The command never prints a sealed value or its content.
What the command does to the database
- The command runs as a process of its own. The application serves during the run.
- The command works in pages of 100 rows. It commits after each page.
- A stopped run is safe. Run the command again. It reads only the values that still have an old version.
- The command does not change a value that a person saves in the same moment. A value that the vault blanked for an applicant in that moment stays blank.
- The command does not change the time of the last save of a row.
- Each re-encrypted row of a register gets one history row. The actor of that
row is
key change.
A value that does not open
A sealed column can hold a damaged value. The command does not move it. The command moves each other value, and it exits 1:
Re-encrypted 141 sealed values with key version 3.
vault_subjects.display_name key 011f4e6d-77d7-4583-9692-9cb4e125cc28 key version 2 does not open
1 sealed value does not open with its key. The command did not move it.
The damaged value keeps its version in the count. A second run does not move it.
When no value of a version opens, the command stops before it writes. It exits 2 with this message:
No value of key version <n> opens with OPENGOV_VAULT_KEK_V<n>. The command tried <count> values. The key may not be the key that sealed them. The command changed nothing. Set the correct key. Use --skip-version <n> only when these values are not sealed values.
Two causes are possible. The key of that version is the wrong key. Or the key is correct, and each value of that version is damaged. Compare the key with your secret store before you decide.
Skip a version
Use --skip-version <n> only for this case. An earlier run left a damaged value
of version <n>. After the next key change, no value of version <n> opens. So
the command stops, and the values of the later versions do not move.
python3 -m opengov.platform.sealed_values re-encrypt --skip-version 2
The command then does not open a value of version 2. It moves each other old value, and it prints what you skipped:
Re-encrypted 141 sealed values with key version 4.
The operator skipped key version 2: 1 sealed value. The command did not open it.
A skipped value keeps its version in the count. So the exit code is 1, and
forget 2 still refuses.
A table that refuses the update
Some tables accept no update. The command then prints this line on the error output, continues with the other tables, and exits 2:
The table <table> refused the update. Its rule must permit a key change.
The database takes back the page of that table. The report counts no value of that page, and the command does not read the later rows of that table.
vault_credentials refuses each update. So the command cannot move a
credential (limit 8). No code of the platform writes a row to that table today.
The wallet design must add the rule that lets the table accept a key change,
before the platform writes the first credential.
Forget an old version
The start asks for the key of each version that has a row in
platform_kek_versions. The forget command removes the row of an old version.
You can then remove its key.
Run
count --check. Continue when the exit code is 0.Make a new bundle (
docs/runbooks/backup-restore.md).Remove each bundle that started before the time that
re-encryptprinted.Read the count again. Look at each unverified match of version
<n>.Run the command:
python3 -m opengov.platform.sealed_values forget <n>Remove
OPENGOV_VAULT_KEK_V<n>from the application container and from the worker container. Redeploy.Keep the key in your secret store while a bundle needs it.
The command printed this, with the exit code 0:
The command removed the row of key version 1. The start no longer asks for OPENGOV_VAULT_KEK_V1.
Keep the key in your secret store while a backup bundle needs it.
Exit 0 is no proof about a backup bundle, and no proof about a store that the count does not read.
The command opens no value. It exits 0 after it removed the row, and 2 when it refuses.
The command reads the active version from the active row of
platform_kek_versions. It refuses a terminal that names a different version
(“Messages of the commands”).
What you lose
After the key of a version is gone, nobody can open a value of that version again. This is true in three places:
- An unverified match of that version, when it is a real sealed value.
- A table that you removed.
- A backup bundle that holds values of that version.
The command cannot see the backups. Step 3 is your only protection for them.
An unverified match
An unverified match can be text that a person typed. It can also be a real
sealed value, in a table of a module that does not seal. The command does not
refuse for an unverified match. It prints each one of the version. Then it
prints the line Look at each unverified match before you remove the key.
When the command refuses
| Message on the error output | What it means | What to do |
|---|---|---|
Key version <n> is the active version. The command does not forget the active version. | You named the version that seals each new value. | Name an old version. |
Key version <n> has no row in platform_kek_versions. The command changed nothing. | No row has that number. | Read the versions in the count. |
platform_kek_versions has no active row, so the command cannot know which key version is active. The command does not forget a key version. | The database names no active version. | Redeploy, so that the start-up step writes the active row. Then run forget again. |
<count> sealed values have key version <n>, which is above the active version <m>. The command re-encrypt moves a value to a higher key version only. Keep the key of version <n>. To remove it, change to a key version above <n>, run re-encrypt, then run forget again. | You went back to version <m>. Values of the later version <n> stay under their key, and re-encrypt does not move them. | Keep the key of version <n>. Or change forward to a version above <n> (“Go back to the old version”). |
Key version <n> is no longer a retired version. Its row changed during the count. The command changed nothing. | A start made version <n> the active version while the command counted. | Read the count again. Name an old version. |
<count> sealed values have key version <n>. Run re-encrypt, then run forget again. If re-encrypt reported a value that does not open, decide about its row first. | A verified value still has that version. | Run re-encrypt. Read the next paragraph when a value does not open. |
The table <table> holds <count> sealed values of key version <n>. The code does not declare that table, so no command can move them. Remove the table, or decide about its values. | An orphan match has that version, in a table that the code does not declare. | A person moves the values, or removes the table. Then run forget again. |
The table <table> holds <count> sealed values of key version <n> in the column <column>. The code does not declare that column, so no command can move them. Decide about the column. | An orphan match has that version, in a column that the code does not declare. | Make sure that the command read the model of the deployment. If it did, tell the platform team. |
The count cannot read the sealed column <table>.<column>. The command does not forget a key. | The values of that column are in no count. | Tell the platform team. Do not remove a key. |
A value that does not open blocks forget. The command then gives the message
of a verified value, from the table above. A second run of re-encrypt does not
move that value. No command removes it.
A person must decide about that row before the key can go. The report of
re-encrypt gives the table, the column and the key of the row.
An orphan match is a sealed value in a table or in a column that the code does
not declare. The name of the table starts with vault_ or wm_. An earlier
register model can leave such a table.
A column of a declared table can be an orphan match too. Example: a country added a private field to its register model, and the command read a different model. The command then does not know that column.
Backups
A bundle does not contain the keys (SECRETS_MANIFEST.md in the bundle). Its
BACKUP_INFO.txt file has the active version of its date:
Key version: 2
- A restore of a bundle needs the key of its
Key versionline and each older key. The values of the older versions stay in the bundle under their old keys. - Keep each key while a bundle needs it.
- Keep each key for a bundle whose line is
Key version: none. - Keep each key for a bundle with no
Key versionline. The older bundles and the bundles of the permission cutover have no such line.
The count covers the live database only. It does not count the values of a
bundle. The re-encrypt command does not change a bundle.
After a key leak
A key leak is a data incident. Report it as a data incident.
- Change the key (“Change the key”). The leaked key then seals no new value.
- Run
re-encrypt --dry-run, thenre-encrypt(“Re-encrypt the old values”). - Run
count --check. Continue when the exit code is 0. - Make a new bundle. Remove each bundle that started before the time that
re-encryptprinted. - Run
forget <n>, and remove the variable of the leaked key (“Forget an old version”).
The leaked key opens each old bundle until you remove that bundle in step 4.
The re-encrypt does not undo a past exposure. A person who copied the database before step 2 can open that copy with the leaked key. The count of step 10 in “Change the key” gives the number of values that the leak exposed.
Messages at the start
The application and the worker stop at the start when a key check fails. The checks run with the vault on or off. Find the message in the log of the container.
| Message in the log | What it means | What to do |
|---|---|---|
OPENGOV_VAULT_KEK_V<n> is missing or is not a valid Fernet key. It is the key of the active version. Set it on this container from your secret store. Make a new key only when no stored value has this key version. | The key of the active version is absent on this container, or it does not have the correct form. | Set the key from your secret store, on the application container and on the worker container. Make a new key only when the count shows no value of this version. |
OPENGOV_VAULT_KEK_V<n> is missing or is not a valid Fernet key. Stored values still need this old key. Put it back. | The key of a retired version is absent, or it does not have the correct form. Values of that version need it. | Set the old key from your secret store. A new key cannot open the old values. |
KEK consistency violation: env says vN, DB says vM | The vault is on. The variable and the active row of the database name different versions. | Set the same active version on the two containers. Redeploy. |
The active key version of this container is <m>. The active key version of the database is <n>. The container reads OPENGOV_VAULT_ACTIVE_KEK_VERSION, and 1 when that variable is absent. Set the same active version on the application container and on the worker container. | The vault is off. The container and the active row of the database name different versions. The container would seal each new value with key <m>. | Set OPENGOV_VAULT_ACTIVE_KEK_VERSION to the same version on the two containers. Redeploy. |
The database has no active key version. The application container writes it at its start. This worker waited 120 seconds for it. Start the application container first. This worker then starts again by itself. | The worker found no row of the active version. Only the application container writes that row, and it did not start in time. | Start the application container. The restart policy of the worker then starts the worker again. |
The worker runs the same checks, so it also stops.
The worker does one more thing before the checks. It waits when the database
has no active row and the deployment needs one. It waits up to 120 seconds for
the application container to write the row. It logs one line,
kek.wait: the database has no active key version yet. When the row of a
different version exists, the worker does not wait. It stops at once.
At the first start of a new deployment, the worker can wait up to two minutes for the application. This is expected.
The count opens no value, so it needs no key. It ran as a process of its own with the key of an old version absent, and its exit code was 0. This runbook gives no container command for that case: no such command ran on a deployment.
Messages of the commands
| Message on the error output | What it means | What to do |
|---|---|---|
OPENGOV_VAULT_ACTIVE_KEK_VERSION not set; deployment is misprovisioned. Run the command in the environment of the application container. | The terminal has no active version. A run there would seal each value with key 1. | Run the command in the application container. |
KEK consistency violation: env says vN, DB says vM. ... Run the command in the environment of the application container. | The terminal and the database name different active versions. | Run the command in the application container. |
OPENGOV_VAULT_KEK_V<n> is missing or is not a valid Fernet key. <count> sealed values of key version <n> need it. | The terminal lacks the key of an old version. | Set the key from your secret store. |
The count cannot read the sealed column <table>.<column>. Its database type is <type>. | The code declares a sealed column, and the count does not read its type. | Tell the platform team. Do not remove a key. |
The code knows no sealed column. The command cannot tell a sealed value from other text. | The command did not find the models of the application. | Run the command in the application container. |
The active key version of this terminal is <m>. The active key version of the database is <n>. The terminal reads OPENGOV_VAULT_ACTIVE_KEK_VERSION, and 1 when that variable is absent. Run the command in the environment of the application container. | count or forget ran in a terminal that names a different active version. | Run the command in the application container. |
The register model of this process is not the model that the database records: <error>. Run the command in the environment of the application container. | The terminal names no model folder, or a different one. The command would not know the sealed columns of the registers. | Run the command in the application container, where OPENGOV_WORLDMODEL_DIR names the model of the deployment. |
A change of the register model is in progress. Wait until it ends, then run the command again. | A steward approved a change of the register model, and the database is between two models. | Wait. Then run the command again. |
The register model cannot be read: <error>. | The command reads the register model to know the sealed columns of the registers. | Make the register model valid. Then run the command again. |
A stop before the first write of a command ends with The command changed nothing. Two stops of re-encrypt come after a write, and they do not end
that way:
| Message on the error output | What it means | What to do |
|---|---|---|
The count after the run stopped. <reason> The report of the run says what the run wrote. | The write pass ended, and the count after it stopped. The line Re-encrypted ... is on the standard output. | Correct the cause that the message gives. Run re-encrypt again: it moves each old value that stays, and it prints the count. |
The run stopped before its end. <reason> The report of the run says what the run wrote. | The write pass stopped. The database holds each page that the run committed before the stop. | Correct the cause that the message gives. Run re-encrypt again. |
Limits
The start does not find a wrong key. The start makes a cipher from each key. This proves that each key is present and has the correct form. A wrong key of the correct form passes the start. The dry run of
re-encryptfinds a wrong key of an old version: no value of that version opens.A second key has no version.
OPENGOV_ENCRYPTION_KEYseals the credentials of connectors and other settings. No procedure changes it, and no command re-encrypts under it.The commands cannot see the backups. A bundle that you made before the re-encrypt run keeps its values under the old key.
A value that does not open keeps its version in the count. It blocks
forgetfor that version until a person decides about its row.The count reads one store. It reads the columns of the types json and text, in the current schema of the live database. It does not read a different schema or a different database.
The settings accept the keys of versions 1 to 4 from a
.envfile. A key of version 5 or more in a.envfile stops the start. Version 5 needs a change tosrc/opengov/config.py.A container with an old environment seals with the old key. Start each container again after a key change, before you run
re-encryptorforget.The command cannot move a credential.
vault_credentialsrefuses each update. A dry run opens each credential and exits 0, and the real run then exits 2 at each run.forgetrefuses while a credential has the old version, so the old key cannot go. The condition: the platform writes no credential row before the wallet design adds the rule for that table. No code of the platform writes such a row today.The count does not read
character varyingcolumns. Since issue #4214, the governance queue refuses a change from private to public while encrypted values remain in that column. An approved data migration must decrypt those rows before the model publish changes the column type. If a manual migration changes a sealed column tocharacter varyingwithout decryption,countdoes not see those rows. Decrypt all stored rows in any manual migration before you runforget.An application container with an old number in its version variable still changes the active row. Only the application container writes the row. Its start-up step makes the version of its variable the active row. It cannot tell an old number from a change back. The start check of the application then passes.
Example: after a change to key 2, the application container still has
OPENGOV_VAULT_ACTIVE_KEK_VERSION=1. It makes version 1 the active row again, and it starts. The worker has the number 2, so the worker stops at its start. The signs are that stop of the worker, andkek_seeded=Truein the start-up line of a later start of the application, with no key change.A worker with an old number changes no row, and it stops at its start. A container with no version variable changes no active row either. It stops at its start when the active row is not version 1.
The step knows the application by its command, which contains
opengov.main:app. A container that starts the application with a different command writes no row, and it stops at its start check after a key change.
Related
docs/runbooks/enabling-the-vault.md— turning the vault ondocs/runbooks/backup-restore.md— making and restoring a bundledocs/specs/2026-10-10-vault-store-readiness.md§11 — the design of the key change (decision D74)docs/specs/2026-10-10-vault-re-encrypt-command.md— the design of there-encryptandforgetcommands (decision D75)