Skip to content

Use URL parsing and opener isolation for prompter popout windows #150

Description

@Brad-Edwards

Review finding

The prompter popout helper builds URLs with string replacement and opens a _blank window without explicit opener isolation.

Evidence

  • src/system/presenter/prompter-window.ts:15 uses baseUrl.includes('mode=') and baseUrl.replace(/mode=[^&]*/, 'mode=prompter') instead of URL parsing.
  • src/system/presenter/prompter-window.ts:17 appends &mode=prompter to any string containing ?, which places the mode parameter after #fragment for hash URLs.
  • src/system/presenter/prompter-window.ts:32 calls window.open(url, '_blank', features) with default features that omit noopener,noreferrer.

Impact

URLs with query values that contain mode= can be corrupted, and hash URLs may not actually enter prompter mode. If an external URL ever flows through this exported helper, the opened page can retain window.opener access unless the browser applies stronger defaults.

Recommended fix

Use the platform URL API and explicit opener isolation.

Acceptance checks

  • Build the prompter URL with new URL(baseUrl, window.location.href) and searchParams.set('mode', 'prompter').
  • Preserve hashes and unrelated query parameters.
  • Restrict or normalize to same-origin unless a future requirement explicitly allows external prompter targets.
  • Add noopener,noreferrer to the feature string and defensively null opened.opener where possible.
  • Tests cover existing mode, a query value containing mode=, hash URLs, relative URLs, and absolute same-origin URLs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:navigationURL grammar, workbench mode dispatch, browser routingarea:prompterPrompter view, caption-derived scriptbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions