feat: add encrypt doc && refactoring encrypt code#893
feat: add encrypt doc && refactoring encrypt code#893qin-ctx merged 5 commits intovolcengine:mainfrom
Conversation
…refactoring duplicated code && add
|
Failed to generate code suggestions for PR |
qin-ctx
left a comment
There was a problem hiding this comment.
Summary
This PR adds encryption documentation, refactors provider code (extracting BaseProvider, unifying encrypt_file_key/decrypt_file_key signatures), fixes partial-read bugs in VikingFS, and adds Vault/Volcengine KMS integration tests.
4 blocking issues found:
VaultProvider._get_or_create_root_keyreferences an undefinedencrypted_root_keyvariable in theexceptbranch, preventing root key persistence on first deployment.- Vault KV storage hardcodes
mount_point="secret"and uses KV v1 API — incompatible with KV v2 or custom mount paths. - Both
VaultProviderandVolcengineKMSProvidersilently fall back to in-memory root keys when persistence fails, risking permanent data loss on restart. - This PR removes
auth_mode,trustedmode, Prometheus metrics, and stats/metrics routers — breaking changes unrelated to encryption that are not mentioned in the PR description.
qin-ctx
left a comment
There was a problem hiding this comment.
Review Summary
Great progress from the previous iteration — all 7 issues from the last review have been addressed. The BaseProvider extraction, unified encrypt_file_key/decrypt_file_key signatures, and proper root key persistence with fatal-on-failure semantics are all solid improvements.
1 blocking issue found: VaultProvider._ensure_root_key_exists references the removed class constant ROOT_KEY_NAME (should be instance variable root_key_name), which will crash at runtime.
Previous review issues status:
- ✅
encrypted_root_keyundefined in except branch — fixed - ✅ Hardcoded
mount_point="secret"/ KV v1 only — fixed (configurablekv_mount_path+kv_version) - ✅ Silent fallback to ephemeral root key — fixed (raises
ConfigError) - ✅ Same issue in
VolcengineKMSProvider— fixed - ✅ Unrelated
auth_mode/metrics removals — reverted from PR - ✅ Hardcoded root key file path — fixed (configurable
key_file) - ✅ Unrelated
clean_stale_rocksdb_locks— reverted from PR
qin-ctx
left a comment
There was a problem hiding this comment.
All issues from the previous review have been resolved:
- ✅
self.ROOT_KEY_NAME→self.root_key_namein_ensure_root_key_exists(3 occurrences) - ✅
VolcengineKMSProvider._encrypt_with_kms/_decrypt_with_kmsnow useasyncio.to_thread - ✅ Design doc with typo filename removed from PR
LGTM. The encryption refactoring is clean — unified provider interface via BaseProvider, proper root key persistence with fatal-on-failure, and correct partial-read handling in VikingFS.
Description
feat: add encrypt doc && fix Partial reads/wrong location problem && refactoring duplicated code && add vault / volcengine ms mock/integration test.
Related Issue
#827
prev pr:
#828
Type of Change
Changes Made
Testing
Checklist
Screenshots (if applicable)
Additional Notes