Skip to content

📝 Document how to stop clients spoofing op src - #754

Open
alecgibson wants to merge 1 commit into
mainfrom
worktree-glittery-dazzling-kahan
Open

alecgibson wants to merge 1 commit into
mainfrom
worktree-glittery-dazzling-kahan

Conversation

@alecgibson

Copy link
Copy Markdown
Collaborator

Fixes #733

At the moment, a client can submit an op with another client's src and next seq, and the server will then drop that client's real op as a duplicate, while still acking it.

We can't enforce ownership of src in the library without a protocol change, since the handshake id is also chosen by the client. Instead, this change documents that src is client-chosen, and adds a middleware recipe that scopes it to the authenticated user.

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

Fixes #733

At the moment, a client can submit an op with another client's `src`
and next `seq`, and the server will then drop that client's real op as
a duplicate, while still acking it.

We can't enforce ownership of `src` in the library without a protocol
change, since the handshake `id` is also chosen by the client. Instead,
this change documents that `src` is client-chosen, and adds a
middleware recipe that scopes it to the authenticated user.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 97.851%. remained the same — worktree-glittery-dazzling-kahan into main

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The documentation and tests consistently implement the intended authenticated-user scoping mitigation.

0 open findings

What changed in this PR

Documents how to prevent cross-user operation-source spoofing through middleware.

Changes:

  • Adds a user-scoped src validation recipe and security warnings.
  • Documents configurable Agent.clientId.
  • Adds tests for ID assignment, reclamation, and spoof rejection.
File Description
docs/​middleware/​op-submission.md Documents the mitigation recipe.
docs/​api/​agent.md Documents clientId customization.
test/​middleware.js Tests source restriction behavior.
lib/​agent.js Updates the src lifecycle comment.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@alecgibson
alecgibson marked this pull request as ready for review October 13, 2026 16:15

This branch has not been deployed

No deployments
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.

A client can spoof another client's op src/seq to silently drop its edits

3 participants