Skip to content

Edge: Sec-MS-GEC v2 token + full 2026-10 handshake (#141) - #142

Merged
willwade merged 1 commit into
mainfrom
fix/edge-sec-ms-gec-v2
Nov 23, 2026
Merged

willwade merged 1 commit into
mainfrom
fix/edge-sec-ms-gec-v2

Conversation

@willwade

Copy link
Copy Markdown
Contributor

Fixes #141. Reproduced before (318 voices, then WS connect error: HTTP error: 403 on every synthesis — your exact repro) and verified after: voices=318, speak=89856 bytes, second utterance via the pooled connection = 89856 bytes.

What changed

Microsoft's 2026-10 handshake requires the v2 Sec-MS-GEC token (edge-tts PR #492) plus browser-fidelity handshake details. Ported in full:

  • v2 token: a SHA-256 variant (data-dependent IV from a 7-byte salt, custom schedule seeding, one round-constant swap) + a custom CS64 checksum → <16hex>-<64hex>. The reference's arithmetic accumulates unmasked and masks late — carries above bit 32 are load-bearing, which a naive wrapping-u32 port loses.
  • The service's round-constant table differs from FIPS at index 32 (0x27B70A85) — a divergence between the published PR diff and the shipped package that only matching golden vectors against the installed reference caught (the transcribed diff produced a valid-looking but wrong token).
  • Handshake: fresh ConnectionId per connection, Cookie: muid=<random>, Pragma/Cache-Control, UA → Chrome/143, Sec-MS-GEC-Version=2-143.0.3650.75.
  • 6 golden vectors pinned against the installed reference; the token-shape test updated.

Verification

  • Live e2e through the engine — the reporter's flow (GetVoices → SetVoice → SynthToBytes), twice, exercising the warm-connection pool
  • Cross-checked token-for-token against the installed edge-tts release at 6 timestamps; the real package also synth'd successfully from this machine as a control
  • All 11 feature combos + full pre-push gate green locally

…y synthesis) (#141)

Microsoft's 2026-10 handshake change 403'd every Edge synthesis WS
connect while the voice list (tokenless URL) kept working — the
reporter's exact repro, reproduced locally before the fix and gone
after: voices=318, speak=89856 bytes, second utterance (pooled
connection) 89856.

The port (edge-tts PR #492, verified against the INSTALLED release):

- Sec-MS-GEC v2: a SHA-256 variant with a data-dependent IV (salt =
  the first 7 bytes, custom schedule seeding, one round constant
  swap) plus a CS64 checksum, '<16hex>-<64hex>'. The reference
  accumulates UNMASKED and masks late — carries above bit 32 are
  load-bearing; the round sigmas keep high bits. The service's
  round-constant table ALSO differs from FIPS at index 32
  (0x27B70A85 vs stock 0x2748774C) — a divergence between the
  published PR diff and the shipped package that only a golden-
  vector match against the installed reference caught.
- Handshake: fresh ConnectionId query param, Cookie: muid=<random
  16 bytes>, Pragma/Cache-Control headers, UA bumped to Chrome/143,
  Sec-MS-GEC-Version=2-143.0.3650.75.
- Golden vectors: 6 timestamps pinned against the installed
  reference (generated, not transcribed); the old 64-hex-shape test
  updated to the v2 '<16>-<64>' shape.

All 11 feature combos + the pre-push gate green; live e2e through
the engine (reporter's flow: GetVoices → SetVoice → SynthToBytes,
twice for the pooled path).
@willwade
willwade merged commit 255bc33 into main Nov 23, 2026
43 of 45 checks passed
@willwade
willwade deleted the fix/edge-sec-ms-gec-v2 branch November 23, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Edge voice listing works but synthesis WebSocket returns HTTP 403 in v1.16.2

1 participant