Updated Analytics#67
Conversation
- Update @renderdragonorg/wisp from 0.1.1 to 0.2.0 - Replace custom fetch transport with built-in wispSecret config option - Add bindSupabase() to auto-link auth state and enrich machine records with user email, name, and auth provider - Add userEmail, userName, authProvider fields to machines Convex schema - Handle session_identify events in analytics ingestion pipeline - Surface enriched user fields in dashboard queries (machine stats, page visitors, machine search) - Remove manual wisp.identify/reset from AuthProvider (now handled by bindSupabase)
|
@Coder-soft is attempting to deploy a commit to the yamura3's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Warning Review limit reached
Next review available in: 24 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (9)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR upgrades Wisp and connects it to Supabase-backed identity enrichment.
Confidence Score: 2/5This PR is not safe to merge until the public PII exposure and cross-machine identity attribution are fixed. The changed queries disclose newly collected user profile data without authorization, while the ingestion path can persist that profile against unrelated machines when a batch contains multiple machine or identity contexts. Files Needing Attention: convex/dashboard.ts and convex/events.ts
|
| Filename | Overview |
|---|---|
| convex/events.ts | Adds identity persistence, but scopes the first identify payload to the whole batch rather than its originating machine. |
| convex/dashboard.ts | Exposes newly stored PII from public queries without an authorization boundary. |
| convex/schema.ts | Adds optional profile fields required by the analytics enrichment flow. |
| src/main.tsx | Migrates Wisp initialization to version 0.2.0 and binds the Supabase client. |
| src/providers/AuthProvider.tsx | Removes manual Wisp identity lifecycle handling in favor of the new binding. |
| package.json | Upgrades the Wisp dependency from 0.1.1 to 0.2.0. |
Sequence Diagram
sequenceDiagram
participant U as Signed-in user
participant W as Wisp client
participant I as Convex ingestion
participant M as Machine records
participant Q as Public dashboard query
participant C as Arbitrary caller
U->>W: Supabase profile
W->>I: Batch with session_identify
I->>M: Store email/name/provider
C->>Q: Query visitors or machine
Q->>M: Read enriched record
M-->>Q: Profile fields
Q-->>C: Email/name/provider
Reviews (1): Last reviewed commit: "feat: integrate wisp analytics with Supa..." | Re-trigger Greptile
| country: machine?.country ?? null, | ||
| platform: machine?.platform ?? null, | ||
| userAgent: machine?.userAgent ?? null, | ||
| userEmail: machine?.userEmail ?? null, | ||
| userName: machine?.userName ?? null, | ||
| authProvider: machine?.authProvider ?? null, |
There was a problem hiding this comment.
Public queries expose user identities
When an unauthenticated client calls getPageVisitors, this public query returns each visitor's email, name, and authentication provider without checking ctx.auth, causing authenticated users' profile data to be disclosed to arbitrary callers. The same fields are also exposed by the unguarded getMachineStats and searchMachines queries. How this was verified: The exported queries return the persisted profile fields directly and contain no authorization or ownership check.
| const userInfo = extractUserInfo(sorted); | ||
|
|
||
| for (const event of sorted) { | ||
| const isBookkeeping = event.name === "session_start"; | ||
| const isBookkeeping = event.name === "session_start" || event.name === "session_identify"; | ||
|
|
||
| await upsertMachine(ctx, { | ||
| machineId: event.machineId, | ||
| userId: event.userId, | ||
| timestamp: event.timestamp, | ||
| meta: isBookkeeping ? event.payload : undefined, | ||
| userInfo, | ||
| }); |
There was a problem hiding this comment.
Batch-wide identity contaminates machines
When a batch contains a session_identify event and events for another machine, extractUserInfo selects the first identity once and passes it to every upsertMachine call, causing the other machine to be stored and displayed with the wrong user's email, name, and authentication provider. Batches accept independently specified machine IDs without enforcing a single-machine invariant, and the geo ingestion path repeats this behavior. How this was verified: The batch validator permits different machine IDs while both handlers reuse one extracted profile across every event's machine upsert.
- Scope session_identify enrichment to the originating machine only, preventing cross-machine PII attribution (buildUserInfoMap) - Gate PII fields (userEmail, userName, authProvider) in all dashboard queries behind ctx.auth.getUserIdentity() check - Add pii() helper to consistently null out PII for unauthenticated callers
No description provided.