Created from a Codex audit of grovedb. No code changes were made as part of the audit.
Summary
When a Link::Reference is loaded, the fetched node is trusted. The key check is debug-only and hash/aggregate/height metadata are not validated against the reference.
Impact / failure scenario
Corrupt storage or a custom Fetch implementation can return a stale or wrong node; release builds can continue with inconsistent link metadata and loaded tree contents.
References
merk/src/tree/mod.rs:1497
merk/src/tree/walk/mod.rs:90
merk/src/merk/source.rs:51
Suggested fix
Validate fetched key, hash_for_link(tree_type), aggregate data, and child heights before converting a reference link into a loaded node.
Suggested tests
Corrupt a referenced child record after commit and assert get/prove fails at load time.
Created from a Codex audit of grovedb. No code changes were made as part of the audit.
Summary
When a
Link::Referenceis loaded, the fetched node is trusted. The key check is debug-only and hash/aggregate/height metadata are not validated against the reference.Impact / failure scenario
Corrupt storage or a custom
Fetchimplementation can return a stale or wrong node; release builds can continue with inconsistent link metadata and loaded tree contents.References
merk/src/tree/mod.rs:1497merk/src/tree/walk/mod.rs:90merk/src/merk/source.rs:51Suggested fix
Validate fetched key,
hash_for_link(tree_type), aggregate data, and child heights before converting a reference link into a loaded node.Suggested tests
Corrupt a referenced child record after commit and assert
get/provefails at load time.