feat(storage): encryption-at-rest key rotation + on-disk verification tests#348
Open
feat(storage): encryption-at-rest key rotation + on-disk verification tests#348
Conversation
Agent-Logs-Url: https://github.com/plures/pluresdb/sessions/a0204fd9-adf8-4215-b445-bd47ffa73129 Co-authored-by: kayodebristol <3579196+kayodebristol@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add key rotation support and verification tests for encryption-at-rest
feat(storage): encryption-at-rest key rotation + on-disk verification tests
Apr 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pluresdb-storagehad AES-256-GCM primitives but no safe block re-encryption path and no tests proving ciphertext opacity on disk. This adds the full rotation workflow, on-disk verification tests, and key management docs.API —
rotate_key_and_reencrypt_blocksThe existing
rotate_key()is unchanged (in-memory key swap only; userotate_key_and_reencrypt_blockswhen stored blocks must be migrated).Changes
encryption.rs—rotate_key_and_reencrypt_blocks(new_password, blocks): all-or-nothing block re-encryption;selfis not mutated if any block fails to decrypt. Five new unit tests cover round-trip, wrong-key error, disabled-config error, and stale-ciphertext rejection.tests/encryption_at_rest_tests.rs(new) — 9 integration tests:encrypt()calls produce distinct ciphertexts (nonce uniqueness)encryption.jsonexposes no key material, only the Argon2id saltdocs/KEY_MANAGEMENT.md(new) — key derivation patterns, two-phase rotation workflow, recovery-from-key-loss decision table, Argon2id parameter configuration guidance.docs/API.md— updatedEncryptionConfigmethods table to includerotate_key_and_reencrypt_blocks; key rotation section now shows the recommended two-phase pattern and links toKEY_MANAGEMENT.md.