fix(configuration): bindings encryption keys must use the env engine
This commit is contained in:
1 parent
d6a4328d5c
commit
2833bddfba
2 files changed
+17
-1
No files matched your search
@@ -737,7 +737,9 @@ type CaptureConfig struct {
|
||||
// EncryptionKey is unset, binding secrets are persisted as plaintext
|
||||
// (legacy behaviour); when set, they are AES-256-GCM encrypted at rest
|
||||
type BindingsConfig struct {
|
||||
// EncryptionKey is the active key that seals new binding secrets.
|
||||
// EncryptionKey is the active key that seals new binding secrets. It must
|
||||
// name the env engine: the State Store resolves it before extension engines
|
||||
// exist.
|
||||
// Resolved through the secret registry (engine + key) at startup; the
|
||||
// resolved material must be 32 bytes of high-entropy randomness.
|
||||
// A nil/empty ref disables encryption and keeps current behaviour.
|
||||
|
||||
@@ -393,6 +393,20 @@ func validateContainers(cfg *config.Config) error {
|
||||
if ref := cfg.Containers.RegistryAuth; ref != (config.SecretRef{}) && (ref.Engine == "" || ref.Key == "") {
|
||||
return fmt.Errorf("%w: containers.registry_auth must name both an engine and a key, got {engine: %q, key: %q}", ErrInvalidInput, ref.Engine, ref.Key)
|
||||
}
|
||||
return validateBindingKeyEngines(cfg.Bindings)
|
||||
}
|
||||
|
||||
// validateBindingKeyEngines requires the bindings encryption keys to name the
|
||||
// env engine. The State Store resolves them at boot, before it serves the
|
||||
// installed packages an extension engine comes from, so an extension engine
|
||||
// could never answer.
|
||||
func validateBindingKeyEngines(b config.BindingsConfig) error {
|
||||
refs := append([]config.SecretRef{b.EncryptionKey}, b.PreviousEncryptionKeys...)
|
||||
for _, ref := range refs {
|
||||
if ref != (config.SecretRef{}) && ref.Engine != "env" {
|
||||
return fmt.Errorf("%w: bindings encryption keys must use the env engine, got engine %q", ErrInvalidInput, ref.Engine)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user