Skip to content

[audit][low] Lazy-loaded Merk references do not validate fetched node metadata #682

Description

@QuantumExplorer

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions