feat(descriptor): SBQ2 connection descriptor format; release v5.8.0

The SB1 invitation runs 2000-2400 characters and needs QR version 38-40, past
the point where a single code is scannable, so the app falls back to an
animated multi-frame QR. SBQ2 is a fixed binary layout carrying only what
brings up DTLS -- ICE credentials, certificate fingerprint, candidates -- with
the SDP rebuilt from a template by a strict serializer. Measured on real Chrome
and Firefox SDP across four network profiles: 98-149 bytes, QR version 6-8.

Key material is meant to move to the DataChannel, bound by a commitment in the
descriptor. That half does not exist yet, so nothing calls this module: the
format is landed for review and freeze, not wired into the connection path.
doc/DESCRIPTOR-SBQ2.md records the gate on phase 3.

The decoder is a parser of hostile input: fixed offsets, explicit lengths,
deny-by-default on reserved values and unknown TLV extension types, trailing
bytes rejected, ICE credentials alphabet-checked so a CRLF cannot reach the
serializer. No compression -- DEFLATE adds bytes on this payload, and dropping
it removes the decompression-bomb surface with it.

Candidate pruning keeps coverage before count: one candidate per (family, type,
transport) survives before any surplus, so an IPv6-only or UDP-blocked path
cannot be pruned away by a v4-first sort.

