You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Security: KMS master-key loaders silently fall back to a derivable key #16
Severity: high (security). With the encryption feature and a KMS-backed master key, any failure to load the key silently replaces it with a key that anyone who knows the configuration can derive.
Where
src/encryption/key_manager.rs, all four external master-key loaders:
Each one logs the error (error!("Failed to load key from AWS KMS: …")) and falls through to the deterministic key. The same happens when the matching cargo feature (aws-kms, vault-kms, …) is not enabled: a kms:// / vault:// config then quietly runs on a derived key with only a warn!.
Impact
A KMS outage, an expired credential, an IAM misconfiguration or a typo in the key id all lead to data encrypted under a key derived from public, non-secret inputs (key id/ARN, region, Vault path/address, GCP resource name, Azure vault URL plus key name).
Data encrypted during the outage can't be decrypted once the real key is back, or it all ends up under the weak key.
No error reaches the caller, so operators don't know it happened.
Expected
The loaders return Result<Vec<u8>, HammerworkError> and propagate KMS failures. KeyManager::new / key loading fails closed.
Configuring a KMS source without the matching cargo feature is a hard configuration error.
If a deterministic development key is still wanted, it takes an explicit opt-in (e.g. KeySource::InsecureDevelopment), and a warning names it as insecure.
Tests cover each loader's failure path returning an error. They can use an unreachable endpoint or invalid credentials and need no real cloud access.
Found by the panic and error-handling audit for #7. Related to #9 and #11 (encryption pipeline).
Activity
fix(encryption): fail closed on key loading and implement KeyManager …
fix(encryption): fail closed on key loading, implement KeyManager per…