DOSAYGO Studio

BrowserBox: Secure Remote Browser for Apps

By Cris, October 1, 2018

Embedding secure browsing in apps risks exposing users to web threats. I addressed this with BrowserBox, a remote browser isolation (RBI) solution using the Chrome DevTools Protocol (CDP) and WebRTC for secure, real-time collaboration, embeddable via a custom element. In the web’s cosmic network, BrowserBox is a starship, shielding users while navigating the digital void.

A WebSocket server manages connections, CDP controls the remote browser, and WebRTC streams events for collaboration, with RBI ensuring security.

wss.on('connection', async (ws, req) => {
  const connectionId = Math.random().toString(36) + (+new Date).toString(36);
  const validAuth = req.headers.cookie?.includes(`${COOKIENAME+port}=${allowed_user_cookie}`);
  if (validAuth) {
    await zl.act.addLink({so, forceMeta}, {connectionId, socket: ws}, zombie_port);
    let peer = new Peer({ wrtc: WRTC, initiator: true });
    peer.on('signal', data => so(ws, {copeer: {signal: data}}));
    peer.on('connect', () => zl.act.addLink({so, forceMeta}, {connectionId, peer, socket: ws}, zombie_port));
    ws.on('message', message => {
      const { copeer, zombie } = JSON.parse(message);
      if (copeer) peer.signal(copeer.signal);
      if (zombie) eventSendLoop(zombie.events, { Data: [], Frames: [], Meta: [], State: {}, connectionId });
    });
  } else {
    ws.close();
  }
});

This code sets up WebSocket-WebRTC collaboration, while CDP commands control the browser, ensuring secure, isolated browsing.

BrowserBox interface: a glowing crystal orb with interconnected nodes, set in a moonlit glade

Building BrowserBox was like piloting a starship, navigating threats with precision. At DOSAYGO, we value security and collaboration, crafting tools that protect while connecting. BrowserBox is a cosmic vessel, guiding users safely through the web’s expanse.