F21: the client — MLS 1:1, mailboxes, invites #14

Closed
mnovak wants to merge 0 commits from feature/client into main
Owner

F21 (#3, #6): the client: MLS 1:1 over OpenMLS 0.9, a mailbox per contact, and invites. Analysis: .agents/features/client.md. Review: .agents/reviews/feature-client.md.

Merging waits for Mark's approval of the new PROTOCOL.md section 4.

  • The invitee creates the MLS group itself, so it no longer replies with its own KeyPackage.
  • Its first reply goes to a welcome mailbox whose id and post token are derived from the link's secret with HKDF-SHA256.
  • Sections 5 and 8 (what the relay stores, and the routes) are unchanged.

OpenMLS check (#3):

  • Licences: MIT, Apache-2.0 or BSD across the tree, except hpke-rs, which is MPL-2.0. Amicitia must name its source in its licence notices.
  • No C code in the tree.
  • Builds for aarch64, x86_64 and armv7 Android.

Evidence:

  • 41 tests pass on Windows: client 10, protocol 14, relay 17.
  • The client's 10 tests also pass on the Android 15 emulator, including a run of the real relay on the device.
  • A byte search of the relay's database finds no message text, name or invite secret, while the invite waits, while messages wait, and after delivery.
  • 6 out of 6 planted bugs are caught: a name in the credential, plaintext beside the ciphertext, the payload in MLS's unencrypted data, junk shown as a message, no acknowledgement, and a second hello.
  • The welcome-mailbox derivation is pinned to a vector computed independently.

Not here: state across restarts (F22), the HTTP transport for apps (F22), block (F24), a real phone, iOS.

F21 (#3, #6): the client: MLS 1:1 over OpenMLS 0.9, a mailbox per contact, and invites. Analysis: `.agents/features/client.md`. Review: `.agents/reviews/feature-client.md`. **Merging waits for Mark's approval of the new PROTOCOL.md section 4.** - The invitee creates the MLS group itself, so it no longer replies with its own KeyPackage. - Its first reply goes to a welcome mailbox whose id and post token are derived from the link's secret with HKDF-SHA256. - Sections 5 and 8 (what the relay stores, and the routes) are unchanged. **OpenMLS check (#3):** - Licences: MIT, Apache-2.0 or BSD across the tree, except hpke-rs, which is MPL-2.0. Amicitia must name its source in its licence notices. - No C code in the tree. - Builds for aarch64, x86_64 and armv7 Android. **Evidence:** - 41 tests pass on Windows: client 10, protocol 14, relay 17. - The client's 10 tests also pass on the Android 15 emulator, including a run of the real relay on the device. - A byte search of the relay's database finds no message text, name or invite secret, while the invite waits, while messages wait, and after delivery. - 6 out of 6 planted bugs are caught: a name in the credential, plaintext beside the ciphertext, the payload in MLS's unencrypted data, junk shown as a message, no acknowledgement, and a second hello. - The welcome-mailbox derivation is pinned to a vector computed independently. **Not here:** state across restarts (F22), the HTTP transport for apps (F22), block (F24), a real phone, iOS.
mnovak added 4 commits 2026-11-14 13:23:38 +01:00
mnovak added 1 commit 2026-11-14 14:58:49 +01:00
Section 4's pairing change is approved (Mark, 2026-11-14). The F21 review moves from
.agents/reviews/ into PR #14.
mnovak reviewed 2026-11-14 14:59:24 +01:00
mnovak left a comment
Author
Owner

Adversarial self-review — F21, the client (MLS 1:1, mailboxes, invites)

Base: main at b502e57. Analysis: .agents/features/client.md. Findings F1–F6 are on the lines they are about; F7 and F8 are below.

Evidence

What Result
cargo test --workspace --locked (Windows) client 10 (1 unit + 8 pairing + 1 real relay), protocol 14, relay 17: 41 passed, 0 failed
The client tests on the Android emulator Android 15, x86_64, built with NDK r27b, run over adb: 10 passed, 0 failed, the real relay running on the device included
cargo build -p tabellarius-client for aarch64- and armv7- Android passes
Clippy (-D warnings), fmt, check-deps.sh, hook tests clean / ok / 7 passed
Licences of the client's tree MIT, Apache-2.0 or BSD, except hpke-rs 0.7, MPL-2.0 (F2). No C code
Planted bugs (mutate_client.py) 6/6 caught, after three tests were fixed (F1)
Welcome-mailbox derivation pinned to a vector computed independently (Python hmac, RFC 5869 written out)
Planted bug Caught by
The display name put in the MLS credential (so in the KeyPackage on the relay) the real-relay test: byte search while the invite waits
The text also posted in the clear the relay holds no name and no word
The payload put in MLS's unencrypted additional data the same
A junk blob shown as a message junk in a mailbox is dropped and never shown
Blobs never acknowledged the junk test and two people pair…: both count what waits on the relay
A second hello accepted, redirecting messages to another mailbox unit test a second hello changes nothing

F7 — MLS test vectors

RFC 9420's test vectors run in OpenMLS's own CI, not here. This repository tests two of its clients talking, and OpenMLS validates every message it processes. Stated as is.

F8 — scope

  • Not here: block (F24), the HTTP transport for apps (F22), several devices per person.
  • The welcome mailbox stays on the relay, empty, after use: the protocol cannot delete a mailbox yet.

Not verified

  • A real phone (only the emulator, x86_64). iOS.
  • Long conversations: epochs, many messages, key rotation.
  • Two invites in flight at once on one client. The code keeps every welcome mailbox, so it should work; no test covers it.

Verdict

F1 fixed on this branch; F2 is for Amicitia (F22); F3 approved by Mark on 2026-11-14. Merging.

## Adversarial self-review — F21, the client (MLS 1:1, mailboxes, invites) Base: `main` at b502e57. Analysis: `.agents/features/client.md`. Findings F1–F6 are on the lines they are about; F7 and F8 are below. ### Evidence | What | Result | |:--|:--| | `cargo test --workspace --locked` (Windows) | client **10** (1 unit + 8 pairing + 1 real relay), protocol **14**, relay **17**: **41 passed, 0 failed** | | The client tests **on the Android emulator** | Android 15, x86_64, built with NDK r27b, run over `adb`: **10 passed, 0 failed**, the real relay running on the device included | | `cargo build -p tabellarius-client` for `aarch64-` and `armv7-` Android | passes | | Clippy (`-D warnings`), fmt, `check-deps.sh`, hook tests | clean / ok / 7 passed | | Licences of the client's tree | MIT, Apache-2.0 or BSD, except `hpke-rs` 0.7, MPL-2.0 (F2). No C code | | Planted bugs (`mutate_client.py`) | **6/6 caught**, after three tests were fixed (F1) | | Welcome-mailbox derivation | pinned to a vector computed independently (Python `hmac`, RFC 5869 written out) | | Planted bug | Caught by | |:--|:--| | The display name put in the MLS credential (so in the KeyPackage on the relay) | the real-relay test: byte search while the invite waits | | The text also posted in the clear | *the relay holds no name and no word* | | The payload put in MLS's unencrypted additional data | the same | | A junk blob shown as a message | *junk in a mailbox is dropped and never shown* | | Blobs never acknowledged | the junk test and *two people pair…*: both count what waits on the relay | | A second `hello` accepted, redirecting messages to another mailbox | unit test *a second hello changes nothing* | ### F7 — MLS test vectors RFC 9420's test vectors run in OpenMLS's own CI, not here. This repository tests two of its clients talking, and OpenMLS validates every message it processes. Stated as is. ### F8 — scope - Not here: block (F24), the HTTP transport for apps (F22), several devices per person. - The welcome mailbox stays on the relay, empty, after use: the protocol cannot delete a mailbox yet. ### Not verified - A real phone (only the emulator, x86_64). iOS. - Long conversations: epochs, many messages, key rotation. - Two invites in flight at once on one client. The code keeps every welcome mailbox, so it should work; no test covers it. ### Verdict F1 fixed on this branch; F2 is for Amicitia (F22); F3 approved by Mark on 2026-11-14. Merging.
@@ -9,2 +9,4 @@
[dependencies]
tabellarius-protocol = { path = "../protocol" }
# MLS (RFC 9420). Pure-Rust crypto provider (RustCrypto), so Android and iOS need no C toolchain.
openmls = "0.9"
Author
Owner

F2 — licence, for Amicitia. OpenMLS's HPKE (hpke-rs, -crypto, -rust-crypto) is MPL-2.0, file-level copyleft. Shipping it unmodified inside the closed Amicitia app is allowed, but the app must say where its source is. That goes into Amicitia's licence notices with F22.

**F2 — licence, for Amicitia.** OpenMLS's HPKE (`hpke-rs`, `-crypto`, `-rust-crypto`) is MPL-2.0, file-level copyleft. Shipping it unmodified inside the closed Amicitia app is allowed, but the app must say where its source is. That goes into Amicitia's licence notices with F22.
@@ -3,0 +121,4 @@
outbox: Option<(MailboxId, Token)>,
}
pub struct Client<T: Transport> {
Author
Owner

F6 — state lives in memory. A restart loses the groups. Keeping MLS state in Amicitia's encrypted mls table is F22; until then nothing is used for real.

**F6 — state lives in memory.** A restart loses the groups. Keeping MLS state in Amicitia's encrypted `mls` table is F22; until then nothing is used for real.
@@ -3,0 +149,4 @@
.random_array()
.map_err(|_| ClientError::Random)?;
let credential = CredentialWithKey {
credential: BasicCredential::new(identity.to_vec()).into(),
Author
Owner

F4 — privacy: what the relay sees. The KeyPackage waits on the relay until claimed: the inviter's MLS public keys and this credential, 16 random bytes, not a name (the first planted bug guards it). The Welcome is encrypted to the KeyPackage. The relay cannot tell that the welcome mailbox and the two personal mailboxes belong together, except by timing (section 1, stated).

**F4 — privacy: what the relay sees.** The KeyPackage waits on the relay until claimed: the inviter's MLS public keys and this credential, **16 random bytes, not a name** (the first planted bug guards it). The Welcome is encrypted to the KeyPackage. The relay cannot tell that the welcome mailbox and the two personal mailboxes belong together, except by timing (section 1, stated).
@@ -3,0 +222,4 @@
}
/// Step 2, on the other device: claim the KeyPackage, make the group, send Welcome and hello.
pub fn accept_invite(&mut self, invite: &Invite) -> Result<ContactId, ClientError> {
Author
Owner

F5 — whoever opens the link first becomes the contact. The inviter sees the joiner's name. A leaked link is answered by safety footprints (F26), and by sharing links privately or by QR in person.

**F5 — whoever opens the link first becomes the contact.** The inviter sees the joiner's name. A leaked link is answered by safety footprints (F26), and by sharing links privately or by QR in person.
@@ -3,0 +290,4 @@
) -> Result<Vec<u8>, ClientError> {
let json = serde_json::to_vec(payload).map_err(|_| ClientError::Mls)?;
let blob = group
.create_message(provider, signer, &json)
Author
Owner

F4 — privacy. Hellos and texts are MLS private messages with empty additional data; the third planted bug (payload in the AAD) guards this.

**F4 — privacy.** Hellos and texts are MLS private messages with **empty** additional data; the third planted bug (payload in the AAD) guards this.
@@ -3,0 +447,4 @@
/// nor rename themselves. Only the contact can send one (MLS authenticates it), so this guards
/// against a misbehaving contact or a replayed message.
#[test]
fn a_second_hello_changes_nothing() {
Author
Owner

F1 — test honesty, fixed. A second hello had no test; a planted bug that accepted it (redirecting messages to another mailbox) passed. This unit test catches it.

**F1 — test honesty, fixed.** A second `hello` had no test; a planted bug that accepted it (redirecting messages to another mailbox) passed. This unit test catches it.
@@ -0,0 +53,4 @@
}
/// How many blobs wait on the relay, in all mailboxes: what was not acknowledged.
pub fn waiting_blobs(&self) -> usize {
Author
Owner

F1 — test honesty, fixed. "The second poll is empty" passed without acknowledgements too: MLS rejects a re-fetched message as a replay, so nothing is shown either way. Tests now count the blobs left on the relay with this.

**F1 — test honesty, fixed.** "The second poll is empty" passed without acknowledgements too: MLS rejects a re-fetched message as a replay, so nothing is shown either way. Tests now count the blobs left on the relay with this.
@@ -0,0 +128,4 @@
}
#[test]
fn junk_in_a_mailbox_is_dropped_and_never_shown() {
Author
Owner

F1 — test honesty, fixed. This test first posted its junk into a third client's welcome mailbox, so the client under test never saw it. It now posts junk before and after the real Welcome, into the right mailbox, and counts what is left on the relay.

**F1 — test honesty, fixed.** This test first posted its junk into a *third* client's welcome mailbox, so the client under test never saw it. It now posts junk before and after the real Welcome, into the right mailbox, and counts what is left on the relay.
@@ -34,0 +43,4 @@
From then on each side posts to the other's mailbox. Names and post tokens travel **only inside
MLS**. To the relay, the welcome mailbox is an ordinary mailbox.
*(Changed 2026-11-14, approved by Mark, from "the invitee replies with their own KeyPackage": the
Author
Owner

F3 — protocol change. Section 4 said the invitee replies with its own KeyPackage and did not say where the reply goes. Here the invitee creates the group, so it needs no KeyPackage, and the first reply goes to a welcome mailbox derived from the link's secret. No new field on the relay; sections 5 and 8 unchanged. Approved by Mark, 2026-11-14.

**F3 — protocol change.** Section 4 said the invitee replies with its own KeyPackage and did not say where the reply goes. Here the invitee creates the group, so it needs no KeyPackage, and the first reply goes to a welcome mailbox derived from the link's secret. No new field on the relay; sections 5 and 8 unchanged. Approved by Mark, 2026-11-14.
Author
Owner

Merged into main with --no-ff as 47ed9eef18 (remote hash verified). The self-review is review 374 on this PR.

Merged into `main` with `--no-ff` as 47ed9eef1814814f18b5e359fbd65e5f5f17701e (remote hash verified). The self-review is review 374 on this PR.
mnovak closed this pull request 2026-11-14 15:00:45 +01:00
Some checks are pending
ci / check (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.