fix: consistent case-insensitive email check in GET /projects/:projectId
From the PR description
Summary
GET /projects/:projectIdwas using a case-sensitiveArray.includes()to checkshared_with, while every other access check is case-insensitive; this denied access to legitimate shared users whose stored email had different casingGET /projectslist query was using the raw (un-normalized) user email in theshared_withcontains filter, also causing missed results for mixed-case emailsPOST /projectswas storingshared_withemails without normalization; PATCH already normalized - now both are consistent- Extracted
normalizeSharedWithandemailInSharedWithhelpers to a newprojectAccess.tsmodule for reuse and testability
Closes #70 Closes #85 Closes #93
Changes
backend/src/lib/projectAccess.ts- newnormalizeSharedWithandemailInSharedWithhelpersbackend/src/routes/projects.ts- GET list query uses normalized email; GET access check usesemailInSharedWith; POST normalizesshared_withvianormalizeSharedWithbackend/src/lib/__tests__/projectEmailNormalization.test.ts- 8 unit tests
Test plan
- Unit tests: lowercase, dedup, drop empties, case-insensitive lookup, null/undefined email
- Build and typecheck pass
Our analysis
Normalize shared_with email casing across project access — read the full analysis →
Think the analysis missed something the PR description covers?
Capture this PR into my fork
Download a Markdown prompt that tells Claude how to port every
commit in this PR into your working tree. Run it via
claude -p < capture-pull-79.md from
inside the repo you want the changes in.