[relay] Join page: GET /join hands an invite link opened in a browser to the app #19

Closed
mnovak wants to merge 0 commits from feature/join-page into main
Owner

The join page: GET /join, for Amicitia's seamless invites (Amicitia .agents/features/seamless-invite.md). Analysis: .agents/features/join-page.md. Protocol: §8 lists the route and what the relay learns.

  • An invite can travel as https://<relay>/join#<invite id>.<secret>, which messengers make tappable (they do not make amicitia:// tappable).
  • The browser sends only GET /join; the fragment, and so the secret, never reaches the relay, a link preview or a proxy.
  • The page is static: one inline script and style, named by SHA-256 in a Content-Security-Policy of default-src 'none' (computed from the page at start-up), no-store, no-referrer, nosniff, no cookie, framing refused. Its one button opens amicitia://invite?relay=<its origin>#<id>.<secret>, after a tap.
  • New dependencies of the relay: sha2 0.10 and base64 0.22, both already in the workspace (the protocol crate's).
**The join page: `GET /join`**, for Amicitia's seamless invites (Amicitia `.agents/features/seamless-invite.md`). Analysis: `.agents/features/join-page.md`. Protocol: §8 lists the route and what the relay learns. - An invite can travel as `https://<relay>/join#<invite id>.<secret>`, which messengers make tappable (they do not make `amicitia://` tappable). - The browser sends only `GET /join`; the fragment, and so the secret, never reaches the relay, a link preview or a proxy. - The page is static: one inline script and style, named by SHA-256 in a `Content-Security-Policy` of `default-src 'none'` (computed from the page at start-up), `no-store`, `no-referrer`, `nosniff`, no cookie, framing refused. Its one button opens `amicitia://invite?relay=<its origin>#<id>.<secret>`, after a tap. - New dependencies of the relay: `sha2` 0.10 and `base64` 0.22, both already in the workspace (the protocol crate's).
mnovak added 1 commit 2026-11-18 17:04:04 +01:00
A static page for https://<relay>/join#<invite id>.<secret>, the link messengers make tappable.
The fragment never reaches the relay. One button opens amicitia://invite?relay=<origin>#…; its
only script and style are named by SHA-256 in a Content-Security-Policy of default-src 'none';
no-store, no-referrer, no cookie, framing refused. PROTOCOL.md §8 lists the route.
mnovak reviewed 2026-11-18 17:04:04 +01:00
mnovak left a comment
Author
Owner

Adversarial self-review — the join page

Evidence

What Result
cargo test --workspace client 4 + 7 + 8 + 1 + 14; protocol wire 14; relay quotas 8, relay 19 (2 new)
clippy -D warnings, cargo fmt --check clean
Planted bugs (mutate_join.py) 8/8 caught: 'unsafe-inline' for scripts; the page cached; the referrer sent; framing allowed; a web font from elsewhere; the fragment sent to the server with fetch; an automatic redirect; a policy hash not of the script
The page's script, by hand in Node a good fragment gives amicitia://invite?relay=https://relay.example.cz#AAAA….BBBB…; empty, too short and tampered fragments hide the button and say the link is incomplete

Findings

J1–J4 are on their lines.

Not verified

  • In a real browser on the phone: next, in Amicitia's PR (the page over adb reverse, Chrome, the app opening).
  • Behind the NixOS module's Caddy: the route passes through like the others; not run (no Nix here).

Verdict

Merging.

