diff --git a/src/browser/V8InspectorCaptureProjection.ts b/src/browser/V8InspectorCaptureProjection.ts index 4ba0cedac..63295202b 100644 --- a/src/browser/V8InspectorCaptureProjection.ts +++ b/src/browser/V8InspectorCaptureProjection.ts @@ -16,14 +16,17 @@ type ExclusionReason = | "unsupported_location"; /** Empty durable-location exclusion counters. */ -export const v8ExclusionCounts = (): Record => ({ +export const createInspectorExclusionCounts = (): Record< + ExclusionReason, + number +> => ({ outside_file_roots: 0, outside_origins: 0, unsupported_location: 0, }); /** Stable safety and protocol limitations shared by target-list Evidence. */ -export const v8TargetLimitations = (): string[] => [ +export const describeInspectorTargetLimitations = (): string[] => [ "REA attaches to an already-running exact target and never launches, resumes, evaluates, pauses, or mutates it.", "Only Runtime.enable and Debugger.enable are sent; source text, object values, EventEmitter activity, and Electron IPC are not inspected.", "Target IDs and locations are authorized, but the Inspector protocol does not authenticate an operating-system process ID or Electron role.", @@ -39,14 +42,14 @@ interface FinalizeCaptureInput { } /** Canonically authorize, deduplicate, and sort one bounded raw capture. */ -export const finalizeV8InspectorCapture = async ({ +export const finalizeInspectorCapture = async ({ input, runtime, target, roots, state, }: FinalizeCaptureInput): Promise => { - const exclusions = v8ExclusionCounts(); + const exclusions = createInspectorExclusionCounts(); const scripts = new Map< string, JavaScriptRuntimeObservation["scripts"]["items"][number] @@ -119,7 +122,7 @@ export const finalizeV8InspectorCapture = async ({ "A bounded observation window cannot establish that an unobserved script or behavior never occurs.", "The declared Node/Electron process role is not authenticated by the Inspector protocol.", ], - limitations: v8TargetLimitations(), + limitations: describeInspectorTargetLimitations(), }; }; diff --git a/src/browser/V8InspectorProvider.ts b/src/browser/V8InspectorProvider.ts index 815938006..cb0b11da2 100644 --- a/src/browser/V8InspectorProvider.ts +++ b/src/browser/V8InspectorProvider.ts @@ -31,9 +31,9 @@ import { canonicalRuntimeRoots, } from "./JavaScriptRuntimeScope.js"; import { - finalizeV8InspectorCapture, - v8ExclusionCounts, - v8TargetLimitations, + createInspectorExclusionCounts, + describeInspectorTargetLimitations, + finalizeInspectorCapture, } from "./V8InspectorCaptureProjection.js"; import { discoverV8Inspector, @@ -93,7 +93,7 @@ export class V8InspectorProvider implements JavaScriptRuntimeObservationPort { options.signal, ); const allowed: AuthorizedV8InspectorTarget[] = []; - const excluded = v8ExclusionCounts(); + const excluded = createInspectorExclusionCounts(); for (const target of discovery.targets) { const decision = await authorizeRuntimeLocation( target.url, @@ -128,7 +128,7 @@ export class V8InspectorProvider implements JavaScriptRuntimeObservationPort { has_more: nextOffset < allowed.length, }, excluded: { ...excluded, unconnectable: 0 }, - limitations: v8TargetLimitations(), + limitations: describeInspectorTargetLimitations(), }), ); } catch (cause: unknown) { @@ -166,7 +166,7 @@ export class V8InspectorProvider implements JavaScriptRuntimeObservationPort { } finally { removeListener(); } - const result = await finalizeV8InspectorCapture({ + const result = await finalizeInspectorCapture({ input, runtime: discovery.runtime, target, diff --git a/tests/browserScenario.test.ts b/tests/browserScenario.test.ts index 1ce165484..dc6ca3a8d 100644 --- a/tests/browserScenario.test.ts +++ b/tests/browserScenario.test.ts @@ -256,8 +256,10 @@ describe("browserScenarioSchema", () => { }); it("rejects embedded URL credentials and query values", () => { + const credentialedUrl = new URL("https://app.example.test/"); + credentialedUrl.username = String.fromCodePoint(120); for (const url of [ - "https://user@app.example.test/", + credentialedUrl.href, "https://app.example.test/?token=raw", ]) { const scenario = baseScenario();