Skip to content

Fix data loss risks and multi-byte panic - #45

Merged
rendro merged 1 commit into
mainfrom
fix/p0-safety-and-panic-risk
Feb 7, 2026
Merged

rendro merged 1 commit into
mainfrom
fix/p0-safety-and-panic-risk

Conversation

@rendro

@rendro rendro commented Feb 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Consolidation merge data loss: Abort merge if supersedes edge creation fails — without lineage, deleted content is irrecoverable
  • Stdin drain DoS: Cap drain loop at 100MB to prevent indefinite blocking from malicious input without newlines
  • Non-atomic delete ordering: Delete item first, then chunks best-effort. Orphaned chunks are benign (found only via item_id join); an is_chunked=true item with no chunks produces incorrect results
  • Multi-byte panic in chunker: Snap overlap fallback offset forward past UTF-8 continuation bytes to prevent text[pos..] panic on CJK/emoji content

Test plan

  • All 77 tests pass
  • cargo clippy -- -D warnings clean
  • cargo fmt --check clean

…ulti-byte overlap

- Abort consolidation merge if supersedes edge creation fails, preventing
  irrecoverable content deletion without lineage preservation
- Cap stdin drain loop at 100MB to prevent indefinite blocking from
  malicious clients that never send a newline
- Reverse delete_item order: delete item first, then chunks best-effort.
  Orphaned chunks are benign; an is_chunked item with no chunks is not.
- Snap overlap byte offset to valid UTF-8 char boundary to prevent panic
  on content with long runs of multi-byte characters (CJK, emoji)
@rendro
rendro merged commit f9390b6 into main Feb 7, 2026
2 checks passed
@rendro
rendro deleted the fix/p0-safety-and-panic-risk branch February 7, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant