feat: session deletion#4154
Conversation
|
@cabaucom376 is attempting to deploy a commit to the Umami Software Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR implements session deletion, adding a DELETE API endpoint backed by a Prisma transaction that cascades through all related tables ( All three security concerns raised in previous review rounds have been addressed: the ClickHouse guard now runs after the permission check, the final Confidence Score: 5/5Safe to merge — all prior security findings are resolved and no new issues found. All three previously flagged security issues (ClickHouse guard order, missing websiteId constraint, and missing ownership check) have been corrected. The transaction correctly cascades deletes across every related table in the right order, the route handler enforces auth before any logic, and the UI properly hides the delete button on share pages. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant UI as SessionProfile
participant API as Route Handler
participant DB as Prisma Transaction
User->>UI: Click trash, confirm dialog
UI->>API: DELETE request with websiteId + sessionId
API->>API: parseRequest auth
API->>API: canDeleteWebsite check
Note over API: returns 401 if not authorized
API->>API: CLICKHOUSE_URL check
Note over API: returns 400 if ClickHouse
API->>DB: findSession(websiteId, sessionId)
Note over DB: returns 404 if not found
API->>DB: deleteSession in transaction
DB->>DB: delete SessionReplaySaved by visitId
DB->>DB: delete SessionReplay
DB->>DB: delete Revenue
DB->>DB: delete EventData by eventId
DB->>DB: delete WebsiteEvent
DB->>DB: delete SessionData
DB->>DB: delete Session (id + websiteId)
API-->>UI: 200 OK
UI->>UI: invalidate cache, close, redirect
Reviews (3): Last reviewed commit: "clean" | Re-trigger Greptile |
|
@mikecao @franciscao633 what would you guys like to see from this to get it merged? |
Implements a simple button on a session profile to delete the session record and remove its associated data.
closes: #2940
Delete Session Flow
1. Beginning state
2. Trigger delete
3. Confirm deletion
4. Result