Repository navigation
🔒️ Only accept presence for the doc on its channel - #752
Draft
alecgibson wants to merge 1 commit into
Draft
alecgibson wants to merge 1 commit into
alecgibson wants to merge 1 commit into
Conversation
This was referenced Oct 6, 2026
There was a problem hiding this comment.
🟡 Changes recommended
Mismatched presence errors can bypass the client filter and reach another local presence with the same ID.
1 open finding
What changed in this PR
Hardens document presence channel validation and documents presence access-control responsibilities.
Changes:
- Validates document presence channels server-side and filters mismatched client updates.
- Adds security regression tests.
- Documents middleware-based access control and presence ID ownership.
| File | Description |
|---|---|
lib/agent.js |
Validates document presence channels. |
lib/client/presence/doc-presence.js |
Filters updates for other documents. |
test/client/presence/doc-presence.js |
Tests channel validation and filtering. |
docs/presence.md |
Adds access-control guidance. |
docs/middleware/actions.md |
Adds presence permission warnings. |
docs/api/presence.md |
Documents presence ID ownership. |
docs/api/backend.md |
Documents presence error-forwarding configuration. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
alecgibson
force-pushed
the
check-doc-presence-channel
branch
from
October 13, 2026 16:35
9014faf to
798c1f2
Compare
Fixes #738 At the moment, the server checks read access against a presence's `c` and `d`, but broadcasts it on its `ch`: 1. Deny `docs/secret` in `readSnapshots` 2. Send presence on `docs.secret` with the `c`/`d` of a readable doc 3. `docs/secret` subscribers apply it This change rejects doc presence whose `c` and `d` don't match its channel, and `DocPresence` ignores presence for any other doc, which also covers untyped presence and dotted-name channel collisions. Forwarded `sendPresence` errors no longer reach a local presence with the same ID either: unlike replies to the client's own submissions, they carry no `pv`. Subscribing, write access and presence ID ownership are left to middleware, which the new "Access control" docs cover. The server check only holds once every instance is upgraded, and the client filter only protects upgraded clients. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
alecgibson
force-pushed
the
check-doc-presence-channel
branch
from
October 13, 2026 16:50
798c1f2 to
0fb486e
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #738
At the moment, the server checks read access against a presence's
candd, but broadcasts it on itsch:docs/secretinreadSnapshotsdocs.secretwith thec/dof a readable docdocs/secretsubscribers apply itThis change rejects doc presence whose
candddon't match its channel, andDocPresenceignores presence for any other doc, which also covers untyped presence and dotted-name channel collisions. ForwardedsendPresenceerrors no longer reach a local presence with the same ID either: unlike replies to the client's own submissions, they carry nopv. Subscribing, write access and presence ID ownership are left to middleware, which the new "Access control" docs cover.The server check only holds once every instance is upgraded, and the client filter only protects upgraded clients.
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com