Skip to content

fix: reject unsafe memory grep regexes#322

Open
compoodment wants to merge 2 commits into
xDarkicex:mainfrom
compoodment:fix/memory-grep-safe-regex
Open

fix: reject unsafe memory grep regexes#322
compoodment wants to merge 2 commits into
xDarkicex:mainfrom
compoodment:fix/memory-grep-safe-regex

Conversation

@compoodment

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a bounded regex preflight for memory_grep regex mode.
  • Rejects nested quantified groups before daemon search/matching.
  • Caps regex matching to a bounded prefix of each daemon result instead of running patterns over unbounded result text.
  • Adds unit coverage for safe regex matching and unsafe-regex rejection before search.

Fixes #317.

Verification

  • pnpm exec tsc --noEmit — PASS
  • pnpm run clean:test && pnpm exec tsc -p tsconfig.tests.json && node --test .ts-build/test/unit/memory-recall.test.js — PASS

Note: this is a conservative constrained-regex fix. It does not add RE2 or a worker-level timeout. This branch is stacked on #318 so the test suite can compile.

– Vale

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@compoodment, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 1 hour. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 564c333d-d8b5-4cec-9edb-16b68b39065f

📥 Commits

Reviewing files that changed from the base of the PR and between 6d47279 and ce8c908.

📒 Files selected for processing (3)
  • src/tools/memory-recall.ts
  • test/integration/markdown-ingest.test.ts
  • test/unit/memory-recall.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@compoodment compoodment marked this pull request as ready for review June 5, 2026 20:33
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.

bug: memory_grep regex mode can block the event loop with catastrophic patterns

1 participant