fix(memory): scope InsightsRepo operations to userId — M2-001/002 #290
Reference in New Issue
Block a user
Delete Branch "fix/m2-insights-user-scope"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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