Repository navigation
Keep API responses out of the service worker cache and Sentry - #3863
innolope-dev wants to merge 4 commits into
Conversation
The app calls the API origin directly, so serwist's default cross-origin rule stored every API GET (/users/me, the KYC questions with the saved tax number and address, the KYC details and plan) in the "cross-origin" cache for an hour, ignoring no-store, and kept it past sign-out. Only Sumsub may hold personal data; the device must not. - Every request to the configured API base URL is now NetworkOnly, ahead of the default rules. The base URL moves to an import-free module so the worker can read it without bundling general.consts. - On activation the worker deletes API entries an older worker stored. - Sign-out also purges the "cross-origin" cache.
Failed calls attach their request and response bodies to Sentry. The key scrubber missed the bare keys the profile and KYC answers use (phone, street, town, nationality, citizenship, countryOfBirth, cityOfBirth), and the profile and identity endpoints were not redacted wholesale. Add the keys, and redact /update-user, /users/identity (and its children, which include restart) and /users/residence-change/start entirely.
The worker bundle has never carried a process polyfill, so reading PEANUT_API_URL there could throw at load and leave the app without a worker. Every fetch or XHR to another origin is an API call; keep those out of the cache and leave images, fonts and scripts to the default rules. On activation, drop serwist's cross-origin cache, where older workers kept API responses.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Code-analysis diffPainscore total: 10579.15 → 10581.49 (+2.34) 🆕 New findings (11)
✅ Resolved (11)
📈 Painscore deltas (top movers)
|
There was a problem hiding this comment.
Chip review — no blocking findings — this is not an approval
No findings in the service-worker cache and Sentry privacy changes.
Checked clean
- Cross-origin fetch/XHR route precedes Serwist default caching; same-origin and asset routes retain their intended handling.
- Serwist 9.5.0 uses the literal cross-origin name for this explicitly named cache, so activation and logout target the existing cache.
- Sentry endpoint-wide redaction and recursive key scrubbing cover the changed profile and identity paths.
- CI checks at this head were still in progress when reviewed; completed relevant checks had no failures.
Security review by moonshotai/kimi-k3: 0 finding(s), marked with the model name. It reads the diff only and answers only security, privacy and money, so treat its findings as advice.
Third opinion by claude-opus: 0 finding(s), marked with the model name. It answers only product truth, missing tests and the cross-repo contract, so treat its findings as advice.
Exact head: 622d1c1d96ac · Context: repo · Took 5m
🧪 UI test report — ✅ all greenSuites
📊 Coverage (unit)
⏱ 10 slowest test cases
|
Keeps personal data out of the browser: API responses no longer land in the service worker's caches, and profile and identity saves are redacted from Sentry.
Why
GET /users/kyc/questionspre-fills saved answers, and/users/mereturns profile data. serwist's default cross-origin rule cached every cross-origin GET for an hour (NetworkFirst, ignoringno-store), in a cache that sign-out didn't clear. On a shared computer, the next person could read the previous user's address or tax number from the browser's storage. Found in the KYC rework consistency review (finding #6).What changes
src/app/sw.ts,src/app/sw-api-privacy.ts)processpolyfill, so reading an env var there could throw at load.cross-origincache, where older workers kept API responses.cross-origincache along with the other user-data caches (src/constants/cache.consts.ts)./update-user,/users/identityand/users/residence-change/startare dropped. Nationality, citizenship, birth place, street, town and phone keys are scrubbed (src/utils/sentry.utils.ts).Tests
src/app/__tests__/sw-api-privacy.test.ts.src/context/__tests__/authContext-logout.test.tsx,src/utils/__tests__/sentry.utils.test.ts.