Repository navigation
fix(secrets): two keys on the sensitive tier, and CI refuses one (#835) - #866
Merged
Merged
Conversation
…e key (#835) secrets/sensitive.sops.yaml was created with trinity's key alone, after #294 had closed, and the tier's volume backups were encrypted to that one key. Nothing noticed: SecretsKeyBackupUnproven checks the recipients that exist, not how many. check_sops_rules.py now reads each committed file's own sops block and fails when it differs from its rule (the add-a-key-forget-updatekeys window), or when observability, sensitive or tofu opens with fewer than two keys. soc and lab are left out on purpose: their keys open only regenerable credentials. Six fixtures under --self-test. This fails until trinity re-keys; the re-keyed file lands on this branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…second-recipient # Conflicts: # docs/changelog.md
…5-sensitive-second-recipient # Conflicts: # docs/changelog.md
…second-recipient # Conflicts: # docs/changelog.md
Gerrrt
marked this pull request as ready for review
October 3, 2026 23:21
Gerrrt
enabled auto-merge (squash)
October 3, 2026 23:21
…second-recipient # Conflicts: # docs/changelog.md
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Repair guidance can create recipient drift, and documentation prematurely claims the backup operation is complete.
Review effort: Balanced
Findings: 2
Open (4)
What changed in this PR
Adds recipient-policy validation and a second recovery key for sensitive-tier secrets.
Changes:
- Re-keys sensitive secrets to two recipients.
- Validates encrypted-file recipients against SOPS rules.
- Adds self-tests and changelog documentation.
| File | Description |
|---|---|
.sops.yaml |
Adds the technical-second recipient. |
secrets/sensitive.sops.yaml |
Re-wraps the data key for both recipients. |
scripts/check_sops_rules.py |
Adds recipient validation and fixtures. |
docs/changelog.md |
Records the security change. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…e the drift Review on #866: - Rule/file drift now says reconcile .sops.yaml, then sops updatekeys. It no longer points at secrets-add-recipient, which adds a key rather than reconciling one and would duplicate a key the rule already lists. - A data-guarding file on a shared rule (the catch-all: observability, tofu, wiki, media) is told to re-key every file that rule matches. secrets-add-recipient re-keys one file and would leave the rest failing this check; it is still offered for a file on a rule of its own. Four advice self-tests, and a mutant that drops the sibling lookup fails two of them. - backup-library.sh and the two sensitive-tier runbooks no longer say the tier opens with trinity's key alone; sets taken before #835 still do. - The changelog records the post-merge backup and the second key's proof as pending, not done. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What changed
scripts/check_sops_rules.py. It reads each committedsecrets/*.sops.yamlfile's ownsops:recipient block and fails in two cases:.sops.yamlrule. That is ADR-0024's add-a-key-and-forget-updatekeyswindow.observability,sensitiveandtofu, listed with a reason each.--self-test, whichself-tests.shdiscovers.gerrrt/835-rekeyas one commit (6490d49):.sops.yamlandsecrets/sensitive.sops.yamltogether. Only the data-key stanzas changed; no encrypted value did.Proof the guard bites. Before the re-key, its first run failed on the real file, as the issue asks. After it,
check_sops_rules.pypasses. Two mutations, each reverted, both fail with the file named: dropping the new key from.sops.yaml(rule and file disagree), and dropping its stanza from the encrypted file (disagree, plus "opens with 1 key").Why
Refs #835.
secrets/sensitive.sops.yamlwas created on 2026-09-28 with trinity's key alone. #294, which added the technical second, had already closed, before this rule existed.backup-volumes.shencrypts the tier's volume sets to the same recipient list, so Vaultwarden's database and its backups opened with one key.SecretsKeyBackupUnprovenchecks the recipients that exist, not how many there are, so nothing fired.soc and lab are deliberately left out. Their keys open only passwords and tokens that a rebuild regenerates, and neither stack's backups are encrypted to them. The lab's second key is #671.
The step only trinity can do
updatekeysneeds a key that can already decrypt the file. In your own terminal on trinity, in a separate clone: the deployment checkout must stay onmainand clean for converge.That key is the technical second, as
stacks/sensitive/household.recipientslists it and the catch-all rule carries it. The command rewrites.sops.yamlandsecrets/sensitive.sops.yaml; both hold only public keys and ciphertext. trinity has no push credentials, so copy the two files to a checkout that does, asbuild-the-sensitive-tier-host.md§6 does, and commit them to this branch.Then, in the deployment checkout, after this merges and converges:
The proof needs the technical second's private key, on the machine where it lives:
Blast radius
.sops.yamland one encrypted file. No container changes. The next sensitive backup is encrypted to two keys instead of one.secrets/*.sops.yamlVerification
check_sops_rules.py --self-test: all 6 fixtures pass.check_sops_rules.pyon the tree fails with exactly one problem:secrets/sensitive.sops.yaml opens with 1 key. Every other file matches its rule.make secrets-verify-backupwith the technical second's key opens the secrets file and the newest volume set, on a machine that is not trinity.sops.yamlcomment and the changelog🤖 Generated with Claude Code