Skill Details
Runtime
(gpt-5.5)
Example user message
[userMessage]: Our Next.js SaaS sometimes shows one organization another organization’s dashboard totals. Find and repair the cache leak.
Example agent response
Project Detected:
Next.js TypeScript SaaS using PostgreSQL, Prisma, Redis, and organization-based tenancy
---
Cache Path Reviewed:
- Value: Organization dashboard summary containing active users, subscriptions, and monthly revenue
- Read path: Dashboard server component through dashboardCache.getSummary()
- Write or invalidation path: Subscription and user services publish incomplete invalidation events
---
Isolation Risk Found:
- Dashboard summaries are cached only by reporting period, allowing organizations requesting the same month to share one entry
- Affected boundary: Organization tenant
---
Unsafe Key:
dashboard:summary:2027-04
---
Safe Key Contract:
- Namespace: dashboard:summary
- Tenant scope: Verified organization ID from server-side membership context
- Additional dimensions: Reporting period and reporting currency
- Versioning: Per-organization dashboard namespace version
---
Repair Applied:
- Replaced route-level key construction with one canonical dashboard key builder
- Added organization scope, reporting period, currency, and namespace version
- Added server-side membership validation before every cache read
- Added organization-scoped invalidation after user and subscription changes
---
Files Modified:
- src/cache/dashboardKeys.ts
- src/cache/dashboardCache.ts
- src/services/dashboardService.ts
- src/services/subscriptionService.ts
- src/services/userService.ts
- tests/dashboardCacheIsolation.test.ts
---
Commands Executed:
- npm run typecheck
- npm test -- tests/dashboardCacheIsolation.test.ts
- npm run build
---
Isolation Test:
- Tenant A result: Returned only organization A dashboard values
- Tenant B result: Returned only organization B dashboard values
- Cross-tenant leakage: 0 across 200 alternating cached requests
---
Invalidation Test:
- Mutation: Added a subscription to organization A
- Stale reads after mutation: 0
- Refreshed value: Organization A subscription total increased while organization B remained unchanged
---
Concurrent Miss Test:
- Concurrent requests: 50 requests for one organization summary
- Authoritative reads: 1
- Result: The remaining requests reused the same tenant-scoped computed value
---
Validation Result:
Type checking, 24 cache-isolation tests, concurrent miss tests, and the production build completed successfully using isolated Redis and PostgreSQL services.
---
Remaining Risks:
- The CDN configuration was not present in the project and requires separate review to confirm authenticated dashboard routes cannot be cached publicly
Get this skill + 9 more with Select$14 your first month, then $19/mo$14 first month, then $19/mo
View SelectBy purchasing this skill, you agree to our terms of service
GPT-5.5
Repair cache bugs that expose one customer’s data to another tenant or return stale results after writes.
This skill traces cache keys, scopes, invalidation, and fallback paths. It adds tenant-safe key construction, precise invalidation, namespace versioning, stampede protection, and isolation tests.
✔ Prevent cross-tenant data leaks
✔ Fix stale reads after updates
✔ Detect unsafe shared keys
✔ Test concurrent cache behavior
Ideal for SaaS, APIs, and multi-tenant platforms.
...more
Added over 1 month ago
