Security audit and fix for InsightsRepo to prevent cross-user data leakage.
M2-001 — searchByEmbedding: Confirmed already user-scoped via WHERE user_id filter. No change needed.
M2-002 — findByUser: Confirmed already user-scoped. No change needed.
M2-002 — decayOldInsights: Was global (no userId filter). Fixed by requiring userId param and scoping to eq(insights.userId, userId). Added decayAllInsights for system cron tier-management.
Additional fixes found during audit:
findById: added userId param + AND eq(userId) to prevent cross-user read
update: added userId param + AND eq(userId) to prevent cross-user write
remove: added userId param + AND eq(userId) to prevent cross-user delete
memory.controller getInsight/removeInsight: now pass user.id for ownership
summarization.service: switched cron to decayAllInsights
Test plan
typecheck passes
lint passes
format:check passes
GET /api/memory/insights/:id returns 404 for another user's insight
DELETE /api/memory/insights/:id returns 404 for another user's insight
## Summary
Security audit and fix for InsightsRepo to prevent cross-user data leakage.
**M2-001 — searchByEmbedding**: Confirmed already user-scoped via WHERE user_id filter. No change needed.
**M2-002 — findByUser**: Confirmed already user-scoped. No change needed.
**M2-002 — decayOldInsights**: Was global (no userId filter). Fixed by requiring userId param and scoping to eq(insights.userId, userId). Added decayAllInsights for system cron tier-management.
**Additional fixes found during audit:**
- findById: added userId param + AND eq(userId) to prevent cross-user read
- update: added userId param + AND eq(userId) to prevent cross-user write
- remove: added userId param + AND eq(userId) to prevent cross-user delete
- memory.controller getInsight/removeInsight: now pass user.id for ownership
- summarization.service: switched cron to decayAllInsights
## Test plan
- [x] typecheck passes
- [x] lint passes
- [x] format:check passes
- [ ] GET /api/memory/insights/:id returns 404 for another user's insight
- [ ] DELETE /api/memory/insights/:id returns 404 for another user's insight
Security audit findings and fixes:
M2-001 — searchByEmbedding: confirmed already user-scoped via WHERE user_id
M2-002 — findByUser: confirmed already user-scoped
M2-002 — decayOldInsights: was global (no userId filter); now requires userId
param and scopes UPDATE to eq(insights.userId, userId). Added decayAllInsights
as a separate system-only method for cron tier management.
Additional unscoped operations fixed:
- findById: added userId param + AND eq(userId) to prevent cross-user read
- update: added userId param + AND eq(userId) to prevent cross-user write
- remove: added userId param + AND eq(userId) to prevent cross-user delete
- memory.controller getInsight/removeInsight: now pass user.id for ownership
- summarization.service: switched tier-management cron to decayAllInsights
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Security audit and fix for InsightsRepo to prevent cross-user data leakage.
M2-001 — searchByEmbedding: Confirmed already user-scoped via WHERE user_id filter. No change needed.
M2-002 — findByUser: Confirmed already user-scoped. No change needed.
M2-002 — decayOldInsights: Was global (no userId filter). Fixed by requiring userId param and scoping to eq(insights.userId, userId). Added decayAllInsights for system cron tier-management.
Additional fixes found during audit:
Test plan