Skip to content

After deleting the in-app browser firewall, public pages can reach loopback and LAN services #1539

Closed as not planned

Description

@SawyerHood

Warning

This is a consequence of #1537, deliberately accepted at the time, and it should be a conscious decision rather than a side effect. Recording it with a reproduction so it can be decided on evidence.

What changes

#1537 deletes the in-app browser's loopback/LAN request firewall, on the rationale that bb is local software the user controls and a page they opened reaching bb is intended.

That rationale covers a local page. It does not cover a public one. After #1537, any website opened in the in-app browser — not just a local dev app — can reach loopback and LAN services.

Reproduction

Real Electron 41 (Chromium 146) under Xvfb, driving the production createDesktopBrowserViewManager bundled from apps/desktop/src. The page is served from a public hostname mapped to this machine with --host-resolver-rules="MAP public.example 127.0.0.1", and opens a socket plus a no-cors fetch to a second loopback port.

With #1537 applied:

### page on PUBLIC hostname
[backend] WS ACCEPTED
[backend] HTTP REACHED
[report] public-page-ws-OPEN
[report] public-page-fetch-SENT

A plain Chromium window with identical webPreferences and no bb session hardening behaves the same, which establishes that Chromium 146 applies no Local Network Access check here — this is not something the browser engine will catch:

### plain Chromium, PUBLIC page
[backend] WS ACCEPTED
[backend] HTTP REACHED

I also confirmed the permission handlers are not involved: the only permission Chromium requests on this path is background-sync, and allowing every permission changes nothing.

The same applies to popups. resolveWindowOpenAction now accepts any http(s) target, so a public page can call window.open("http://127.0.0.1:38886/") and get an in-panel tab with no user address action. The popup rate limit bounds the count, not the target.

Not pre-existing

Before #1537 this was blocked. A public main frame committed no local origin key, so shouldBlockBrowserRequest denied its loopback subresources outright. #1537 introduces it.

What bb's own guards do and do not cover

#1536 gives bb's own services an origin guard, so a public page cannot drive the bb server, the host-daemon local API, or the machine-auth proxy. It does not protect anything else on the user's loopback or LAN — another dev server, a database admin UI, a router, a printer — which commonly trust any local client.

Options, if this should be closed

  1. Narrow request guard. Deny loopback/LAN targets when the initiating page is public; allow them when it is local. This is what the deleted firewall did, minus the same-origin-and-port restriction that broke Cross-port localhost WebSocket fails in in-app browser #1452. It restores the classification helpers, which Delete the in-app browser loopback firewall #1537 deleted on purpose.
  2. Accept it. Defensible if the in-app browser is understood as a tool for local development rather than general browsing. Worth stating in the browser panel's documentation so it is a known posture.

I did not implement either: option 1 reverses an explicit product decision, and that call belongs to the maintainer, not to the PR that carried it out.

Related: #1452 (the bug #1537 fixes), #1536 (the service guards), #1531, #1530.

AGENT GENERATED: by Claude Opus 5

Activity

  1. SawyerHood commented on Aug 13, 2026

    @SawyerHood
    CollaboratorAuthor

    Closing as intended behaviour. Sawyer reviewed the evidence below and accepted the residual.

    The reasoning: the in-app browser is local software the user controls, and a page they opened reaching a loopback port is intended. bb's own services are guarded at the service rather than by a blanket network firewall — #1536 makes /api/v1/*, the host-daemon local API, and the machine-auth proxy all reject foreign browser origins, so a public page cannot drive bb itself. What remains reachable is other software on the user's machine, and the bar there is that a normal browser behaves identically.

    Keeping the full evidence here so it survives the close and can be re-checked rather than trusted.

    Reproduction — real Electron 41 (Chromium 146) under Xvfb, driving the production createDesktopBrowserViewManager bundled from apps/desktop/src. The page is served from a public hostname mapped to this machine with --host-resolver-rules="MAP public.example 127.0.0.1", and opens a WebSocket plus a no-cors fetch to a second loopback port.

    With #1537 applied:

    ### bb manager, page on PUBLIC hostname
    [backend] WS ACCEPTED
    [backend] HTTP REACHED
    [report] public-page-ws-OPEN
    [report] public-page-fetch-SENT
    

    Control 1 — plain Chromium, no bb session hardening, identical webPreferences (sandbox, contextIsolation, webSecurity, allowRunningInsecureContent: false):

    ### plain Chromium, PUBLIC page
    [backend] WS ACCEPTED
    [backend] HTTP REACHED
    

    This is the load-bearing control: Chromium 146 applies no Local Network Access check on this path, so the residual is a property of the web platform as shipped, not of bb's configuration.

    Control 2 — permission handlers are not involved. The only permission Chromium requests on this path is background-sync. Re-running with every permission allowed changes nothing:

    [perm-check] background-sync -> true
    [report] public-page-ws-ERROR      (with the firewall still present)
    

    Scope of the change, for the record. This was introduced by #1537, not pre-existing: before it, a public main frame committed no local origin key and shouldBlockBrowserRequest denied its loopback subresources. The same now applies to window.open, which surfaces a loopback target as an in-panel tab; the native OS popup is still always denied.

    If this is ever revisited, the option not taken was a source-origin request guard — deny loopback and LAN targets when the initiating page is public, allow them when it is local. That is the deleted firewall minus the same-origin-and-port rule that caused #1452.

    Related: #1452, #1536, #1537, #1530, #1531.

    AGENT GENERATED: by Claude Opus 5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions