Dev.to Security 🔐 Cybersecurity 👁 0 📖 6 min read

Embed a remote Chromium browser in your SaaS app

Your SaaS app can display a browser running on a BrowserBox host. The embedding surface does not authenticate your user or isolate tenants. Your application must allocate the right session, deliver its login URL securely

Your SaaS app can display a browser running on a BrowserBox host. The embedding surface does not authenticate your user or isolate tenants. Your application must allocate the right session, deliver its login URL securely, and release it when the user is done.

We ran the example below on one macOS machine with BrowserBox CLI v21.0.3 and @browserbox/hyper-frame 4.0.0. The parent page and BrowserBox shared that machine; headless Chrome drove the test on 2026-12-04. This is a local proof, not a production deployment.

Treat the session link as a secret capability: anyone who obtains a usable link may be able to join the session. Keep it out of logs, analytics, public URLs and support tickets. Test tenant separation, revocation and cleanup separately. An origin allowlist does not authenticate users.

A working local example

You need a licensed BrowserBox install (bbx certify already done), Python 3, and a locally trusted TLS certificate for localhost and 127.0.0.1 (fullchain.pem and privkey.pem; we used certificates made with mkcert in ~/sslcerts). Use a disposable instance: bbx setup writes the instance configuration and, in our run, issued a new login token.

Set the allowed parent origins in the shell that configures and starts the service:

export ALLOWED_EMBEDDING_ORIGINS="https://localhost:8765"
bbx setup -p 8888 --hostname localhost
bbx start

Save this as index.html. The element is registered by the module script; without it, <hyper-frame> is an unknown tag.

<!doctype html>
<meta charset="utf-8">
<title>Parent app</title>
<script type="module" src="https://cdn.jsdelivr.net/npm/@browserbox/[email protected]/src/hyper-frame.js"></script>
<hyper-frame id="remote"
  login-link="__LOGIN_LINK__"
  embedder-origin="__PARENT_ORIGIN__"
  media-permissions="none"
  width="100%" height="600"></hyper-frame>
<pre id="log">waiting</pre>
<script type="module">
  const out = document.querySelector('#log');
  try {
    await customElements.whenDefined('hyper-frame');
    const remote = document.querySelector('#remote');
    await remote.whenReady();
    out.textContent = 'ready';
    await remote.page.navigate('https://example.com');
    await new Promise(done => setTimeout(done, 3000));
    out.textContent += '\nurl: ' + await remote.page.url();
    out.textContent += '\ntitle: ' + await remote.page.title();
  } catch (error) {
    out.textContent += '\nerror: ' + error.message;
  }
</script>

Save this next to it as parent.py. It reads the login link that BrowserBox writes under ~/.config/dosaygo/bbpro/ and puts it into the page at request time, so the link never sits in your source files. It has no user authentication: it listens on the loopback address only and is for this test, not for production.

import html, http.server, os, pathlib, ssl

home = pathlib.Path.home()
link_file = home / '.config/dosaygo/bbpro/login.link'
certs = pathlib.Path(os.environ.get('CERT_DIR', str(home / 'sslcerts')))
origin = os.environ.get('PARENT_ORIGIN', 'https://localhost:8765')

class Page(http.server.BaseHTTPRequestHandler):
    def do_GET(self):
        if self.path != '/':
            return self.send_error(404)
        try:
            link = link_file.read_text().strip()
        except FileNotFoundError:
            return self.send_error(503, 'BrowserBox is not running')
        body = pathlib.Path('index.html').read_text()
        body = body.replace('__LOGIN_LINK__', html.escape(link))
        body = body.replace('__PARENT_ORIGIN__', html.escape(origin))
        self.send_response(200)
        self.send_header('Content-Type', 'text/html; charset=utf-8')
        self.send_header('Cache-Control', 'no-store')
        self.send_header('Referrer-Policy', 'no-referrer')
        self.end_headers()
        self.wfile.write(body.encode())

    def log_message(self, *args):
        pass

