Skip to content

receipts: check the reader and thread of a federated receipt - #725

Open
basnijholt wants to merge 1 commit into
matrix-construct:mainfrom
mindroom-ai:upstream-federated-receipt-context
Open

basnijholt wants to merge 1 commit into
matrix-construct:mainfrom
mindroom-ai:upstream-federated-receipt-context

Conversation

@basnijholt

Copy link
Copy Markdown
Contributor

What does this PR do?

A federated m.receipt EDU was accepted when the reader's server matched the sending server. The reader's membership in the room was not checked, and a thread receipt's thread root was not resolved on the room's timeline, so receipts could be recorded for users not in the room.

The reader must now be a member of the room, and a thread root must be an event of that room's timeline. The room-scoped lookup is shared with private read markers. The receipt's position itself does not need to be known yet, since an EDU can arrive before the event it acknowledges.

Found through MindRoom. Fork changes: mindroom-ai/mindroom-tuwunel#66 and mindroom-ai/mindroom-tuwunel#101.

Tests:

  • rooms::read_receipt::tests::federated_receipts_check_the_reader_and_thread_not_the_position: a receipt from an ineligible reader is rejected, a thread root from another room is rejected, and a receipt for a not-yet-known position is accepted. It fails without the fix (the ineligible reader is accepted).

Validation:

  • Nightly rustfmt (nightly-2026-11-03): cargo fmt --all -- --check passes.
  • cargo clippy --offline --locked -p tuwunel_service -p tuwunel_api_client -p tuwunel_api_federation --all-targets --all-features -- -D warnings passes.
  • cargo test of those packages' libraries: 1,018 passed; cargo test -p tuwunel --test private_receipt_room --test receipt_replay --test thread_root_receipt pass.
  • Complement was not run.

Checklist

  • Code is formatted with nightly cargo fmt and satisfies clippy and rustc lints; any allowed lint is justified by an obvious reason or a comment.
  • Complement compliance changes (new passes or new failures), if any, are noted in the description above.
  • Config option changes were made in src/core/config/mod.rs doc comments and the regenerated tuwunel-example.toml is committed. (No config changes.)
  • User-facing changes are reflected in docs/. (No user-facing docs change.)
  • I agree that my changes may be licensed under the Apache-2.0 licence and my conduct is in line with the Contributor's Covenant and Tuwunel's Code of Conduct.

Check the membership of the reader, not just their server, and resolve
a thread root on the room timeline. Share the room-scoped position
lookup with private read markers. The receipt position itself need not
be available yet: an EDU can arrive before the event it acknowledges.

Assisted-by: MindRoom DevAgent:openai/gpt-6.2-astra <https://github.com/mindroom-ai/mindroom>

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.

1 participant