Last 12 weeks · 0 commits
1 of 6 standards met
accepts any incoming message as long as the matches — it never checks where the message came from. Since the default is and any window with a handle to the target (opener, parent, named frame) can to it, a malicious window that knows or guesses the can complete the handshake and hijack a legitimate channel, intercepting all subsequent communication. A possible fix is to add an optional argument to . When provided: Inbound: connections whose differs from the declared origin are rejected in . Outbound: the origin is used as the for instead of , so handshake messages aren't broadcast to other origins. The expected origin has to be declared by the caller — it can't be derived from a cross-origin target ( throws a ), and deriving it from the first handshake (trust-on-first-use) is a race an attacker can win, so it wouldn't actually be safe. Fully backward compatible: without origin, behaviour is identical to before.
Repository: vercel/bidc. Description: Bidirectional Channels for JavaScript Stars: 1277, Forks: 23. Primary language: TypeScript. Languages: TypeScript (99%), CSS (0.8%), JavaScript (0.2%). Topics: async, channels, iframe, javascript, messaging, rpc, worker. Latest release: 0.0.4 (7mo ago). Open PRs: 1, open issues: 4. Last activity: 7mo ago. Community health: 37%. Top contributors: shuding, haingdc, Rich-Harris.