fix(channels): keep foreign canvases out of me - #3888
Conversation
Generated-By: PostHog Code Task-Id: d8debcda-8a0a-4287-a5aa-ee0f5f6ce8d9
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
isOwnedBy now compares the stable authorUuid uniformly for both canvases and tasks, instead of a separate authorUser branch for tasks. authorUser becomes a display-only field; display-name matching stays as a fallback for rows with no creator uuid. Removes the canvas/task ownership asymmetry with no behavior or UI change. Generated-By: PostHog Code Task-Id: e9aaba50-9b88-43d5-8a62-dd7adf4c76f1
Deciding ownership of the private #me space by display-name equality could leak canvases between two users who share a name. Ownership now requires a stable creator uuid match; items without one fail closed. authorName stays for display only. Adds a regression test that a name match alone never grants ownership. Generated-By: PostHog Code Task-Id: e9aaba50-9b88-43d5-8a62-dd7adf4c76f1
The personal-channel hook test relied on name-based ownership, which no longer grants membership; give the viewer's canvas a matching creator uuid. Generated-By: PostHog Code Task-Id: e9aaba50-9b88-43d5-8a62-dd7adf4c76f1
|
Reviewed on the assumption that PostHog/posthog#74282 lands first (checked it: Direction is right — a display name isn't an identity, and gating
|
Addresses review feedback on uuid-only ownership: - filterChannelItems: an item with no creator uuid (the backend sends created_by: null once a creator is deleted) is unknown, not "someone else", so exclude it from both the "me" and "others" buckets. - Drop the now-unused ChannelItemOwner.name; isOwnedBy was its only reader, so nothing can rewire name matching by accident. - Gate #me on meUuid alone, since a display name never established identity. No behavior change, but the condition no longer encodes the premise this PR removed. - Cover the created_by: null mapping at the service level, which is the fail-closed path. Generated-By: PostHog Code Task-Id: e9aaba50-9b88-43d5-8a62-dd7adf4c76f1
Problem
The personal
#mespace classifies canvases with missing creator metadata as owned by the viewer, allowing foreign legacy canvases to appear there.Changes
authorUuid), uniformly for canvases and tasks.#mespace could leak canvases between two users with the same name.#me.authorName/authorUserare kept for display only.Depends on PostHog/posthog#74282 for creator UUIDs in file-system responses. Safe to merge first: until it lands, uuid-less canvases fail closed (they're excluded from
#merather than mis-attributed).How did you test this?
pnpm --filter @posthog/core exec vitest run src/canvas/channelItems.test.ts src/canvas/dashboardsService.test.tspnpm --filter @posthog/core typecheckpnpm --filter @posthog/ui typecheckpnpm buildAutomatic notifications
Created with PostHog Code