feat(config)!: require the encryption block (S04-A required encryption block plan: 12/16)

Summary

  • Problem: a server with no encryption block boots today. It fails later, the first time it stores or reads an upstream credential.
  • Impact: operators. A config without the block now fails at startup, for the server and for the re-encrypt and retire-key-version commands. The error ends with validation error: encryption: value is required. Clients see no change.
  • Change: config.proto marks Config.encryption required, so config.Load rejects the config before any secret read or database access. config.example.yaml carries the block. The configuration reference, the key-rotation runbook, the self-managed install guide, the column-encryption guide and the run recipe now say the block is required, and quote the new error.
  • Downsides: this is a breaking change. A deployment without the block must add encryption: {local: {}} and a root key before it upgrades. The feat(config)! commit carries a BREAKING CHANGE: footer, so this MR merges with squash off. Two arms that handled a missing block stay until Step 13 removes them: the skip arm in wireEncryption and the operator guard. No loaded config reaches either one.

This is Step 12 of the S04-A required encryption block plan. Steps 4, 6 and 11, which it depends on, have merged.

Before merge

The plan's Dependencies make these a merge gate. They are not recorded yet.

  • Staging ar-config has the encryption block: its current value, read in Vault or in the materialized Secret, and the encryption tier wired boot line with its root_key_uri.
  • Production ar-config: the same two readings.
  • Before promoting the release with this change to production, read the production value again. A boot line shows only what one pod read when it booted.

Plan and spec amendments

The docs(plans): correct the S04-A encryption block plan's Step 12 commit corrects Step 12's text:

  • reencrypt.go needs no change. go.mod pins urfave/cli v3.14.0, whose cli.Exit error has an Unwrap, so ErrorAs reaches the violation and the exit code stays 1. The plan said v3.13.0 and a change to the non-ExitCoder arm.
  • The two server boot tests become one, TestWireEncryption_NoEncryptionBlockRefusesBoot. assembleApp loads the config before it applies any boot override, so a wired database client cannot change the outcome.
  • docs/testing/e2e/npm.md leaves Step 12's file list. e2e.npm.remote.credential-never-served asserts reads the upstream refuses, not a deployment without the block.

No spec change.

Checklist

  • Ran it:
    • driver.sh smoke on an isolated rig: 103 passed, 0 failed. The boot logged encryption tier wired.
    • OCI conformance locally against MinIO, with AR_DELIVERY_MODE=DELIVERY_MODE_PROXY as docs/dev/conformance.md says for MinIO: 75 of 80 specs ran, 75 passed, 0 failed, 5 skipped. The harness writes the block and a key, and AR booted under the rule.
    • The server and retire-key-version against internal/config/testdata/missing_encryption.yaml: both exit 1 with an error ending in validation error: encryption: value is required.
    • npm and Maven conformance run in this MR's pipeline.
    • gitlab-org/gitlab-caproni at 3f15f618 still has the block in values/artifact-registry.yaml and values/artifact-registry-iam.yaml, and mounts ar-encryption-root-key.
  • Interfaces and data: configuration only: encryption is now required. The S04-A spec already rules this (its Configuration section, the acceptance criterion and the Error Cases row). No API, schema, wire or storage change. No page under docs/user/ mentions encryption or a root key, so no user doc changes.
  • Failure: the process exits 1 at config load, before any secret read or database access, with an error naming encryption. A pod without the block crash-loops at boot instead of failing credential operations later.
  • Rollout: an image rollback is safe, because the previous release boots a config with the block. From this release on, ar-config must keep the block: a pod that restarts without it refuses to boot. See Before merge.
  • Hot path: none. The check runs once, at config load.
  • Database: n/a.
  • Security: fails closed. No deployment can run without the encryption stack. No new input, route or permission.
  • ADRs: ./scripts/adr-freshness.sh exits 0 (the mirror is current). ADR-007 defines the encryption key tables and says nothing on whether the block is optional. ADR-024 covers only in-transit TLS. No conflict. The two internal ADRs do not touch encryption, as the plan's research recorded.
  • E2E: no row changes. A boot refusal has no client-side scenario, and no row under docs/testing/e2e/ mentions encryption.
  • Simplicity: a check in wireEncryption alone would leave two rules, one for the server and one for the operator commands. The proto annotation is one rule for all three.

The run-recipe change is one Troubleshooting row and one word in its prerequisites. No recipe step or driver behavior changed, so there is no /skill-creator benchmark.

Reviewable size is 305 lines (generated config.pb.go excluded).

Open MRs !2969 (merged) and !2970 (merged) (S34 Step 5) overlap the proto, config_test.go, the example and the reference. Both already conflict with main. Whichever lands second rebases and regenerates config.pb.go, as the plan's Rebasing over S34 rule says.

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

Edited by Dzmitry (Dima) Meshcharakou

Merge request reports

Loading
Loading