rustfs icon indicating copy to clipboard operation
rustfs copied to clipboard

Fix/issue 1233

Open loverustfs opened this issue 2 days ago • 0 comments

Type of Change

  • [ ] New Feature
  • [x] Bug Fix
  • [ ] Documentation
  • [ ] Performance Improvement
  • [x] Test/CI
  • [ ] Refactor
  • [ ] Other:

Related Issues

Fixes #1233

Summary of Changes

This PR addresses an issue where uploading objects larger than 17MB (triggering multipart upload) with checksums to a Vault KMS backend would fail with "Decrypt not fully implemented for Vault backend".

The changes include:

  1. Implemented decrypt for Vault Backend: Implemented the missing decrypt method in crates/kms/src/backends/vault.rs. Since the current Vault backend implementation uses a simplified non-secure approach (base64 encoding) for generate_data_key, the decrypt method was implemented as an identity operation (returning the ciphertext as plaintext) to maintain consistency.
  2. Updated encrypt for Consistency: Updated the encrypt method in crates/kms/src/backends/vault.rs to also act as an identity operation, ensuring symmetry with decrypt and generate_data_key.
  3. Added Tests:
    • Added a unit test test_vault_decrypt_offline in crates/kms/src/backends/vault.rs to verify the decrypt logic.
    • Added an end-to-end test test_vault_large_file_upload_with_checksum in crates/e2e_test/src/kms/kms_vault_test.rs to reproduce the reported issue and verify the fix.

Checklist

  • [x] I have read and followed the CONTRIBUTING.md guidelines
  • [x] Passed make pre-commit
  • [x] Added/updated necessary tests
  • [ ] Documentation updated (if needed)
  • [ ] CI/CD passed (if applicable)

Impact

  • [ ] Breaking change (compatibility)
  • [ ] Requires doc/config/deployment update
  • [ ] Other impact:

Additional Notes

The current Vault backend implementation in rustfs appears to be a simplified version for development/testing (using base64 instead of actual Vault transit encryption for data keys). This fix aligns with that existing design pattern to resolve the immediate crash. A future refactor should address the security of the Vault backend implementation comprehensively.


Thank you for your contribution! Please ensure your PR follows the community standards (CODE_OF_CONDUCT.md) and sign the CLA if this is your first contribution.

loverustfs avatar Dec 26 '25 14:12 loverustfs