fix(mobile): allow SAS-verified private/ws(s) relay URLs on pairing - #7266
xandorklein wants to merge 1 commit into
Conversation
🔐 Codex Security Review
|
Post-SAS NIP-AB credential import treated every relayUrl like an untrusted invite: release builds required exactly https and rejected RFC1918 hosts. That blocked VPN-only and Tailscale communities (ws://private or MagicDNS) and also rejected legitimate public wss:// payloads with a misleading "must use HTTPS" error (block#4198). Trust the desktop-sourced URL after SAS match (allow http/ws and private or VPN hosts), keep strict checks for legacy buzz:// paste codes, and normalize ws(s) → http(s) before storage so RelayConfig stays consistent. Signed-off-by: Xandor Klein <xandorklein@users.noreply.github.com>
a54a1f4 to
6a65633
Compare
|
Rebased onto latest Also cross-linked from #4198 for the people who hit the private/ Note: Codex Security Review still needs a Block org member to authorize: |
|
Awaiting merge. |
|
Awaiting merge. |
Summary
Fixes #4198.
After a successful NIP-AB SAS match, mobile still ran credential import through a release-only validator that:
https(sowss://…andws://…failed withRelay URL must use HTTPS)That made VPN-only / Tailscale self-hosted communities unusable on mobile even when pairing itself succeeded, and also rejected legitimate public
wss://payloads (see issue comments). Desktop already supports privatews://relays.Approach
validatePairingRelayUrl(...)with an explicittrustVerifiedPairingPayloadflag.true): accepthttp/https/ws/wss, allow private/VPN hosts and localhost, normalizews→http/wss→httpsbefore storage + NIP-42 connect.buzz://paste path (false): keep production TLS + private-host rejection (SSRF posture for untrusted codes), but still normalizewss/wsso public websocket URLs are not misreported as “must use HTTPS”.relay_validation.dartis unchanged (still strict for untrusted invite links).Test plan
validatePairingRelayUrl(privatews://, MagicDNS, publicwss://, untrusted private reject)ws://10.88.0.1:3000and publicwss://import + normalize100.64/10)ws://*.ts.net:3000community on a release/profile build with this change