server = http.server.ThreadingHTTPServer(('127.0.0.1', 8765), Page)
tls = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
tls.load_cert_chain(certs / 'fullchain.pem', certs / 'privkey.pem')
server.socket = tls.wrap_socket(server.socket, server_side=True)
print('open ' + origin, flush=True)
server.serve_forever()

Then run it from the same directory and open the printed address:

python3 parent.py

The text under the frame read:

ready
url: https://example.com/
title: example.com

The frame showed the remote browser with example.com loaded.

What we measured, and the failure cases

Check Observed
Allowed parent, https://localhost:8765 Element reached ready; page.navigate, page.url and page.title returned the values above.
Parent origin not on the allowlist, https://127.0.0.1:8765 hyper-frame ready timeout after 30000ms. The server's frame-ancestors header did not include that origin.
Same parent after setting ALLOWED_EMBEDDING_ORIGINS to it and running stop, setup and start Element reached ready and returned the same URL and title; the header now listed https://127.0.0.1:8765.
Inner iframe allow list with media-permissions="none" accelerometer; encrypted-media; geolocation; gyroscope; midi; clipboard-read; clipboard-write; web-share; fullscreen (no camera, microphone or display-capture).
After bbx stop bbx status reported Not Running and a request to port 8888 was refused.

Two details matter for review. First, the allowlist setting added our origin to a built-in frame-ancestors list: on this install the header already allowed https://localhost:* and some DOSAYGO-operated domains, including https://*.dosaygo.com and cloudtabs.net hosts. Read the header your own deployment sends (curl -sI https://your-browser-host:port/) and decide whether that list is acceptable; do not assume it contains only your origin. Second, media-permissions="none" removed only the media capture features. Clipboard and geolocation stayed in the frame's allow list, so control those through browsing policy and your own requirements.

To start the parent page on the other loopback name for the allowlist test, run PARENT_ORIGIN=https://127.0.0.1:8765 python3 parent.py and open that address.

embedder-origin should be the actual parent origin. A raw iframe is a different integration surface: do not assume the custom element's attributes or API methods work on it. A permissive parent application's own content security policy, or a reverse proxy that changes headers, can also affect whether a frame loads, so diagnose each layer separately.

Not tested here: a remote or public host, publicly issued certificates, a reverse proxy, human mouse and keyboard input, resize, audio, browsers other than Chrome, Fleet, a second tenant, and whether an old login link still works after a later restart.

The CLI also offers a policy decision check. On the tested macOS host with v21.0.3 and its saved policy on the compat baseline, these commands produced the selected fields below:

bbx policy check --action navigate --url http://10.0.0.5/
bbx policy check --action navigate --url https://example.com/
allowed: false  reasonCode: private-network-allowlist-deny
allowed: true   reasonCode: navigation-open

These are decisions for two inputs, not actual connections or proof of tenant separation. Limit network egress independently, especially when customers can navigate to arbitrary URLs. The remote browser may have a route to addresses that a user's own device cannot reach. A private network allowlist, DNS behavior and firewall rules all need tests for the deployed topology.

The hyper-frame element is AGPL-3.0-or-later, separately from commercial BrowserBox. Review that license before shipping it in a SaaS front end. The example pins version 4.0.0 from a CDN; for production, serve a reviewed copy from your own origin.

BrowserBox requires a valid license, including for evaluation. A paid 7-day evaluation is available.

When not to choose BrowserBox

If you need a fully managed browser service and do not want to run or secure hosts, self-hosting adds work you may not want. If your product needs a documented hosted REST contract with no Linux pool operations, check the specific service and its terms rather than assuming Fleet is that API. If an air-gapped deployment is mandatory, the documented licensing connectivity is a blocker. If the AGPL license on the embed element does not fit how you ship your front end, settle that first. If your customer's workflow depends on a browser capability that does not work through the embedded view, verify an alternative before committing to the integration.

Request an evaluation.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.