## Adversarial self-review — the join page ### Evidence | What | Result | |:--|:--| | `cargo test --workspace` | client **4 + 7 + 8 + 1 + 14**; protocol `wire` **14**; relay `quotas` **8**, `relay` **19** (2 new) | | clippy `-D warnings`, `cargo fmt --check` | clean | | Planted bugs (`mutate_join.py`) | **8/8 caught**: `'unsafe-inline'` for scripts; the page cached; the referrer sent; framing allowed; a web font from elsewhere; the fragment sent to the server with `fetch`; an automatic redirect; a policy hash not of the script | | The page's script, by hand in Node | a good fragment gives `amicitia://invite?relay=https://relay.example.cz#AAAA….BBBB…`; empty, too short and tampered fragments hide the button and say the link is incomplete | ### Findings J1–J4 are on their lines. ### Not verified - In a real browser on the phone: next, in Amicitia's PR (the page over `adb reverse`, Chrome, the app opening). - Behind the NixOS module's Caddy: the route passes through like the others; not run (no Nix here). ### Verdict Merging.
@@ -0,0 +38,4 @@
document.getElementById("bad").hidden = false;
return;
}
open.href = "amicitia://invite?relay=" + location.origin + "#" + invite;
Author
Owner

J2 — privacy. The secret is only ever in the fragment and goes only into the button's target, which the person taps. The test refuses fetch, XHR, beacons, sockets and every way of leaving the page by script. No automatic redirect: Chrome blocks a custom scheme without a gesture, and a page that sometimes jumps is worse than one button.

**J2 — privacy.** The secret is only ever in the fragment and goes only into the button's target, which the person taps. The test refuses `fetch`, XHR, beacons, sockets and every way of leaving the page by script. No automatic redirect: Chrome blocks a custom scheme without a gesture, and a page that sometimes jumps is worse than one button.
@@ -38,6 +38,7 @@ pub fn router(state: AppState) -> Router {
.route("/v0/invites", post(create_invite))
.route("/v0/invites/{id}", get(claim_invite))
.route("/version", get(version))
.route("/join", get(crate::join::page))
Author
Owner

J4 — scope. The page names Amicitia, the app this relay serves; the relay itself is still your message relay to users. A relay run for another app would need its own page — not a concern while Amicitia is the only client.

**J4 — scope.** The page names Amicitia, the app this relay serves; the relay itself is still *your message relay* to users. A relay run for another app would need its own page — not a concern while Amicitia is the only client.
@@ -0,0 +33,4 @@
/// font, no connection, no frame, no form.
pub static CONTENT_SECURITY_POLICY: LazyLock<String> = LazyLock::new(|| {
format!(
"default-src 'none'; script-src {}; style-src {}; base-uri 'none'; form-action 'none'; frame-ancestors 'none'",
Author
Owner

J1 — the page as attack surface. default-src 'none' with the script and style by hash: no other script can run, nothing loads, no connection is possible (connect-src falls back to 'none'), no form, no framing. The hashes are computed from the page itself, so an edit cannot ship without them. Planted bugs on each part caught.

**J1 — the page as attack surface.** `default-src 'none'` with the script and style by hash: no other script can run, nothing loads, no connection is possible (`connect-src` falls back to `'none'`), no form, no framing. The hashes are computed from the page itself, so an edit cannot ship without them. Planted bugs on each part caught.
@@ -115,1 +116,4 @@
come from §5's own rows and `size`. A client treats 507 like any failure and tries again later.
- **The join page** *(added 2026-11-18; `.agents/features/join-page.md`)*: an invite can travel as
`https://<relay>/join#<invite id>.<secret>`, which messengers make tappable. The browser sends
only `GET /join`: the fragment, and so the secret, never reaches the relay, a link preview or a
Author
Owner

J3 — what the relay learns. That some address opened /join — no more than any client of it tells it; it stores and prints nothing for the page. A messenger's link preview fetches /join too, without the fragment. Said here, in §8.

**J3 — what the relay learns.** That some address opened `/join` — no more than any client of it tells it; it stores and prints nothing for the page. A messenger's link preview fetches `/join` too, without the fragment. Said here, in §8.
Author
Owner

Merged into main as f075fae (--no-ff), verified on the remote. Review: this PR.

Merged into main as f075fae (`--no-ff`), verified on the remote. Review: this PR.
mnovak closed this pull request 2026-11-18 17:04:14 +01:00
Some checks are pending
ci / check (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.