mirror of
https://github.com/volcengine/OpenViking.git
synced 2026-10-01 01:38:07 +08:00
* fix(crypto): never overwrite Vault root key on transient read failures Sweep finding B-01 * fix(crypto): clear cached ephemeral root key when Vault persist fails The InvalidPath create branch cached the freshly generated root key in self._root_key before encrypting/persisting it. If _encrypt_with_vault or the KV write failed (transient transit/KV outage), get_root_key raised but left the never-persisted key cached, so a retry returned it via the `self._root_key is not None` fast path and encrypted data with a key that vanishes on restart — the data-loss class this provider guards. Wrap encrypt+persist in one try and null the cache before raising; add a regression asserting the cache is cleared and the next call re-reads Vault. Addresses the blocking review finding on #3423.