Security
Why a web page cannot use monedula-sim-bridge behind your back - loopback only, an Origin allowlist, a pairing code, one tab, and nothing stored or shared.
On this page
A bridge between a web page and the programs on your computer has to be safe against two things: another web page driving it, and your data leaving the computer. The bridge and the playground each guard against both.
On your computer
- Loopback only. The WebSocket and every Kafka port listen on
127.0.0.1. No flag binds another address, so nothing else on your network can reach them. - An Origin allowlist. The WebSocket accepts a browser connection only when its
Originheader is exactly one ofhttps://monedula.dev,https://www.monedula.dev,http://localhost:4321orhttp://127.0.0.1:4321(the last two for local development of the site). A request without anOriginis refused too. Another site open in the same browser cannot open the socket. - A pairing code. The bridge prints a random six-character code, new on every start, and accepts a tab only after it sends that code. The code proves that the tab belongs to the person who started this bridge.
- One tab at a time. While one tab is paired, a second one is closed with WebSocket close code 1008 and the reason
busy; the playground tells you another tab is already connected. - Nothing outbound, nothing written. The bridge makes no outbound connections and writes no files. Stop it with Ctrl-C and nothing is left behind.
In the browser
- Your click, every time. The playground opens no local connection until you press Connect, and every page load starts disconnected. How it works lists the rules.
- Records stay in the tab. Records from your apps live in the playground’s memory for as long as the page is open. They are not saved in the browser.
- Nothing in a share link. A share link carries the playground’s own actions only. Everything your apps did, their connections, records, groups, committed offsets and the topics they created, is left out, so a link you share never carries your data, and whoever opens it gets a playground with no bridge.
What the bridge trusts
Your Kafka clients connect without authentication or TLS, as they would to a local development broker: the bridge offers no SASL or TLS. Anything on your computer that can open a port on 127.0.0.1 can use the Kafka ports while the bridge runs and a tab is paired, as it could any local broker.