OUT-4093: Guard localStorage migration when third-party storage is denied - #1407
OUT-4093: Guard localStorage migration when third-party storage is denied#1407cursor[bot] wants to merge 1 commit into
Conversation
…nied migrateAssignees() was the only assignee-cache path still reading localStorage without checking document.hasStorageAccess(). In the embedded Copilot iframe this throws SecurityError and surfaces in Sentry when third-party cookies/storage are blocked. Extract hasAssigneeStorageAccess() shared by get/set/migrate helpers, skip migration when access is denied, and wrap localStorage calls in try/catch. Also stop calling requestStorageAccess() on mount since it requires a user gesture and cannot succeed during AssigneeCacheGetter initialization. Co-authored-by: Neil Raina <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Closing in favour of #1434, which removes #1434 also drops the |
Changes
hasAssigneeStorageAccess()helper shared by assignee cache read/write/migrate paths.migrateAssignees()with storage-access check and try/catch aroundlocalStoragecalls — this was the only remaining unguardedlocalStorageusage and the source of the SentrySecurityError.requestStorageAccess()on mount (requires user gesture; cannot succeed duringAssigneeCacheGetterinitialization).Testing Criteria
yarn test src/app/_cache/forageStorage.test.ts— all 3 tests pass.Notes
migrateAssignees()calledlocalStorage.getItem()without checkingdocument.hasStorageAccess(), throwingSecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.getAssignees/setAssigneesalready had guards (OUT-2694 / OUT-2750); migration path was missed when localStorage was replaced with localForage (OUT-2348).Impact & Surface Area of Change
AssigneeCacheGetter,AssigneesFetcher).