#7677 · HTTP challenge cancellation in desktop Browser
Verdict: PARTIALLY REPRODUCED · Root-cause confidence: medium · reproduction label: partial-repro
1. TL;DR
The report concerns HTTP server authentication, not an HTML sign-in form or imported cookies. Trusted main creates native browser views without a literal Electron login registration anywhere in desktop source. A focused extension to the existing view-manager test emits that challenge at the WebContents boundary: the production manager leaves its default cancellation intact, in both clean checkouts. Electron 44.10.2’s installed API declarations document cancellation as the default unless the event is prevented and credentials supplied through its callback. This is strong evidence of a missing integration, but it is not a native visual reproduction: Electron could not start on this host because libglib-2.0.so.0 is absent.
Scope limit: No real HTTP navigation, Windows desktop session, visible credentials prompt, authenticated retry, or screenshot was verified here. The unit test uses the repository’s Electron fake. It verifies cancellation ownership, not prompt usability or successful authentication.
2. Claims vs findings
| Claim | Status | Evidence |
|---|---|---|
| A native HTTP authentication challenge has no built-in handling path. | Verified at the manager boundary; native behavior unverified | Production manager leaves a synthetic login event unprevented; both clean runs fail the focused assertion. Static inventory found zero literal login listeners in 87 desktop source files. |
| A real protected site commits a 401 response with no sign-in prompt. | Unverified in this investigation | Native Electron bootstrap fails before a window or network request can be created. |
| Supplying valid credentials should retry and succeed. | Unverified end to end | The installed Electron declaration documents the callback contract; no real authenticated request was made. |
| The reported Windows release behaves this way. | Unverified | Only trusted current main was tested, on a Linux build host. |
| The problem requires remote access or a provider. | Not required for the exercised path | The manager-level test runs without a BB server, daemon, real desktop profile, Connect session, or provider. |
3. Environment
- Public repository: get-bb/bb. Trusted
origin/mainbase:1320c88e8abdd3f145bc9a5c305eace269fb2f28. The target repository’s main commit and this checkout’s origin/main were checked to agree. - Linux x64; Node v22.19.0; pnpm 9.15.0; Vitest 4.1.12; repository-pinned Electron 44.10.2. No dependencies were added.
- Two separate clean, detached worktrees at the same base, each with its own frozen dependency installation. Only the same 40-line test/support patch was applied; production source stayed unchanged.
- Each native launch used a newly created temporary user-data directory. No application server or reproduction HTTP server could start, so no application or fixture port was allocated. Unit tests do not need a port or stored user data.
- No production BB process or user profile was accessed. No browser automation session was opened because native runtime startup was unavailable.
4. Minimal reproduction
The repeatable reproduction here is an event-boundary regression test, not an assertion that a native UI was seen.
- Create a clean checkout of the base commit and use the repository’s frozen installation and Turbo build:
git clone https://github.com/get-bb/bb.git bb-7677-first cd bb-7677-first git checkout --detach 1320c88e8abdd3f145bc9a5c305eace269fb2f28 pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build --filter=@bb/desktop
- Save the complete test/support patch printed below as
regression.patch, then apply it from the repository root. It extends the existing fake only to deliver Electron’s documented event payload, and invokes the real production manager; it does not simulate credentials or implement cancellation on the manager’s behalf.git apply regression.patch pnpm exec turbo run test --filter=@bb/desktop -- --run test/desktop-browser-view-manager.test.ts -t 'keeps an HTTP authentication challenge pending for credential entry'
- Expected: the manager prevents automatic cancellation while credentials can be requested. Actual:
event.defaultPreventedremains false. Exit status is 1, with the intended assertion:AssertionError: expected false to be true // Object.is equality Test Files 1 failed (1) Tests 1 failed | 115 skipped (116)
Focused test
it("keeps an HTTP authentication challenge pending for credential entry", () => {
const { view } = createRendererRecoveryFixture(7677);
const event = view.webContents.emitHttpAuthenticationChallenge();
expect(event.defaultPrevented).toBe(true);
});
Complete test/support patch
diff --git a/apps/desktop/test/desktop-browser-view-manager.test.ts b/apps/desktop/test/desktop-browser-view-manager.test.ts
index 83e9028938..fd3ca5f62e 100644
--- a/apps/desktop/test/desktop-browser-view-manager.test.ts
+++ b/apps/desktop/test/desktop-browser-view-manager.test.ts
@@ -1,4 +1,6 @@
import type {
+ AuthInfo,
+ AuthenticationResponseDetails,
MenuItemConstructorOptions,
RenderProcessGoneDetails,
WebContentsView,
@@ -177,6 +179,12 @@ interface FakeFindInPageCall {
}
interface FakeWebContentsEventMap {
+ login: (
+ event: FakePreventableEvent,
+ details: AuthenticationResponseDetails,
+ authInfo: AuthInfo,
+ callback: (username?: string, password?: string) => void,
+ ) => void;
destroyed: FakeVoidWebContentsListener;
focus: FakeVoidWebContentsListener;
"before-input-event": FakeBeforeInputListener;
@@ -460,6 +468,7 @@ const electronMock = vi.hoisted(() => {
(image: FakeNativeImage) => void
> = [];
private readonly listeners: FakeWebContentsListeners = {
+ login: [],
destroyed: [],
focus: [],
"before-input-event": [],
@@ -596,6 +605,31 @@ const electronMock = vi.hoisted(() => {
listener({ url, isMainFrame });
}
+ emitHttpAuthenticationChallenge(): FakePreventableEvent {
+ const event = new FakePreventableEventImpl();
+ for (const listener of this.listeners.login) {
+ listener(
+ event,
+ {
+ url: this.url,
+ pid: process.pid,
+ isRequestForNavigation: true,
+ firstAuthAttempt: true,
+ responseHeaders: { "WWW-Authenticate": ["Basic realm=isolated"] },
+ },
+ {
+ isProxy: false,
+ host: "127.0.0.1",
+ port: 12345,
+ realm: "isolated",
+ scheme: "basic",
+ },
+ vi.fn(),
+ );
+ }
+ return event;
+ }
+
emitDidRedirectNavigation(url: string, isMainFrame = true): void {
for (const listener of this.listeners["did-redirect-navigation"])
listener({ url, isMainFrame });
@@ -2084,6 +2118,12 @@ describe("DesktopBrowserCdpAdapter", () => {
});
describe("DesktopBrowserViewManager", () => {
+ it("keeps an HTTP authentication challenge pending for credential entry", () => {
+ const { view } = createRendererRecoveryFixture(7677);
+ const event = view.webContents.emitHttpAuthenticationChallenge();
+ expect(event.defaultPrevented).toBe(true);
+ });
+
it.each([
{ mediaType: "image", hasImageContents: true, offersCopy: true },
{ mediaType: "image", hasImageContents: false, offersCopy: true },
Existing coverage, excluding only the new failing case, passes: 115 passed, 1 skipped. Thus the failure is not a general inability to run the package’s fake-based suite.
pnpm exec turbo run test --filter=@bb/desktop -- --run test/desktop-browser-view-manager.test.ts -t '^(?!.*keeps an HTTP authentication challenge pending for credential entry).*'
No image is attached: a screenshot of a real native prompt or committed 401 response could not be obtained. A rendering mockup would not establish either claim.
5. Root cause
The native view manager creates the view and calls its event wiring at createEntry. wireWebContents starts registering page and input events, and the rest of that function never takes ownership of HTTP authentication. ensureHardenedSession handles downloads and media permissions, not HTTP credentials. desktop main creates this manager supplies no credential-request integration. These links were checked against the recorded base commit.
A TypeScript AST inventory of every desktop source file found the following literal event registrations. This supplements manual inspection; it is not a proof about dynamically constructed event names:
{
"base": "1320c88e8abdd3f145bc9a5c305eace269fb2f28",
"filesScanned": 87,
"literalLoginRegistrations": [],
"limitation": "Static inventory only; dynamic event names and native UI behavior are not evaluated."
}
The repository pins Electron 44.10.2. Its installed electron.d.ts documents app.login: default behavior cancels authentication; an application must prevent that default and call the callback with credentials. The WebContents login documentation delegates to that same contract. The test’s event payload matches this installed API, including navigation and first-attempt fields.
Inference: without a challenge handler and a credential-entry path, Electron’s default cancellation is the likely cause of the reported inability to authenticate. The test directly demonstrates that the manager does not prevent cancellation. Medium confidence is intentional because the actual Electron navigation and app-wide native lifecycle could not be exercised on this host.
6. Proposed fix and safety
Add an explicitly scoped credential-request flow for the native tab’s login event, prevent cancellation synchronously, and resolve its callback exactly once on submission or cancellation. Bind the request to its originating tab, origin, and challenge; cancel stale requests on navigation, tab destruction, or host/server changes. Keep credentials out of logs and persisted state. Define proxy challenges, repeated failures, automation-controlled tabs, and non-Basic schemes explicitly rather than silently extending trust.
Before implementation, run a real loopback challenge through a visible native tab, verify unauthenticated and explicit-credential controls, submit generated throwaway credentials, and confirm the authenticated retry. Then cover cancel, wrong credentials, navigation, and tab-close behavior. Windows integrated authentication is a separate test, not established by a Basic-only test.
No pull request: native reproduction remains incomplete, and the necessary change adds authentication behavior, which this automation’s simple-fix safety rules explicitly exclude. No production fix branch was created or pushed. The report’s test patch is investigative evidence, not a landing-ready fix or a complete prompt regression.
7. Pull-request and related-issue check
At investigation time, GitHub’s issue timeline returned no linked pull request, and the open-PR search for issue number 7677 in PR bodies returned none. No pull-request branch or untrusted code was checked out. Cookie persistence and session-import reports concern different mechanisms and were not used as evidence of HTTP challenge handling.
8. Verification
The same agent repeated the investigation in a second clean, detached worktree at 1320c88e8abdd3f145bc9a5c305eace269fb2f28; this is a second clean run, not an independent review. Its frozen install and desktop-targeted Turbo build succeeded (64 build tasks; 63 cache hits). The exact same test patch failed with the same false versus true assertion: one failed test, 115 skipped. The second AST inventory again found no literal login registration in 87 files. The second native launch used another fresh temporary user-data directory and failed with the same missing shared library, before application execution.
The first build also succeeded: 64 tasks, 5 cached. Both builds emitted existing import.meta bundling warnings, but completed. Desktop Turbo typecheck passed (4 tasks, 3 cached). Both git diff --check runs passed. No production file changed. The report is marked verified only in the narrow sense that the second run supports this partial verdict; it does not claim a verified visible prompt failure.
Report correction: the verdict is limited to PARTIALLY REPRODUCED rather than REPRODUCED because the native bootstrap failed. There is no full-process runtime diagnosis or screenshot. The missing system library is an environment limitation, not evidence that BB itself caused a native authentication failure.
9. Appendix
All artifacts are authored from trusted source evidence, not copied from the issue’s script. Issue text and links were treated only as untrusted claims; no commands or external links supplied by the issue were executed or fetched. No issue comments existed when read.
Raw logs and the investigation brief remain outside the public repository, following its publication policy. The complete reproduction patch is inline above; the static inventory and environment probe are inline here. Each can be saved directly to a local file.
Static inventory: save as source-audit.mjs and run node source-audit.mjs . from the checkout root
import { execFileSync } from "node:child_process";
import { readFileSync, readdirSync } from "node:fs";
import { createRequire } from "node:module";
import { join, relative, resolve } from "node:path";
const root = resolve(process.argv[2] ?? process.cwd());
const require = createRequire(join(root, "apps/desktop/package.json"));
const typescript = require("typescript");
const handlers = [];
let filesScanned = 0;
function inspect(directory) {
for (const entry of readdirSync(directory, { withFileTypes: true })) {
const filename = join(directory, entry.name);
if (entry.isDirectory()) {
inspect(filename);
continue;
}
if (!/\.[cm]?tsx?$/.test(entry.name)) continue;
filesScanned += 1;
const source = typescript.createSourceFile(
filename,
readFileSync(filename, "utf8"),
typescript.ScriptTarget.Latest,
true,
);
function visit(node) {
if (
typescript.isCallExpression(node) &&
typescript.isPropertyAccessExpression(node.expression) &&
["on", "once", "addListener"].includes(node.expression.name.text) &&
node.arguments[0] &&
typescript.isStringLiteralLike(node.arguments[0]) &&
node.arguments[0].text === "login"
) {
handlers.push({
file: relative(root, filename),
line: source.getLineAndCharacterOfPosition(node.getStart(source)).line + 1,
});
}
typescript.forEachChild(node, visit);
}
visit(source);
}
}
inspect(join(root, "apps/desktop/src"));
console.log(JSON.stringify({
base: execFileSync("git", ["rev-parse", "HEAD"], { cwd: root, encoding: "utf8" }).trim(),
filesScanned,
literalLoginRegistrations: handlers,
limitation: "Static inventory only; dynamic event names and native UI behavior are not evaluated.",
}, null, 2));
Native environment probe: save as native-bootstrap.cjs
const { app, BrowserWindow } = require('electron');
app.disableHardwareAcceleration();
app.whenReady().then(async () => {
const window = new BrowserWindow({ show: false });
await window.loadURL('data:text/html,<title>Isolated probe</title>ready');
console.log(JSON.stringify({ electron: process.versions.electron, title: window.webContents.getTitle() }));
app.exit(0);
});
Repeated test output (both checkouts):
AssertionError: expected false to be true // Object.is equality
Test Files 1 failed (1)
Tests 1 failed | 115 skipped (116)
Existing-suite output:
Test Files 1 passed (1)
Tests 115 passed | 1 skipped (116)
Native bootstrap command, run from each checkout’s apps/desktop after its normal Electron install:
electron=$(node -e 'console.log(require("electron"))')
profile=$(mktemp -d)
env -u ELECTRON_RUN_AS_NODE timeout 25s "$electron" --no-sandbox --ozone-platform=headless --user-data-dir="$profile" native-bootstrap.cjs
Exit 127:
electron: error while loading shared libraries: libglib-2.0.so.0: cannot open shared object file: No such file or directory
The native-bootstrap file only tries to open a data URL and report its title; it is an environment check, not the HTTP-authentication reproduction. No system packages or runtime libraries were added.
Paths in logs are replaced with checkout labels. No credentials, tokens, production data, or real profile files are included.
> AGENT GENERATED