Tests cover round-trip against captured Chrome and Firefox SDP, IPv6 and NAT64
addresses, ICE-TCP candidates, the TLV area, clock skew, one-shot binding and
SAS transcript coverage.
This commit is contained in:
lockbitchat
2026-08-06 11:54:05 -04:00
parent 3212138a0d
commit 6e82cfcae2
14 changed files with 1765 additions and 37 deletions
+34
View File
@@ -0,0 +1,34 @@
{
"host_only": {
"offer": "v=0\r\no=mozilla...THIS_IS_SDPARTA-99.0 6954001307224301170 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=sendrecv\r\na=fingerprint:sha-256 9F:98:22:05:43:42:63:71:20:48:78:9F:FB:FD:93:BE:6A:BF:CC:F9:C2:85:36:BD:0B:52:F5:82:2D:53:AA:5B\r\na=group:BUNDLE 0\r\na=ice-options:trickle\r\na=msid-semantic:WMS *\r\nm=application 9 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 0.0.0.0\r\na=candidate:0 1 UDP 2122252543 02223491-7fdc-4329-abd2-4e6494b1a32c.local 56761 typ host\r\na=candidate:1 1 TCP 2105524479 02223491-7fdc-4329-abd2-4e6494b1a32c.local 9 typ host tcptype active\r\na=sendrecv\r\na=end-of-candidates\r\na=ice-pwd:1f42449f683648b472545028e84e99e3\r\na=ice-ufrag:5a90c521\r\na=mid:0\r\na=setup:actpass\r\na=sctp-port:5000\r\na=max-message-size:1073741823\r\n",
"answer": "v=0\r\no=mozilla...THIS_IS_SDPARTA-99.0 1218188487223042476 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=sendrecv\r\na=fingerprint:sha-256 AD:6B:A7:BB:53:FA:0F:7C:F8:93:AD:78:00:C2:F3:36:4A:88:79:17:6E:2D:74:6C:68:DF:78:C1:C3:4B:C1:05\r\na=group:BUNDLE 0\r\na=ice-options:trickle\r\na=msid-semantic:WMS *\r\nm=application 9 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 0.0.0.0\r\na=candidate:0 1 UDP 2122252543 c427d246-8c24-4844-9877-62014e6628f1.local 62174 typ host\r\na=candidate:1 1 TCP 2105524479 c427d246-8c24-4844-9877-62014e6628f1.local 9 typ host tcptype active\r\na=sendrecv\r\na=end-of-candidates\r\na=ice-pwd:881e7b4139d6358e1e249445f504e85e\r\na=ice-ufrag:169c83ed\r\na=mid:0\r\na=setup:active\r\na=sctp-port:5000\r\na=max-message-size:1073741823\r\n",
"_meta": {
"offerCands": 3,
"answerCands": 3
}
},
"stun": {
"offer": "v=0\r\no=mozilla...THIS_IS_SDPARTA-99.0 3614557044845955558 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=sendrecv\r\na=fingerprint:sha-256 02:0E:0E:49:08:38:75:B7:F3:9A:19:15:4D:C3:E6:D9:52:14:C4:17:6B:FD:96:69:AB:38:DE:A3:4D:7E:E6:B8\r\na=group:BUNDLE 0\r\na=ice-options:trickle\r\na=msid-semantic:WMS *\r\nm=application 33071 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 152.166.136.164\r\na=candidate:0 1 UDP 2122252543 86f4806a-e0c3-42d0-80f9-1ae04917aa57.local 61953 typ host\r\na=candidate:2 1 TCP 2105524479 86f4806a-e0c3-42d0-80f9-1ae04917aa57.local 9 typ host tcptype active\r\na=candidate:1 1 UDP 1686052863 152.166.136.164 33071 typ srflx raddr 0.0.0.0 rport 0\r\na=sendrecv\r\na=end-of-candidates\r\na=ice-pwd:d36fd78fa1eb4585e10bd2666642e676\r\na=ice-ufrag:fb88e298\r\na=mid:0\r\na=setup:actpass\r\na=sctp-port:5000\r\na=max-message-size:1073741823\r\n",
"answer": "v=0\r\no=mozilla...THIS_IS_SDPARTA-99.0 3048119113405332850 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=sendrecv\r\na=fingerprint:sha-256 AB:2F:40:06:53:E8:E4:67:A7:34:10:98:A1:D5:2E:FC:B3:32:73:25:FB:97:DE:55:B4:42:5D:FF:CD:A8:59:6C\r\na=group:BUNDLE 0\r\na=ice-options:trickle\r\na=msid-semantic:WMS *\r\nm=application 44924 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 152.166.136.164\r\na=candidate:0 1 UDP 2122252543 bc8a0794-1cd7-476e-96a4-796fa7ad5632.local 56644 typ host\r\na=candidate:2 1 TCP 2105524479 bc8a0794-1cd7-476e-96a4-796fa7ad5632.local 9 typ host tcptype active\r\na=candidate:1 1 UDP 1686052863 152.166.136.164 44924 typ srflx raddr 0.0.0.0 rport 0\r\na=sendrecv\r\na=end-of-candidates\r\na=ice-pwd:e09a5ceae613caeb3e609c66248875dd\r\na=ice-ufrag:dd18d415\r\na=mid:0\r\na=setup:active\r\na=sctp-port:5000\r\na=max-message-size:1073741823\r\n",
"_meta": {
"offerCands": 4,
"answerCands": 4
}
},
"turn_all": {
"offer": "v=0\r\no=mozilla...THIS_IS_SDPARTA-99.0 8689633657762425867 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=sendrecv\r\na=fingerprint:sha-256 18:C8:12:B5:B0:25:7D:3B:62:BD:88:5F:64:DA:50:EC:41:F3:43:BE:1C:88:3B:CB:B5:12:CD:B2:F3:EB:46:EE\r\na=group:BUNDLE 0\r\na=ice-options:trickle\r\na=msid-semantic:WMS *\r\nm=application 59174 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 144.172.96.126\r\na=candidate:0 1 UDP 2122252543 57c55eed-e6d9-4f89-857b-a6f34edb415a.local 64308 typ host\r\na=candidate:3 1 TCP 2105524479 57c55eed-e6d9-4f89-857b-a6f34edb415a.local 9 typ host tcptype active\r\na=candidate:1 1 UDP 1686052863 152.166.136.164 47676 typ srflx raddr 0.0.0.0 rport 0\r\na=candidate:2 1 UDP 92215807 144.172.96.126 59174 typ relay raddr 144.172.96.126 rport 59174\r\na=candidate:4 1 UDP 8331263 144.172.96.126 62952 typ relay raddr 144.172.96.126 rport 62952\r\na=candidate:4 1 UDP 8331263 144.172.96.126 50084 typ relay raddr 144.172.96.126 rport 50084\r\na=sendrecv\r\na=end-of-candidates\r\na=ice-pwd:0a92df0d43e88e7580b6d798a494ec0a\r\na=ice-ufrag:bc424ef2\r\na=mid:0\r\na=setup:actpass\r\na=sctp-port:5000\r\na=max-message-size:1073741823\r\n",
"answer": "v=0\r\no=mozilla...THIS_IS_SDPARTA-99.0 4251445331568348906 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=sendrecv\r\na=fingerprint:sha-256 60:C9:4E:E2:78:64:DF:B3:E2:A7:88:05:12:7F:CB:AF:CF:33:57:E0:F5:68:E5:FA:83:FA:A6:B2:B0:69:F8:26\r\na=group:BUNDLE 0\r\na=ice-options:trickle\r\na=msid-semantic:WMS *\r\nm=application 57033 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 144.172.96.126\r\na=candidate:0 1 UDP 2122252543 c7da1688-0dc6-45bc-aa1c-82be16147b26.local 52730 typ host\r\na=candidate:3 1 TCP 2105524479 c7da1688-0dc6-45bc-aa1c-82be16147b26.local 9 typ host tcptype active\r\na=candidate:1 1 UDP 1686052863 152.166.136.164 37734 typ srflx raddr 0.0.0.0 rport 0\r\na=candidate:2 1 UDP 92215807 144.172.96.126 57033 typ relay raddr 144.172.96.126 rport 57033\r\na=candidate:4 1 UDP 8331263 144.172.96.126 62819 typ relay raddr 144.172.96.126 rport 62819\r\na=candidate:4 1 UDP 8331263 144.172.96.126 59536 typ relay raddr 144.172.96.126 rport 59536\r\na=sendrecv\r\na=end-of-candidates\r\na=ice-pwd:92f178d4b9daba2698d47002ef2cd4c8\r\na=ice-ufrag:3fe336de\r\na=mid:0\r\na=setup:active\r\na=sctp-port:5000\r\na=max-message-size:1073741823\r\n",
"_meta": {
"offerCands": 7,
"answerCands": 7
}
},
"turn_relay_only": {
"offer": "v=0\r\no=mozilla...THIS_IS_SDPARTA-99.0 6644107097568718127 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=sendrecv\r\na=fingerprint:sha-256 3B:11:07:3E:C7:C3:D3:4C:50:49:E7:08:6B:02:CC:6B:E9:19:7E:31:C1:9A:32:D0:98:64:FC:C8:6F:73:B6:9C\r\na=group:BUNDLE 0\r\na=ice-options:trickle\r\na=msid-semantic:WMS *\r\nm=application 53665 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 144.172.96.126\r\na=candidate:0 1 UDP 92217343 144.172.96.126 53665 typ relay raddr 144.172.96.126 rport 53665\r\na=candidate:1 1 UDP 8331263 144.172.96.126 56510 typ relay raddr 144.172.96.126 rport 56510\r\na=candidate:1 1 UDP 8331263 144.172.96.126 54387 typ relay raddr 144.172.96.126 rport 54387\r\na=sendrecv\r\na=end-of-candidates\r\na=ice-pwd:42d0ac92c82418c74b7982d1be58d482\r\na=ice-ufrag:de6c893b\r\na=mid:0\r\na=setup:actpass\r\na=sctp-port:5000\r\na=max-message-size:1073741823\r\n",
"answer": "v=0\r\no=mozilla...THIS_IS_SDPARTA-99.0 4625010855495189334 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=sendrecv\r\na=fingerprint:sha-256 FB:B2:B3:90:CF:BB:67:8C:B1:82:EF:D0:79:50:70:4E:61:71:7B:71:3B:F1:11:25:55:0B:B0:7D:24:D5:E5:97\r\na=group:BUNDLE 0\r\na=ice-options:trickle\r\na=msid-semantic:WMS *\r\nm=application 52546 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 144.172.96.126\r\na=candidate:0 1 UDP 92217343 144.172.96.126 52546 typ relay raddr 144.172.96.126 rport 52546\r\na=candidate:1 1 UDP 8331263 144.172.96.126 61188 typ relay raddr 144.172.96.126 rport 61188\r\na=candidate:1 1 UDP 8331263 144.172.96.126 62991 typ relay raddr 144.172.96.126 rport 62991\r\na=sendrecv\r\na=end-of-candidates\r\na=ice-pwd:471a7657cb6bd345820a44062601bf27\r\na=ice-ufrag:c99211cf\r\na=mid:0\r\na=setup:active\r\na=sctp-port:5000\r\na=max-message-size:1073741823\r\n",
"_meta": {
"offerCands": 4,
"answerCands": 4
}
}
}