diff --git a/proposals/4464-verifiable-links-in-profile.md b/proposals/4464-verifiable-links-in-profile.md new file mode 100644 index 00000000000..4c0b1cd4a38 --- /dev/null +++ b/proposals/4464-verifiable-links-in-profile.md @@ -0,0 +1,352 @@ +# MSC4464: Verifiable Links in Profile + +A lot of other chat platforms (like Discord) and social media platforms (like +Mastodon, Sharkey, ...) allow you to put a list of links in your profile which +then get verified. + +In the fediverse (e.g. Mastodon) it is simply done by crawling the linked site +and searching for links with the `rel="me"` attribute. + +This proposal introduces a way for Matrix homeservers to do a relationship based +(`rel="me"`), as known from the fediverse, but beyond that also a dns and matrix +backlink (useful for example for alt accounts) verification. This would go a +long way in establishing more feature parity to other popular platforms. + +It would also go a long way in reducing the risk of impersonation and phishing +for a set of MSC4462 connections in profile. + +## Proposal + +### The role of the homeserver + +A homeserver SHOULD provide a client-server API endpoint to verify link +relationship against under `/_matrix/client/v1/verify_profile_connection`. The +result of the link verification SHOULD be cached for some amount of time +(*implementation detail*). The homeserver SHOULD add a `expires` field to the +response, to indicate after what point in time a verification should be +considered outdated, after that time a client SHOULD reverify. + +A homeserver MAY choose to disable the +`/_matrix/client/v1/verify_profile_connection` endpoint by its respective +configuration. Since there can be a lot of verification requests on a big +homeserver, a ratelimit may be applied (in which case a HTTP 429 should be +returned). + +To prevent potentially infinite redirect loops, a restriction on the amount of +redirects SHOULD be applied. A homeserver MAY use a blocklist/allowlist if it +wants to filter what links they try to verify. However a homeserver MUST prevent +verification requests pointing to restricted addresses +([RFC1918](https://www.rfc-editor.org/info/rfc1918), localhost, ...). + +To verify a relationship it MUST match the full MXID (after normalization). + +As a client may wish to display additional information regarding a link +(especially if the link is a web address) a homeserver MAY include url preview +information with the response. + +A homeserver SHOULD allow verification request towards subpages (e.g. +`https://example.org/about`), but MUST NOT mark the whole domain as verified for +the mxid, it SHOULD as well allow multiple matrix-account-links per page. + +#### Verification Methods + +##### Relationship + +A homeserver + +- MAY derive the cache time from the `cache-control` http response header. +- SHOULD upon request, with a payload defined below, fetch that link, parse, and + check if the relationship is given +- MAY restrict from which hosts websites can be fetched from for verification, + similar to link previews +- SHOULD enforce content-type (e.g. HTML only) +- MUST parse static HTML (no JS execution) +- MAY discard the verification and mark it as failed if the http response + exceeds 1MB in size +- SHOULD NOT regard links in `