refactor: remove the code for a missing encryption block (S04-A required encryption block plan: 13/16)

Summary

  • Problem: since Step 12, config.Load refuses a config with no encryption block. Two older code paths still handle a missing block, but no loaded config can reach them.
  • Impact: none for clients or operators. A config without the block still fails at load, with validation error: encryption: value is required.
  • Change:
    • wireEncryption (which builds the encryption stack at boot) no longer skips when the block is missing. It returns errEncryptionBlockMissing before it reads any secret. Only a config built by hand in a test gets there. Without the check, that config's zero cache TTL would make the key store constructor panic.
    • The encryption tier skipped log line goes with the skip.
    • runOperator (shared by re-encrypt and retire-key-version) drops its own block check and errOperatorRequiresEncryptionBlock. config.Load already refuses the config first.
    • encryptionFromProto drops its nil case. A nil message now fails as an unsupported topology instead of becoming an empty config.
    • Comments now describe the block as required.
  • Downsides: none. Nothing a loaded config can reach behaves differently.

This is Step 13 of the S04-A required encryption block plan. Step 12 (!3415 (merged)), which it depends on, has merged.

Checklist

  • Ran it: n/a. No reachable behavior changes, so there is nothing new to run against the service. Unit tests pin both changed paths, TestWireEncryption_HandBuiltConfigWithoutBlockFailsBoot and the nil block fails closed subtest of TestEncryptionFromProto_TopologyFromArmNotPresence, and pass locally. git grep 'tier skipped' finds nothing outside specs and plans.
  • Interfaces and data: none. The internal/config/ edits touch only a path no loaded config reaches, so docs/dev/configuration-reference.md has nothing to change. No user doc changes.
  • Failure: a hand-built config with no block now fails boot with composition: wiring encryption: no encryption block is configured, and logs nothing. A loaded config fails earlier, at config.Load, as before.
  • Rollout: the previous release behaves the same for every config that loads, so mixed pods and a rollback are safe.
  • Hot path: none. The code runs once, at boot.
  • Database: n/a.
  • Security: no new input, route or permission. Boot now fails instead of skipping, so no code path boots without encryption.
  • ADRs: ./scripts/adr-freshness.sh exits 1: the mirror lacks ADR 027 (replicating registry data to Orbit), which does not cover config or encryption. ADR-007 defines the encryption key tables, and ADR-014 and ADR-024 cover cookie and in-transit encryption. None says whether the block is optional, so there is no conflict. The two internal ADRs do not touch encryption, as the plan's research recorded.
  • E2E: no row changes. Clients see nothing new.
  • Simplicity: deleting the skip with no check would let a hand-built config panic deep in the key store. One named error fails clearly instead.

Reviewable size is 217 lines.

Open MRs !2969 (merged) and !2970 (merged) (S34 Step 5) overlap wire.go and config.go, and !3226 (closed) and !3379 (merged) overlap wire.go. The shared files merge cleanly. Each of those MRs already conflicts with main in other files.

Related to https://gitlab.com/gitlab-org/ops/artifact-registry/-/work_items/1451

Edited by Dzmitry (Dima) Meshcharakou

Merge request reports

Loading
Loading