Files
Amicitia-Tabellarius/.agents/features/join-page.md
T
mnovak 1ccae752d7
ci / check (pull_request) Has been cancelled
[relay] Join page: GET /join hands an invite link opened in a browser to the app
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.
2026-11-18 17:03:32 +01:00

2.1 KiB

The join page — an invite link a messenger can open

1. Why and what

Amicitia (the app this relay serves) makes connecting seamless: Invite Petr opens the phone's share sheet with a message holding the invite link, and Petr taps it (Amicitia's .agents/features/seamless-invite.md). Messengers make https:// links tappable, not amicitia://. So the link is https://<relay>/join#<invite id>.<secret>, and the relay serves the page it opens: one button, Open Amicitia, that hands the invite to the app.

2. Design

sequenceDiagram
  participant B as Browser
  participant R as Relay
  participant A as App
  B->>R: GET /join   (the fragment #id.secret is never sent)
  R-->>B: static page: CSP default-src 'none' + hashes, no-store, no-referrer
  B->>A: tap → amicitia://invite?relay=<origin>#id.secret
  • crates/relay/assets/join.html, served by crates/relay/src/join.rs. The CSP names the page's only script and style by SHA-256, computed from the page itself at start-up, so an edit to the page cannot run without its hash.
  • The script checks the fragment's shape (22 + 43 base64url characters) and only then sets the button's target; anything else shows This invite link is incomplete.
  • No automatic redirect: Chrome refuses a custom scheme opened without a tap.

3. Risks

  • Privacy: the relay learns that an address opened /join — no more than any client tells it. It stores nothing and prints no request. The secret stays in the fragment. A messenger's link preview fetches /join only.
  • The page as an attack surface: static, no input read on the server, no cookie, framing refused, nothing loaded from elsewhere.

4. Verification

Case How
Static, strict headers, nothing external, no cookie the_join_page_is_static_and_loads_nothing_from_elsewhere
The policy's hashes match the page's script and style the_join_page_policy_hashes_its_own_script_and_style
The script builds the app link from a good fragment and refuses a bad one Node, by hand (in the PR); Amicitia's phone test end to end