Skip to content

fix(api): require channel membership to mark a channel read#182

Closed
devitway wants to merge 1 commit into
mainfrom
fix/mark-read-requires-membership
Closed

fix(api): require channel membership to mark a channel read#182
devitway wants to merge 1 commit into
mainfrom
fix/mark-read-requires-membership

Conversation

@devitway

Copy link
Copy Markdown
Contributor

markChannelRead wrote a per-user read cursor for an arbitrary channelID (and probed the latest message id via ChannelMessages) without checking that the caller is subscribed — unlike every sibling channel handler (messages, info, readers, ack, send), which gate on IsSubscribed.

Add the same 403 guard so a non-member cannot write read-state for, or probe the latest message id of, a channel they are not in. Extends TestChannelRead_RequiresMembership with the mark-read endpoint.

markChannelRead wrote a per-user read cursor for an arbitrary channelID
(and probed the latest message id via ChannelMessages) without checking
that the caller is subscribed — unlike every sibling channel handler
(messages, info, readers, ack, send), which gate on IsSubscribed. Add
the same 403 guard so a non-member cannot write read-state for, or probe
the latest message id of, a channel they are not in.

Extend TestChannelRead_RequiresMembership with the mark-read endpoint.
@devitway

Copy link
Copy Markdown
Contributor Author

Closing — this change is incorrect. Leaving markChannelRead open to non-subscribers is by design: feature #101 ("unread badge for unsubscribed channels") relies on an unsubscribed member being able to clear their unread badge via mark-read. The 403 guard breaks tests/e2e/unread-unsubscribed.spec.js. Channel content (messages/info/readers/ack) stays subscription-gated, so there is no leak. The contract registry (#183) is updated to document this and guard against re-adding the guard.

@devitway devitway closed this Jun 16, 2026
@devitway devitway deleted the fix/mark-read-requires-membership branch June 16, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant