chore(swift): remove placeholder SSE module (#4330)

security(swift): remove placeholder SSE module (backlog#646)

The Swift `encryption` module was a non-functional stub: `encrypt_data`
returned the plaintext unchanged while labeling it AES-256-GCM in the
object metadata, and `generate_iv` derived the IV from a timestamp
rather than a CSPRNG. It had no production caller (only a `pub mod`
declaration and one integration test), so wiring it in as-is would have
silently shipped plaintext advertised as ciphertext.

We are not supporting Swift server-side encryption for now, so remove
the module outright rather than keep a dangerous stub around:
- delete crates/protocols/src/swift/encryption.rs
- drop `pub mod encryption;` from swift/mod.rs
- remove the encryption case (and unused import) from the swift
  integration test

The module reached main dubiously: it was introduced together with the
whole Swift API in commit 86e93624 ("fix(heal): canonicalize scanner
object-dir repairs (#3864)"), a 1665-file squash whose PR description
only covered the heal change and never mentioned Swift or SSE.

Verified: cargo fmt; cargo test -p rustfs-protocols --features swift
--test swift_simple_integration (10 passed); arch guardrail scripts pass.
This commit is contained in:
Zhengchao An
2026-07-07 04:29:24 +08:00
committed by GitHub
parent 3bc8d79fe5
commit eb02486574
3 changed files with 1 additions and 541 deletions
@@ -16,25 +16,9 @@
#![cfg(feature = "swift")]
use rustfs_protocols::swift::{encryption, quota, ratelimit, slo, symlink, sync, tempurl, versioning};
use rustfs_protocols::swift::{quota, ratelimit, slo, symlink, sync, tempurl, versioning};
use std::collections::HashMap;
/// Test that encryption metadata can coexist with user metadata
#[test]
fn test_encryption_with_user_metadata() {
let key = vec![0u8; 32];
let config = encryption::EncryptionConfig::new(true, "test-key".to_string(), key).unwrap();
let plaintext = b"Sensitive data";
let (_ciphertext, enc_metadata) = encryption::encrypt_data(plaintext, &config).unwrap();
let mut all_metadata = enc_metadata.to_headers();
all_metadata.insert("x-object-meta-author".to_string(), "alice".to_string());
assert_eq!(all_metadata.get("x-object-meta-crypto-enabled"), Some(&"true".to_string()));
assert_eq!(all_metadata.get("x-object-meta-author"), Some(&"alice".to_string()));
}
/// Test sync configuration parsing
#[test]
fn test_sync_config_parsing() {