Skip to content

[codex] Update in-app browser localhost handling - #77

Merged
brsbl merged 4 commits into
get-bb:mainfrom
brsbl:otto/safe-localhost-browser-url-handling-11a7-pr
Jun 10, 2026
Merged

brsbl merged 4 commits into
get-bb:mainfrom
brsbl:otto/safe-localhost-browser-url-handling-11a7-pr

Conversation

@brsbl

@brsbl brsbl commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Default bare loopback address-bar inputs (localhost, *.localhost, 127.x, [::1]) to http:// while keeping public hosts on https://.
  • Route blocked local/private/mDNS/unsupported URL shapes to search instead of attempting unsafe navigation.
  • Replace the coarse local-request firewall with a per-WebContents loopback policy: trusted browser chrome can top-level navigate to loopback, and same-origin local subresources/WebSockets are allowed only when tied to a matching committed local frame.
  • Keep the Electron browser surface sandboxed and hardened: no preload, no Node integration, context isolation, web security, denied permissions/downloads, and added IPC/preload boundary coverage.
  • Ignore .otto/ workflow artifacts in git.

Why

The in-app browser needs to support developer workflows against localhost without broadening the sandbox or allowing renderer-driven access to private network targets. This keeps local loopback browsing usable while preserving the previous private/LAN/mDNS protections and tightening the attribution checks around local subresources.

Validation

Passed in the main workspace before preparing this clean PR branch:

  • pnpm exec turbo run test --filter=@bb/desktop -- --run test/desktop-browser-policy.test.ts test/desktop-browser-view-manager.test.ts test/preload-build.test.ts test/desktop-browser-main-ipc.test.ts test/preload-browser-api.test.ts
  • pnpm exec turbo run typecheck --filter=@bb/desktop
  • pnpm exec turbo run test --filter=@bb/app -- --run src/lib/browser-url.test.ts
  • pnpm exec turbo run typecheck --filter=@bb/app
  • git diff --check

After the final conservative desktop-policy patch, these focused checks also passed in the main workspace:

  • pnpm exec turbo run test --filter=@bb/desktop -- --run test/desktop-browser-policy.test.ts test/desktop-browser-view-manager.test.ts
  • pnpm exec turbo run typecheck --filter=@bb/desktop

Clean PR worktree verification was attempted, but the temporary worktree could not resolve workspace dependencies such as @bb/server-contract, @bb/tsconfig, and app Vite plugins from the shared install. Those failures were dependency-resolution setup failures in the temp worktree, not test assertion failures.

@brsbl
brsbl marked this pull request as ready for review June 10, 2026 21:54
@brsbl
brsbl merged commit 2ab2676 into get-bb:main Jun 10, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant