Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion config/releases/0.7.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
"product_version": "0.7.0",
"chromium_version": "159.0.8154.13",
"integration_repository": "BrowserOperator/browser-operator-core",
"required_merged_pr": 114,
"required_merged_pr": 115,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Gate publication on the declared final PR

When PR115, PR114, and build-script PR1 are merged but PR116 is not, require_merged_release() will accept a candidate matching PR115 because it treats this field as the integration merge and never checks PR116. This contradicts the commit's stated final policy that PR116 completes the release source tree and requires an owner merge, allowing the pre-PR116 tree to be published; make PR116 the required merge and retain PR115 among the additional prerequisites.

Useful? React with 👍 / 👎.

"required_base_branch": "main",
"allowed_mergers": [
"tysonthomas9"
],
"additional_merged_prs": [
{
"repository": "BrowserOperator/browser-operator-core",
"number": 114,
"base_branch": "main"
},
{
"repository": "BrowserOperator/build-script",
"number": 1,
Expand Down
12 changes: 10 additions & 2 deletions docs/chromium-159-stable-refresh.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ two toolbar icons are retained. The earlier 159.0.8144.0 test series is not
used: it lacks the latest AI update and branding patches and belongs to a
different Chromium build branch.

Chromium 159 also requires the `devtools_frontend_zip` GN target for its Blink
archive/SBOM integration. The fork carries the pinned stock target and unchanged
ZIP helper, plus locale metadata for remote files. Actual archive verification
passed: all 2,951 expected fork resources, the AI bundle and all 80 remote
locales are present; repeated generation produces identical bytes. This
preserves the fork's frontend resources in the new archive.

Patch conflicts retain upstream 159 additions and removals. Parsed XML checks
preserve every active upstream message ID, including whitespace-formatted
attributes that text matching misses. The custom manual-update fallback ID is
Expand Down Expand Up @@ -43,8 +50,9 @@ against the fork separately. Existing AI behavior and security backports must
survive. A successful stock sync alone is not runtime security qualification.

The release policy names this exact engine version and still requires owner
merge of core PR114 and build-script PR1. PR114 remains stacked on integration
PR111; retarget it to `main` after its parent merges. No candidate upload,
merge of the final security PR115, parent core PR114 and build-script PR1.
The stack is PR111 → PR114 → PR115; retarget each child to `main` after its
parent merges. The signed candidate must match PR115's final merged tree. No candidate upload,
public release or production Omaha catalog promotion is authorized before the
matching owner merges. Windows follows completed Mac qualification through the
same entry point, with a version-aware Windows backend and actual tests.
Expand Down
43 changes: 43 additions & 0 deletions docs/devtools-159-security-backports.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# DevTools security changes for Chromium 159

Reviewed stock DevTools from `047c90eca37c7170d826d72245d5df9281989cf3`
to Chromium 159.0.8154.13's pinned
`3d48567555b6795967c376050698efe2bf4f0f98`. The stock delta spans 1,572 files;
this change carries targeted protections into the older fork while retaining
Browser Operator's custom AI panel and previous HTML/font-CSS security fixes.
It does not claim a complete merge of stock DevTools or exhaustive security parity.

The extension `openResource` API now checks the caller's runtime host policy
before revealing source code, page resources or network requests. This follows
the stock implementation, including its distinction between an apparent
`sourceURL` and the script's actual inspected target. Denied resources return a
permission error before resource/network lookup. Allowed custom-scheme scripts
continue to open when their inspected target is permitted.

Stock 159 also has a newer security-origin framework that this fork does not
have. The inherited Google FileAgent therefore receives a conservative adapted
mitigation: only ordinary HTTP(S) network files can share a web origin, and
scripts additionally require known non-synthetic bindings with matching source
origins. Source-mapped, synthetic, local, malformed, opaque and unverifiable
files use a unique identity per file. Provenance is recomputed on every use;
only the opaque identity is cached. Ambiguous files require separate chats.

The inherited agent backend now blocks disallowed context before refreshing or
serializing it and rechecks after asynchronous work and before model requests.
This protects direct backend calls and provenance changes while the UI awaits
data. Browser Operator's separate `panels/ai_chat` implementation is unchanged.

Validation: targeted frontend build with full TypeScript checking passed;
all 80 tests across ExtensionServer, AiAgent and FileAgent passed in actual
headless Browser Operator 158 using disposable test profiles. New regressions
cover denied resource lookups, allowed custom schemes, misleading source URLs,
per-file opaque identities and origin changes during refresh, enhancement and
generator suspension. The extension fixture waits for its mock resource tree
before changing the inspected URL. Targeted ESLint passed.

These results qualify the frontend changes before compiling 159. They do not
substitute for testing the final signed 159 ARM64/universal apps, native updater
or mounted DMGs. Release publication stays held for the matching owner merges.

This is PR115, stacked on PR114. Its final source tree is the required release
merge; parent PR114 and build-script PR1 must also be merged by the owner.
62 changes: 62 additions & 0 deletions front_end/models/ai_assistance/agents/AiAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,68 @@ describeWithEnvironment('AiAgent', () => {
}
return new TestContext();
}

it('blocks a cross-origin selection before refreshing or serializing it', async () => {
const client = mockAidaClient([[{explanation: 'answer'}]]);
const agent = new AiAgentMock({aidaClient: client});
await Array.fromAsync(agent.run('first', {selected: getTestContext('https://a.test')}));
const selected = getTestContext('https://b.test');
const refresh = sinon.spy(selected, 'refresh');
const enhance = sinon.spy(agent, 'enhanceQuery');
const details = sinon.spy(agent, 'handleContextDetails');
assert.deepEqual(await Array.fromAsync(agent.run('second', {selected})), [
{type: ResponseType.ERROR, error: ErrorType.BLOCK},
]);
sinon.assert.notCalled(refresh);
sinon.assert.notCalled(enhance);
sinon.assert.notCalled(details);
sinon.assert.calledOnce(client.doConversation as sinon.SinonStub);
});

it('blocks an origin change during the first context refresh', async () => {
const client = mockAidaClient();
const agent = new AiAgentMock({aidaClient: client});
const selected = getTestContext('https://a.test');
let origin = 'https://a.test';
sinon.stub(selected, 'getOrigin').callsFake(() => origin);
sinon.stub(selected, 'refresh').callsFake(async () => { origin = 'https://b.test'; });
const enhance = sinon.spy(agent, 'enhanceQuery');
assert.deepEqual(await Array.fromAsync(agent.run('question', {selected})), [
{type: ResponseType.ERROR, error: ErrorType.BLOCK},
]);
sinon.assert.notCalled(enhance);
sinon.assert.notCalled(client.doConversation as sinon.SinonStub);
});

it('does not send a query if provenance changes during enhancement', async () => {
const client = mockAidaClient();
const agent = new AiAgentMock({aidaClient: client});
const selected = getTestContext('https://a.test');
let origin = 'https://a.test';
sinon.stub(selected, 'getOrigin').callsFake(() => origin);
sinon.stub(agent, 'enhanceQuery').callsFake(async () => {
origin = 'https://b.test';
return 'private file content';
});
assert.deepEqual(await Array.fromAsync(agent.run('question', {selected})), [
{type: ResponseType.ERROR, error: ErrorType.BLOCK},
]);
sinon.assert.notCalled(client.doConversation as sinon.SinonStub);
});

it('rechecks provenance when the consumer resumes a yielded query', async () => {
const client = mockAidaClient();
const agent = new AiAgentMock({aidaClient: client});
const selected = getTestContext('https://a.test');
let origin = 'https://a.test';
sinon.stub(selected, 'getOrigin').callsFake(() => origin);
const run = agent.run('question', {selected});
assert.strictEqual((await run.next()).value?.type, ResponseType.USER_QUERY);
origin = 'https://b.test';
assert.deepEqual((await run.next()).value, {type: ResponseType.ERROR, error: ErrorType.BLOCK});
sinon.assert.notCalled(client.doConversation as sinon.SinonStub);
});

it('checks context origins', () => {
const tests = [
{
Expand Down
44 changes: 32 additions & 12 deletions front_end/models/ai_assistance/agents/AiAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,8 @@ export abstract class ConversationContext<T> {
if (!agentOrigin) {
return true;
}
// Currently does not handle opaque origins because they
// are not available to DevTools, instead checks
// that serialization of the origin is the same
// https://html.spec.whatwg.org/#ascii-serialisation-of-an-origin.
// File contexts use a unique identity when provenance cannot establish a
// web origin. Equal serialized "null" origins must not authorize a switch.
return this.getOrigin() === agentOrigin;
}

Expand Down Expand Up @@ -489,19 +487,33 @@ export abstract class AiAgent<T> {
signal?: AbortSignal,
},
multimodalInput?: MultimodalInput): AsyncGenerator<ResponseData, void, void> {
await options.selected?.refresh();
const selected = options.selected;
const selectedOrigin = selected?.getOrigin();
const contextAllowed = (): boolean => !selected ||
(selected.getOrigin() === selectedOrigin && selected.isOriginAllowed(this.#origin));
if (!contextAllowed()) {
yield this.#createErrorResponse(ErrorType.BLOCK);
return;
}
await selected?.refresh();
if (!contextAllowed()) {
yield this.#createErrorResponse(ErrorType.BLOCK);
return;
}

if (options.selected) {
if (selected) {
// First context set on the agent determines its origin from now on.
if (this.#origin === undefined) {
this.#origin = options.selected.getOrigin();
}
if (options.selected.isOriginAllowed(this.#origin)) {
this.context = options.selected;
this.#origin = selectedOrigin;
}
this.context = selected;
}

const enhancedQuery = await this.enhanceQuery(initialQuery, options.selected, multimodalInput?.type);
const enhancedQuery = await this.enhanceQuery(initialQuery, selected, multimodalInput?.type);
if (!contextAllowed()) {
yield this.#createErrorResponse(ErrorType.BLOCK);
return;
}
Host.userMetrics.freestylerQueryLength(enhancedQuery.length);

let query: Host.AidaClient.Part|Host.AidaClient.Part[];
Expand All @@ -516,12 +528,20 @@ export abstract class AiAgent<T> {
imageId: multimodalInput?.id,
};

yield* this.handleContextDetails(options.selected);
if (!contextAllowed()) {
yield this.#createErrorResponse(ErrorType.BLOCK);
return;
}
yield* this.handleContextDetails(selected);

for (let i = 0; i < MAX_STEPS; i++) {
yield {
type: ResponseType.QUERYING,
};
if (!contextAllowed()) {
yield this.#createErrorResponse(ErrorType.BLOCK);
return;
}

let rpcId: Host.AidaClient.RpcGlobalId|undefined;
let textResponse = '';
Expand Down
48 changes: 48 additions & 0 deletions front_end/models/ai_assistance/agents/FileAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file.

import * as Host from '../../../core/host/host.js';
import * as Platform from '../../../core/platform/platform.js';
import * as SDK from '../../../core/sdk/sdk.js';
import {createUISourceCode, mockAidaClient} from '../../../testing/AiAssistanceHelpers.js';
import {
Expand Down Expand Up @@ -38,6 +39,53 @@ describeWithMockConnection('FileAgent', () => {
});
});

describe('context provenance', () => {
it('keeps synthetic, mapped and opaque files isolated while preserving each file identity', async () => {
const file = await createUISourceCode();
assert.exists(file);
sinon.stub(file.project(), 'type').returns(Workspace.Workspace.projectTypes.Network);
const context = new FileContext(file);
const binding = Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance();
const scripts = sinon.stub(binding, 'scriptsForUISourceCode');
const script = sinon.createStubInstance(SDK.Script.Script);
script.sourceURL = file.url();
script.hasSourceURL = false;
scripts.returns([script]);
assert.strictEqual(context.getOrigin(), 'http://example.test');
script.hasSourceURL = true;
const opaque = context.getOrigin();
assert.notStrictEqual(opaque, 'http://example.test');
assert.strictEqual(new FileContext(file).getOrigin(), opaque);
script.hasSourceURL = false;
assert.strictEqual(context.getOrigin(), 'http://example.test');
scripts.returns([]);
assert.strictEqual(context.getOrigin(), opaque);
scripts.throws(new Error('missing binding'));
assert.strictEqual(context.getOrigin(), opaque);
const other = await createUISourceCode({url: Platform.DevToolsPath.urlString`data:text/javascript,other`});
assert.exists(other);
assert.notStrictEqual(new FileContext(other).getOrigin(), opaque);
assert.notStrictEqual(new FileContext(other).getOrigin(), 'null');
});

it('never trusts a source map or mismatched script origin', async () => {
const file = await createUISourceCode();
assert.exists(file);
sinon.stub(file.project(), 'type').returns(Workspace.Workspace.projectTypes.Network);
const context = new FileContext(file);
const script = sinon.createStubInstance(SDK.Script.Script);
script.sourceURL = 'https://attacker.test/script.js' as typeof script.sourceURL;
script.hasSourceURL = false;
sinon.stub(Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance(), 'scriptsForUISourceCode')
.returns([script]);
const opaque = context.getOrigin();
assert.notStrictEqual(opaque, 'http://example.test');
script.sourceURL = file.url();
sinon.stub(file.contentType(), 'isFromSourceMap').returns(true);
assert.strictEqual(context.getOrigin(), opaque);
});
});

describe('buildRequest', () => {
it('builds a request with a model id', async () => {
mockHostConfig('test model');
Expand Down
34 changes: 32 additions & 2 deletions front_end/models/ai_assistance/agents/FileAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import * as Host from '../../../core/host/host.js';
import * as i18n from '../../../core/i18n/i18n.js';
import * as Root from '../../../core/root/root.js';
import type * as Workspace from '../../workspace/workspace.js';
import * as Bindings from '../../bindings/bindings.js';
import * as Workspace from '../../workspace/workspace.js';
import {FileFormatter} from '../data_formatters/FileFormatter.js';

import {
Expand Down Expand Up @@ -74,6 +75,10 @@ const UIStringsNotTranslate = {

const lockedString = i18n.i18n.lockedString;

// Opaque contexts must not share the URL API's serialized "null" origin.
const opaqueFileOrigins = new WeakMap<Workspace.UISourceCode.UISourceCode, string>();
let nextOpaqueFileOrigin = 0;

export class FileContext extends ConversationContext<Workspace.UISourceCode.UISourceCode> {
#file: Workspace.UISourceCode.UISourceCode;

Expand All @@ -83,7 +88,32 @@ export class FileContext extends ConversationContext<Workspace.UISourceCode.UISo
}

override getOrigin(): string {
return new URL(this.#file.url()).origin;
// Recompute trust on every use: a rename, new script binding or refreshed
// source map can change provenance while this context object stays alive.
try {
const url = new URL(this.#file.url());
const type = this.#file.contentType();
if ((url.protocol === 'https:' || url.protocol === 'http:') &&
this.#file.project().type() === Workspace.Workspace.projectTypes.Network && !type.isFromSourceMap()) {
if (!type.isScript()) {
return url.origin;
}
const scripts = Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance()
.scriptsForUISourceCode(this.#file);
if (scripts.length && scripts.every(script =>
!script.hasSourceURL && new URL(script.sourceURL).origin === url.origin)) {
return url.origin;
}
}
} catch {
// Missing bindings and malformed/unverifiable URLs are opaque too.
}
let origin = opaqueFileOrigins.get(this.#file);
if (!origin) {
origin = `opaque-file:${++nextOpaqueFileOrigin}:${crypto.randomUUID()}`;
opaqueFileOrigins.set(this.#file, origin);
}
return origin;
}

override getItem(): Workspace.UISourceCode.UISourceCode {
Expand Down
Loading
Loading