Repository navigation
fix(storage): apply AES256Key on every encryptable build path and keep the disk cache free of decrypted artifacts - #1916
Conversation
…ache free of decrypted artifacts Encryption at rest now covers every place a configured key can reach and every place decrypted bytes could otherwise land on local disk. Key handling: - The JSON-LD parser resolves AES256Key on S3 and memory storage nodes, matching the file branch. - FlureeBuilder routes every terminal build (build, build_memory, both S3 builds, and the build_client paths) through one encrypt_if_configured helper, and address-identifier storages through encrypt_storage_from_config. Disk cache: - New StorageRead/ContentStore::permits_plaintext_cache capability, false for EncryptedStorage and delegated by every wrapper. - The read-through artifact cache, the sync leaf fetch, indexer cache seeding, the lazy dictionary pack loader and the vector shard fetcher all consult it; packs and shards are served from memory when it is false. Tests cover the parser, the capability through type erasure, the cache helpers, file and memory build_client end to end (ciphertext at rest, empty cache directories, with an unencrypted control), and a LocalStack build_client from an S3 JSON-LD config. Docs describe what stays plaintext and use the @id-bearing JSON-LD shape the parser requires.
The builder now carries a ConfiguredKey: the single place raw bytes or base64 become a StaticKeyProvider and the single place a storage gets wrapped. Base64 decoding delegates to the crypto crate, which trims, accepts URL-safe input and zeroizes the decoded buffer; the three identical copies in the api crate are gone. The newtype's Debug never prints key material, which the builder's derived Debug previously did. build_encrypted, build_encrypted_from_config, build_memory_encrypted and build_s3_encrypted delegate to their plain counterparts, which honour the builder key. build_s3_encrypted therefore keeps its storage-backed nameservice plaintext like every other path, instead of encrypting it. S3StorageConfig to S3Config translation lives once, in fluree_db_connection::aws::s3_config_from, replacing four copies with differing empty-endpoint handling.
aaj3f
left a comment
There was a problem hiding this comment.
@bplatz this makes sense and it's a good catch of those places where we'd hardcoded aes256_key: None. I think the design you have for "Wrappers delegate to what they wrap" makes sense, but we should be careful about this as it means we can re-open this unencrypted leak issue in the future as that wrapper delegation could mean new "wrappers" in the future could easily betray this by simply not delegating. Claude actually found in #1919 for example that two newly-introduced wrappers there do not delegate. I'll say more about that in the review I'm about to post for that PR. Full review below:
The disk-cache half of this is a genuinely good catch and the capability-on-the-trait shape is the right one; "cache files are mmap'd and range-read, so an encrypted envelope would not serve those readers" is the sentence that makes the whole design obvious in hindsight, and the unencrypted control in the memory test is what let me confirm your non-vacuity claim instead of taking it on faith. The S3-and-memory parser gap is the kind of bug that is worth the whole PR on its own — the documented way to encrypt an S3 deployment was silently writing plaintext.
Two things I'd like in before this merges, though. First, the cache guard covers every write into the cache directory but not five of the reads out of it (binary_index_store.rs:942, :1003, :1128, :3573 and arena/vector.rs:803), so a deployment that ran an earlier build with encryption on keeps serving the plaintext leaves already sitting in $TMPDIR/fluree_binary_cache after it upgrades to this fix — I confirmed that by running it, not by reading it, and docs/security/encryption.md:245 currently claims the opposite.
Second, build_ipfs (lib.rs:2599) is the one terminal build with no encrypt_if_configured, so a configured key is dropped silently on the one backend that publishes to a public network; given what that failure mode is, I think it should be a hard error rather than silence.
Adherence to repo commitments:
- Patterns/abstractions: ✔ Extends
StorageRead/ContentStorewith a capability rather than bolting on a parallel mechanism, and every production wrapper delegates; the fail-open default is the one thing I'd want a second look at. - Performance (speed first, memory second): ✔ for the unencrypted path — one virtual call, hoisted out of the per-blob loops, no new allocation or lock.
⚠️ for encrypted remote backends, where the bypass is a documented but unmeasured slowdown and also gives up single-flight coalescing (disk_cache.rs:710). - Testing:
⚠️ The new tests are real, wired intogrp_misc, run in CI, and non-vacuous under mutation — but every one of them starts from a freshTempDir, which is precisely why none catches the stale-cache-entry read. A test that pre-seeds the cache directory would have. - Conventions: ✔ Multi-line commit bodies with real rationale, clippy/fmt green at
26164f0ec, docs updated alongside the behavior. The one gap is that the title anddocs/security/encryption.mdboth claim more coverage than the code has.
Verified locally at 26164f0ec: cargo test -p fluree-db-api --test grp_misc it_storage_encrypted → 9 passed / 0 failed with all three new tests present by name; mutating EncryptedStorage::permits_plaintext_cache to true turns both end-to-end tests red (7 passed / 2 failed, six artifacts named); a temporary probe proved get_leaf_bytes_sync serves a stale cache entry against a non-permitting store; cargo check -p fluree-db-crypto clean with --no-default-features, default and --all-features. Worktree restored, git status clean.
Happy to be wrong about the build_ipfs severity if you'd rather warn than error there — but the cache-read guard I'd really like to see in this PR rather than the next one, since it's the difference between "new deployments are clean" and "everyone who already turned encryption on is clean."
| let cid = leaf_cid.clone(); | ||
| let cache_path_owned = cache_path.clone(); | ||
| let disk_cache = Arc::clone(&self.disk_cache); | ||
| let persist = cs.permits_plaintext_cache(); |
There was a problem hiding this comment.
Blocking — the cache guard covers every site that writes an artifact to the cache directory, but not the sites that read one that is already there, so a plaintext entry left by an earlier run is still served under encryption.
let persist = cs.permits_plaintext_cache() correctly stops the write on line 1035 — but the match std::fs::read(&cache_path) thirteen lines above it, at :1003, returns the cached bytes before persist is ever computed. Same shape at :942 (if local.is_none() && promoted.exists() → the promoted path is then mmap'd), at :1128 (open_leaf_handle_native "Fast path 2" maps the cache path directly), at :3573 (ContentStoreRangeFetcher::read_range's "Check cache"), and at arena/vector.rs:803 (if source.on_disk … return std::fs::read(&source.path), where on_disk was set from cache_path.exists() back at :3385). fluree-db-core/src/disk_cache.rs:720/:756 and dict/pack_reader.rs:488 get this right — pack_reader in particular gates the read with disk_cache && cache_path.exists() and its comment states the intent exactly: "nothing left there by an earlier run is consulted." That intent just didn't reach the leaf and vector paths.
The failing scenario is the population this PR is written for. A deployment that has been running with encryption on before this fix has $TMPDIR/fluree_binary_cache/{alias}/{root}/ full of decrypted leaves — that is the bug being fixed. Nothing in the PR purges that directory, and because addresses are hashes of plaintext the CID filenames are identical after the upgrade, so the reader keeps serving them indefinitely. The same applies to any host that held the ledger unencrypted before it was re-imported encrypted. It also makes docs/security/encryption.md:245 — "nothing already in the cache directory is consulted" — untrue as written.
Claude caught this and I confirmed it by running it rather than by reading: a temporary probe seeded one stale file in the cache directory and called get_leaf_bytes_sync against a store answering permits_plaintext_cache() == false; it returned the stale bytes, not the store's. The fix is the same two-line shape pack_reader.rs already uses, at each of the five sites — for instance here:
// Check cache — only when this store permits a plaintext copy outside it.
let persist = cs.permits_plaintext_cache();
if persist {
let cache_path = self.cache_dir.join(leaf_cid.to_string());
match std::fs::read(&cache_path) {
Ok(bytes) => return Ok(bytes),
Err(err) if err.kind() == io::ErrorKind::NotFound => {}
Err(err) => return Err(err),
}
}Worth considering alongside it: a one-time remove_dir_all of the ledger's cache subtree on first open under a non-permitting store, so an operator who applies this fix is actually clean rather than merely no longer adding to the pile.
One note in your favour on blast radius. fluree/solo#1257 re-roots both index caches under FLUREE_AI_INDEX_CACHE_DIR (default <data-dir>/cache), so a standalone upgrade changes the cache directory and never consults the old $TMPDIR entries — the gap is effectively closed for that product by accident. It stays live for anything on db's own default $TMPDIR/fluree_binary_cache, which is every library embedder and any server that doesn't set cache_dir. Since solo#1257's body asserts "the binary-index disk caches hold no decrypted artifacts on an encrypted store" as a flat fact, that sentence would want a qualifier too if this ships as-is.
Commenting here because the read sites themselves — binary_index_store.rs:942, :1003, :1128, :3573 — are not in this diff; this is the changed line that guards the write side.
There was a problem hiding this comment.
Fixed in 27bc337. All five read sites now check permits_plaintext_cache() before touching the cache, the same way pack_reader does. There was a sixth: DictTreeReader's read_disk_cached_leaf (dict/reader.rs) had the same gap and is gated too. The vector probe moved into a small vector_shard_source function so it can be tested on its own.
New tests seed the cache with a stale entry first, then check that each path serves it only for a permitting store: stale_cache_entries_are_served_only_when_plaintext_cache_permitted covers the leaf and vector paths, and stale_disk_cached_leaf_is_ignored_when_plaintext_cache_forbidden covers the dict tree. I removed each guard one at a time and the tests failed every time.
On purging: I went with documentation over a remove_dir_all on open. docs/security/encryption.md now has an upgrade note telling operators to delete the old cache directory, and the "nothing already in the cache directory is consulted" line is true again. Auto-deleting under a directory the operator configured felt like too blunt a tool for this PR.
| /// key. Every terminal build path routes its base storage through here, | ||
| /// so a key set by `with_encryption_key*()` or parsed from JSON-LD is | ||
| /// honoured on every backend rather than dropped by one backend's path. | ||
| fn encrypt_if_configured(&self, storage: Arc<dyn Storage>) -> Arc<dyn Storage> { |
There was a problem hiding this comment.
Blocking — fluree-db-api/src/lib.rs:2599: build_ipfs never calls encrypt_if_configured, so a configured key is dropped silently on the one backend where the data leaves the building.
Every other terminal build routes its base storage through encrypt_if_configured (:2361, :2557, :2664, :2746, :3079, :3156, :3224). This one constructs StorageBackend::Permanent(Arc::new(ipfs_store)) directly. FlureeBuilder::file(..).with_encryption_key(k) then .build_ipfs(url) — or, more realistically, from_json_ld(cfg_with_AES256Key)?.build_ipfs(url) — pins every commit and index blob to a public content-addressed network in plaintext, with no error, no warning, and a builder that still answers true to has_encryption_key().
I understand the structural reason: IpfsStorage implements ContentStore, not Storage, so EncryptedStorage can't wrap it as written. That makes "we can't honour your key on this backend" the right answer — but it has to be said. A hard error is the safe default given what the data is:
if self.has_encryption_key() {
return Err(ApiError::config(
"build_ipfs cannot honour a configured encryption key: IpfsStorage is a ContentStore, \
which EncryptedStorage does not wrap. Remove the key or choose an encryptable backend.",
));
}(That changes build_ipfs's signature to Result<Fluree>; if that's more churn than you want here, a tracing::error! plus a line in docs/security/encryption.md's "What Stays Plaintext" would at least stop it being silent.) Either way the title's "every build path" and the docs' "Works natively with all storage backends … on every build path" need the exception named.
Commenting here because fluree-db-api/src/lib.rs:2599 is not in this diff; this is the helper every build path routes through except that one.
There was a problem hiding this comment.
Fixed in e8333b2. build_ipfs now returns Result<Fluree> and errors when a key is configured. Its only caller was its own unit test. build_ipfs_rejects_an_encryption_key covers it. The docs and the PR title now name the exception instead of claiming every build path.
| /// key. Every terminal build path routes its base storage through here, | ||
| /// so a key set by `with_encryption_key*()` or parsed from JSON-LD is | ||
| /// honoured on every backend rather than dropped by one backend's path. | ||
| fn encrypt_if_configured(&self, storage: Arc<dyn Storage>) -> Arc<dyn Storage> { |
There was a problem hiding this comment.
Optional — fluree-db-api/src/lib.rs:2419: this is more of a question than a suggestion: should build_with warn when it discards a configured key, the way it already warns when it discards an indexer config?
Ignoring the key here is right — the caller hands in a fully composed storage and may well have wrapped it themselves, so wrapping again would double-encrypt. But the method three lines up already has warn_if_discarding_indexer_config("build_with") for exactly this shape of "you set a thing and this path won't use it," and a key is a more surprising thing to have quietly dropped than an indexer knob. One line:
if self.encryption_key.is_some() {
tracing::warn!(
build_path = "build_with",
"a configured encryption key is ignored: this path uses the storage you supplied"
);
}Minor and non-blocking — but if you agree it's right, I'd rather see it folded in now than lost in the backlog.
Commenting here because fluree-db-api/src/lib.rs:2419 is not in this diff; this is the helper build_with does not reach.
There was a problem hiding this comment.
Agreed, folded in: e8333b2 adds the warning, and docs/security/encryption.md lists build_with next to build_ipfs as a path that doesn't apply the key.
| /// storage gets wrapped. A newtype so the builder stays `Debug` without | ||
| /// ever printing key material. | ||
| #[derive(Clone)] | ||
| struct ConfiguredKey(Arc<StaticKeyProvider>); |
There was a problem hiding this comment.
Optional — the ConfiguredKey newtype closes the encryption_key field's half of the Debug leak, but {:?} on a FlureeBuilder still prints the base64 key through the other field.
The commit body says "The newtype's Debug never prints key material, which the builder's derived Debug previously did," and that's true of encryption_key. FlureeBuilder also derives Debug (:1395) over config: ConnectionConfig, and ConnectionConfig → StorageConfig derives Debug over pub aes256_key: Option<Arc<str>> (fluree-db-connection/src/config.rs:129-137), which is the raw base64 key with any envVar indirection already resolved. So a builder constructed by from_json_ld still renders its key in full under {:?}.
I checked and nothing logs a ConnectionConfig or StorageConfig today, so this is latent rather than live — it's one ?config field on a future tracing call away. A manual Debug on StorageConfig that redacts aes256_key would close it for good, and #1919 widens the same surface with a whole Vec<KeyedAes256Key> of them, so it may be worth doing at that layer rather than this one. Your call which PR it lands in.
Commenting here because fluree-db-connection/src/config.rs:129-137 is not in this diff.
There was a problem hiding this comment.
Done here rather than in #1919 (e8333b2). StorageConfig has a manual Debug that prints aes256_key as Some(<redacted>). IdentityDefaults::private_key had the same leak on the same builder path, so it's redacted too. debug_never_prints_secrets covers both. #1919 can reuse the Redacted helper for its list of keyed keys.
| @@ -2918,78 +2782,19 @@ impl FlureeBuilder { | |||
| /// * `key` - 32-byte AES-256 encryption key | |||
| #[cfg(feature = "aws")] | |||
| pub async fn build_s3_encrypted(self, key: [u8; 32]) -> Result<Fluree> { | |||
There was a problem hiding this comment.
Optional — build_s3_encrypted no longer encrypts the storage-backed nameservice, and I think that's right, but it's a compatibility break worth one line of docs.
On main this method passed the encrypted storage to StorageNameService::new(storage.clone(), ""); it now delegates to build_s3(), which builds the nameservice from the raw S3Storage before encrypt_if_configured wraps it. A store written by the old build_s3_encrypted therefore has FLU\0-enveloped nameservice records that the new code reads as raw bytes. I traced what that looks like and it fails loudly at JSON parse rather than silently returning an empty ledger list, which is the right direction to fail — but an operator hitting it will have no idea why. The body's justification ("no deployment uses an encrypted storage-backed nameservice today") is a claim I can't check from the repo; if it's right, a sentence in docs/security/encryption.md's "What Stays Plaintext" naming the symptom would still save someone an afternoon.
There was a problem hiding this comment.
Leaving this one alone on purpose. No deployment uses an encrypted storage-backed nameservice, so a migration note would describe a store that doesn't exist. The PR body now states the break and why it's unhandled.
| /// whole read path for a store that decrypts on read: its bytes must not | ||
| /// land in the cache directory, and a stale plaintext entry from an earlier | ||
| /// unencrypted run must not be consulted either. | ||
| async fn fetch_uncached(cs: &dyn ContentStore, id: &ContentId) -> io::Result<Vec<u8>> { |
There was a problem hiding this comment.
Optional — fetch_uncached gives up single-flight coalescing, not just the disk write.
fetch_cached_bytes normally routes its miss through cache.coalesced_fetch(...), which holds an in-flight map so that N concurrent readers of one cold artifact produce one cs.get. fetch_uncached calls cs.get directly, so under encryption those N readers each issue their own fetch. On file storage that's noise; on S3 it's an N× amplification on exactly the workload the perf note is warning about ("a remote backend such as S3 re-fetches an index artifact whenever it falls out of the in-memory leaflet cache"). The coalescing half of DiskArtifactCache is independent of the disk write, so keeping it while skipping best_effort_write looks like it would hold — roughly, a coalesced_fetch variant that takes a persist: bool. I don't think this is hot-path in the sense of per-row work, but it is per-cold-artifact on the path this PR just made cold, so it seems worth either fixing or naming in the perf note.
There was a problem hiding this comment.
Fixed in 27bc337. coalesced_fetch now wraps a coalesce(target, persist, fetch), and fetch_uncached runs its fetch through a detached flight group (UNCACHED_FLIGHTS). That group is never registered and never creates a directory, so with persist == false the leader neither re-checks nor writes the disk. Flights are keyed by the path the cache would have used, so they're exactly as narrow as the cached ones. uncached_fetch_coalesces_concurrent_callers_without_touching_disk sees 8 concurrent readers share 2 gets (one per cache key) and checks the cache directory never exists. Without the change it's 8.
| /// cache becomes a plaintext copy of the ledger. Wrappers delegate to | ||
| /// what they wrap. The default (`true`) is for storages whose reads | ||
| /// return exactly the bytes at rest. | ||
| fn permits_plaintext_cache(&self) -> bool { |
There was a problem hiding this comment.
Optional, regression-proofing — the capability defaults to true (fail-open) where its sibling two methods up defaults to false.
supports_ranged_reads at :324 defaults to "assume not" and makes each backend opt in; permits_plaintext_cache defaults to "assume yes" and makes each wrapper opt out. I checked every production wrapper and the delegation is complete at this head — TieredStorage, AddressIdentifierResolverStorage, StorageContentStore, BranchedContentStore, MeteredContentStore and both Arc<dyn _> impls all delegate — so nothing is broken today. But the invariant is held up by a doc comment, and the next wrapper anyone writes re-opens the leak with no compile error and no test failure. I don't have a clean fix to propose that doesn't ripple through the test impls, so I'll leave it as an observation rather than a request — except to say that #1919 adds encryption_admin to this same trait with the same "wrappers delegate" comment, and there two wrappers don't, with a user-visible consequence. Might be worth a shared answer across both.
There was a problem hiding this comment.
Went for the compile-time answer (27bc337). permits_plaintext_cache is now a required method on both StorageRead and ContentStore, so a wrapper that forgets to delegate is a compile error rather than a silent leak. I chose this over flipping the default to false, because then a missed delegation silently loses the disk cache, which is a slowdown no test would catch. All 34 implementations answer explicitly: base stores return true, wrappers delegate. It cost about 22 one-liners, mostly test doubles.
That also answers the #1919 point. Once this merges, its two non-delegating wrappers stop compiling until they answer. encryption_admin could get the same treatment there.
| .or_else(|| self.parents.iter().find_map(|p| p.resolve_cached_bytes(id))) | ||
| } | ||
|
|
||
| /// A read may be served by any ancestor, so every store in the |
There was a problem hiding this comment.
Praise — BranchedContentStore::permits_plaintext_cache requiring every ancestor to permit, rather than just the branch store, is the conservative direction and the comment says why.
Same for AddressIdentifierResolverStorage at fluree-db-api/src/lib.rs:1073 — "No address to route on — permit only if every routable storage does." That's the right instinct on both.
| } | ||
| let builder = FlureeBuilder::from_json_ld(&jsonld_storage_config(storage)).expect("config"); | ||
| assert_eq!(builder.has_encryption_key(), key.is_some()); | ||
| let fluree = builder |
There was a problem hiding this comment.
Praise — the unencrypted control inside build_client_memory_honours_key_and_bypasses_disk_cache is what makes the empty-cache assertion mean something.
It's the reason I could confirm the non-vacuity claim rather than take it. I flipped the capability back to true and both end-to-end tests went red naming six spilled artifacts, exactly as the body says.
…read The cache guard stopped plaintext from being written to the binary-index disk cache under encryption, but six read sites still served whatever was already there: the promoted-leaf mmap and owned read in get_leaf_bytes_shared/get_leaf_bytes_sync, open_leaf_handle's cached mmap, ContentStoreRangeFetcher's cached range read, the vector shard on-disk probe, and DictTreeReader's disk-cached leaf read. Because CIDs hash plaintext, entries left by a build that ran with encryption on (or by a ledger held unencrypted before re-import) keep matching after the upgrade and were served indefinitely. Each site now consults the cache only when permits_plaintext_cache() allows it, as pack_reader already did. permits_plaintext_cache is now a required method on StorageRead and ContentStore. With a default of `true`, a wrapper that forgot to delegate re-opened the leak with no compile error; every implementation now has to answer. Base stores answer true, wrappers delegate. fetch_uncached keeps the single-flight: concurrent readers of one cold artifact on an encrypted store share one fetch through a detached flight group that never creates or touches a cache directory. Tests seed the cache with a stale entry and assert each read path serves it only for a permitting store; removing any one guard fails them.
…ig secrets
build_ipfs was the one terminal build that dropped a configured
encryption key silently, on a backend that publishes to a public
content-addressed network. IpfsStorage is a ContentStore that
EncryptedStorage cannot wrap, so build_ipfs now returns Result and errors
when a key is configured.
build_with leaves the key to the caller, who may already have wrapped the
storage, but now logs a warning instead of ignoring it silently.
StorageConfig and IdentityDefaults render aes256_key and private_key as
<redacted> under Debug, so a builder built from JSON-LD no longer prints
its key through {:?}.
docs/security/encryption.md names the build_ipfs and build_with
exceptions, tells operators upgrading from an earlier release to delete
the old cache directory, notes that proxy-mode peers cache plaintext, and
describes the nameservice records written by the old build_s3_encrypted,
which this release cannot read.
No deployment uses an encrypted storage-backed nameservice, so the compatibility note describes a store that does not exist.
Summary
Tightens encryption-at-rest coverage in two places: a configured
AES256Keyis now applied on every encryptable builder path and backend, and the binary-index disk cache no longer holds or serves decrypted artifacts when encryption is enabled. The two build paths that cannot apply the key say so:build_ipfserrors,build_withwarns.Key handling
AES256Keyon S3 and memory nodes, the same way the file branch already did.FlureeBuilderroutes every terminal build —build(),build_memory(),build_s3(),build_s3_dynamo()and all threebuild_clientpaths — through oneencrypt_if_configuredhelper, so a key set viawith_encryption_key*()or JSON-LD is honoured regardless of backend. Thebuild_*_encrypted()methods remain as explicit-key variants.encrypt_storage_from_config.Disk cache
StorageRead::permits_plaintext_cache()/ContentStore::permits_plaintext_cache()capability, a required method with no default.EncryptedStorageanswersfalse;TieredStorage,AddressIdentifierResolverStorage,BranchedContentStore,StorageContentStoreandMeteredContentStoredelegate.fetch_cached_bytes{,_cid},BinaryIndexStore::get_leaf_bytes_sync, indexer cache seeding, the lazy dictionary pack loader (.fpk) and the vector shard fetcher (.vas). Packs and shards are served from memory instead when the store says no.Tests
AES256Keyacross all three storage types.build_clientfrom JSON-LD with a key assert every blob at rest carries theFLU\0envelope and both the reader's and the indexer's cache directories stay empty; the memory variant has an unencrypted control that does populate the cache.--features aws,aws-testcontainers):build_clientfrom an S3 JSON-LD config with a key writes only enveloped objects, and a second client built from the same config reads them back.EncryptedStorage::permits_plaintext_cachetotrue: both API regression tests fail.Cleanup (second commit)
With every plain build honouring the builder key, the surrounding code collapsed:
ConfiguredKeynewtype: one place raw bytes or base64 become aStaticKeyProvider, one place a storage gets wrapped. Base64 decoding delegates to the crypto crate (trims, accepts URL-safe input, zeroizes the decoded buffer); the three identical decoders in the api crate are gone. The newtype'sDebugnever prints key material, which the builder's derivedDebugpreviously did.build_encrypted,build_encrypted_from_config,build_memory_encryptedandbuild_s3_encryptedare one-line delegations to their plain counterparts.build_s3_encryptednow keeps its storage-backed nameservice plaintext like every other path; it previously encrypted it. That is a compatibility break for a store written by the old method, and it is deliberately not handled or documented: S3 deployments pair with DynamoDB in practice, and no deployment uses an encrypted storage-backed nameservice.S3StorageConfigtoS3Configtranslation lives once, influree_db_connection::aws::s3_config_from, replacing four copies that differed on empty-endpoint handling.Review follow-ups
open_leaf_handle's cached mmap,ContentStoreRangeFetcher's range read, the vector shard on-disk probe andDictTreeReader's cached leaf read now consult the cache only when the store permits it. Unit tests put a stale entry in the cache first and assert each path serves it only for a permitting store; removing any single guard fails them.permits_plaintext_cachehas no default, so a new wrapper that forgets to delegate is a compile error rather than a silent leak. All 34 implementations answer explicitly.build_ipfsreturnsResultand errors when a key is configured;IpfsStorageis aContentStorethatEncryptedStoragecannot wrap.build_withwarns when it ignores a configured key.StorageConfig::aes256_keyandIdentityDefaults::private_keyrender as<redacted>.build_withexceptions are listed.Docs
docs/security/encryption.mdgains a "What Stays Plaintext" section (nameservice; no disk cache under encryption, with an upgrade note; proxy-mode peers) and a performance note for remote backends.docs/operations/storage.mdand the connection-config reference are updated, and the JSON-LD encryption examples now use the@id-bearing node shape the parser requires.Verification
Unit suites for
fluree-db-core(native),fluree-db-crypto,fluree-db-connection,fluree-db-binary-index,fluree-db-indexer; API groupsgrp_misc,grp_index,grp_ledger; all six LocalStack S3 tests. Clippy and fmt clean, includingfluree-db-apiwith theawsfeature.After the review follow-ups: unit suites for
fluree-db-binary-index,fluree-db-core(native),fluree-db-connection,fluree-db-indexer,fluree-db-nameservice,fluree-db-nameservice-sync,fluree-db-cryptoandfluree-db-api(ipfsfeature);it_storage_encrypted,it_import_remote,it_reindex_pre_build_perf,it_trigger_index_incremental,it_rebuild_fetch_countsandit_residency_retry. Workspace clippy, plusipfs/aws,residencyand CI's wasm32 clippy gate with-D warnings. The LocalStack S3 tests were not re-run.