Fix excessive prefix-matching work in workspace backup preview and restore#188

open1
main
coderabbit/fix-backup-reference-dos/134224e6
opened1h agobyCcoderabbitaiBot
View on GitHubTwo-way sync enabledPR last imported 1h ago

Summary

Problem: Colon-heavy mail references cause repeated prefix slicing and lookup during backup preview and restore.

Result: Use a compressed prefix tree to scan each reference once while preserving the first listed matching account. Add synthetic regression coverage for overlapping account IDs, reordered accounts, Unicode, unknown references and colon-heavy references across typed fields.

Changelog: Update CHANGELOG.md with the security improvement and docs/KB.md with prefix-matching behavior and bounds.

Evidence

  • Before: The pinned base scans every colon and slices each candidate prefix. After: The candidate traverses compressed prefix edges and retains the earliest matching account index. Runtime behavior remains unverified.
Verification

Validation was not run; evidence is limited to inspection of the pinned diff.

  • Application tests and build pass; pending: npm test, npm run build and focused workspace-backup tests through the required bounded runner.
  • Privacy review completed.
  • Documentation describing the changed behavior is updated.
Ownership and scope
  • Task owner: Unspecified.
  • Delivery owner: Unspecified; metadata preparation only.
  • Owned paths: server/workspace-backup.ts, server/workspace-backup.test.ts, CHANGELOG.md, docs/KB.md.
  • Base: 7b5e787b1ea3675726f43788401ca1f88be90ed0; feature branch unspecified for this pinned candidate.
  • Immediate parent and dependencies: None; standalone PR.
  • Related issue or pull request: Not supplied.
  • Coordination search and owner confirmation: Not performed.
Review
  • Independent reviewer: Pending.
  • Base and original HEAD: 7b5e787b1ea3675726f43788401ca1f88be90ed0.
  • Candidate tree: 34383be7e7167d3d008d1ca78c11fd89148ee4ad.
  • Complete diff inspected: Base to candidate tree; specified commit range is empty.
  • Verification receipts: None.
  • Latest-target reconciliation, required checks and approvals: Pending.
  • Blocking feedback: Unknown.
  • Installed and live-account behavior: Unverified.

Merge risk

Rollback: Revert the prefix-tree implementation, tests and documentation. Reverting code cannot undo records already restored.

Affected scope: Account-prefixed reference remapping during workspace backup preview and import, including projects, commitments, rules, proposals and mail state. Incorrect matching could associate restored references with the wrong account.

View coding task


View with [code]smith Autofix with [code]smith Need help on this PR? Tag @codesmith-bot with what you need.

Checks

6 successful · 1 skipped
All checks passed
b5d5d16

Added 1 commit

  • fix: Bound workspace backup mail-reference prefix matchingb5d5d16
Synced from GitHub

Important

Review skipped

This PR was authored by the user configured for CodeRabbit reviews. CodeRabbit does not review PRs authored by this user. It's recommended to use a dedicated user account to post CodeRabbit review feedback.

External image Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d39268a5-6e92-4c82-a25a-45a336ea3cb5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts