Scope the inbox issue lookups to one workspace - #254
Conversation
The two batch resolvers behind list_notifications read raw comment and issue rows by primary key. Nothing upstream checks them: getIssue's policy check guards the issues.ts path, not this one. So an account removed from a team keeps its old notifications, and those rows went on resolving fresh issue titles that getIssue would refuse. Both tables carry organization_id, so both lookups now carry the predicate. The "filters by type" test asserted nothing. No assignment ever happened in that fixture, so the array came back empty and every() was trivially true. It now creates an issue_assigned notification, asserts the filtered page is not empty, asserts that notification comes back, and asserts the mention does not while still being there unfiltered.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 40 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
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. Comment |
Follow-up to #244. These two changes were reviewed and written as part of that work but were left out of the merge: the commit existed locally and was never pushed, so #244 merged the state before it. This lands them.
Scope the batch resolvers
list_notificationsresolves each row's issue in two batched lookups, and neither was scoped to the caller's workspace. They relied on the invariant that a notification and its entity are written together with the same organization, which does hold, so this was never a cross-workspace leak.It is still wrong. The comparable resolver in
issues.tsruns downstream ofgetIssue, which has already applied the org and policy checks; these run on raw notification rows with no check at all, and they return the issue's current title. So an account removed from a team still resolves fresh titles for its old notifications, whichget_issuewould refuse. Both tables carryorganization_id, so the predicate is two lines.Make the type-filter test real
The existing test asserted over an array that was always empty: nothing in the fixture ever produced a second notification type, so
[].every(...)passed trivially and the filter was never exercised. It now creates an assigned issue so a differently-typed notification exists, and asserts both that the filtered type comes back and that the other one does not.Greptile Summary
The PR scopes notification issue and comment resolution to the caller’s workspace and strengthens the notification type-filter test.
Confidence Score: 5/5
The PR appears safe to merge with no actionable correctness, security, or test-reliability issues identified.
The new predicates align with existing non-null organization relationships and notification scoping, while the revised test synchronously creates and meaningfully distinguishes both notification types.
Important Files Changed
Reviews (1): Last reviewed commit: "fix(mcp): scope the inbox issue lookups ..." | Re-trigger Greptile