-
Notifications
You must be signed in to change notification settings - Fork 27
[audit][medium] Non-empty tree delete can reopen parent with child tree type #686
Copy link
Copy link
Closed
Labels
area:mutations-referencesM groups: batches, inserts, deletes, tree metadata and references.M groups: batches, inserts, deletes, tree metadata and references.audit:2026-09Reconciled September 2026 GroveDB audit; audited worktree at 2fa0f133.Reconciled September 2026 GroveDB audit; audited worktree at 2fa0f133.audit:historicalAudited behavior has a known later fix or intentional legacy compatibility constraint.Audited behavior has a known later fix or intentional legacy compatibility constraint.audit:needs-validationSaved source evidence reviewed; focused runtime and deployment validation outstanding.Saved source evidence reviewed; focused runtime and deployment validation outstanding.bugSomething isn't workingSomething isn't workingseverity:medium-provisionalMedium impact in the audited scenario; provisional static assessment.Medium impact in the audited scenario; provisional static assessment.type:correctnessAudit reports incorrect library behavior or accounting without proven security impact.Audit reports incorrect library behavior or accounting without proven security impact.
Description
Activity
Metadata
Metadata
Assignees
Labels
area:mutations-referencesM groups: batches, inserts, deletes, tree metadata and references.M groups: batches, inserts, deletes, tree metadata and references.audit:2026-09Reconciled September 2026 GroveDB audit; audited worktree at 2fa0f133.Reconciled September 2026 GroveDB audit; audited worktree at 2fa0f133.audit:historicalAudited behavior has a known later fix or intentional legacy compatibility constraint.Audited behavior has a known later fix or intentional legacy compatibility constraint.audit:needs-validationSaved source evidence reviewed; focused runtime and deployment validation outstanding.Saved source evidence reviewed; focused runtime and deployment validation outstanding.bugSomething isn't workingSomething isn't workingseverity:medium-provisionalMedium impact in the audited scenario; provisional static assessment.Medium impact in the audited scenario; provisional static assessment.type:correctnessAudit reports incorrect library behavior or accounting without proven security impact.Audit reports incorrect library behavior or accounting without proven security impact.
Created from a Codex audit of grovedb. No code changes were made as part of the audit.
Summary
Direct delete of a non-empty child tree can reopen the parent path using the child tree’s
tree_type.Impact / failure scenario
Deleting under
CountTree/sum/count-sum parents withallow_deleting_non_empty_trees=truecan propagate aggregate/root metadata incorrectly.References
grovedb/src/operations/delete/mod.rs:740grovedb/src/operations/delete/mod.rs:750grovedb/src/operations/delete/mod.rs:847grovedb/src/operations/delete/mod.rs:880Suggested fix
Reopen with the parent’s saved tree type or reuse the already-open parent subtree handle.
Suggested tests
Delete a non-empty child under an aggregate parent, then verify aggregate count/sum and
verify_grovedb.September 2026 audit addendum — M014
Audit group: M014. Classification: correctness. Provisional severity: medium.
The reviewed snapshot's populated-child deletion reopens the parent as a layered Merk using the deleted child's tree type. Besides the known link-hash/type problem, this can lose base-root pointer maintenance. Empty-child deletion retains the original parent and avoids this route. This is an addendum to the existing #686 root cause. GitHub metadata marks #732 merged; its description reuses the parent under V4 and deliberately preserves V1-V3 behavior. The audit does not establish that the described V4 fix is incomplete, nor that current develop remains affected.
Expected behavior: Deleting a populated child must retain the parent's actual Merk mode and tree type, including base-root pointer maintenance.
Fix direction: Reuse the already opened parent or reopen it through the canonical parent-path helper preserving both MerkType and TreeType. Cover surviving siblings at the base root and nested parent/child type differences. Version persistent root changes where replay compatibility requires it.
Validation to complete
Limits and existing work
Related tracking: issue #686 (closed), PR #732 (merged).
Scope: saved GroveDB worktree with revision context
2fa0f133877420a0d9c91ba7bc51b1775ab8c783. This report does not establish that currentdevelopor any deployed application is affected. Focused runtime validation remains outstanding.Audit source and canonical finding identifiers
Source status: snapshot-backed (
git_worktree); plain source locations are used because this is not a sealed commit-only scan.Audited revision context:
2fa0f133877420a0d9c91ba7bc51b1775ab8c783.The findings were manually reconciled from a preserved scan bundle. The native scan ended before final completion; these are provisional source-review findings, not a completed native scan certification.
Canonical finding ID:
csf_c5080c5878555bc3a3cec243Primary fingerprint:
codex-security/v1:sha256:d37e73c26ac0cfc0fcdfe1f1f9fa515bcd4f1c2be28438f0a0a262a98af5c4d3Source locations:
grovedb/src/operations/delete/mod.rs:973-987grovedb/src/operations/delete/mod.rs:1011-1019merk/src/merk/mod.rs:369-381merk/src/tree/mod.rs:704-724grovedb/src/operations/delete/mod.rs:755-795grovedb/src/operations/delete/mod.rs:950-1040merk/src/merk/open.rs:70-95merk/src/merk/mod.rs:235-283merk/src/merk/mod.rs:399-450merk/src/merk/mod.rs:582-625grovedb/src/lib.rs:675-744merk/src/tree/mod.rs:698-750