Skip to content

Add WebKit site permission handling #7

Description

@Andresshamis

Meridian Explorer automation, posting through @Andresshamis.

Priority: P1
Type: privacy / security / feature
Ready status: ready

Problem statement

Meridian does not yet have an explicit per-site permission model or WebKit delegate flow for privacy-sensitive browser permissions such as camera, microphone, geolocation, notifications, autoplay, and popup/new-window behavior.

Why it matters for Meridian

Permission prompts are a browser trust boundary. Meridian should not rely on implicit WebKit defaults or ad hoc view code for privacy-sensitive access. The product scope calls for per-site permissions where WebKit supports them, and the threat model already treats permission prompts as part of user trust.

Evidence

  • Sources/MeridianCore/WebKit/WebViewHost.swift sets webView.uiDelegate = context.coordinator, but the coordinator only implements createWebViewWith for target-frame-nil windows. It has no explicit media capture, permission, notification, autoplay, or durable popup decision handling.
  • Sources/MeridianCore/Stores/BrowserStore.swift has no site permission state or approval/deny action model.
  • Docs/ThreatModel.md lists user trust in permission prompts as an asset and explicitly calls out site permission state for camera, microphone, geolocation, notifications, popups, downloads, and autoplay as required follow-up.
  • Docs/WebKitLimitations.md says fine-grained permission APIs vary by macOS/WebKit version and need explicit implementation/testing.
  • Searches for existing open/closed issues around site permissions, popups, TLS/authentication, and WebKit permission handling found no dedicated issue.

Affected files/components

  • Sources/MeridianCore/WebKit/WebViewHost.swift
  • Sources/MeridianCore/Stores/BrowserStore.swift
  • Future site permission/security models, likely under Sources/MeridianCore/Security/ or Sources/MeridianCore/Models/
  • Browser UI for native permission prompts and per-site state
  • Docs/ThreatModel.md
  • Docs/WebKitLimitations.md
  • Future unit and UI tests

Expected behavior

When web content requests a privacy-sensitive permission or popup/new-window behavior that WebKit exposes, Meridian should make an explicit origin-aware decision: allow, deny, ask, or use the safest documented fallback. Decisions should be represented in browser state, persist only non-sensitive site settings where appropriate, and never grant access silently because a delegate method was omitted.

Proposed direction

Add a small site permission model/service that records origin, permission kind, decision, and timestamp without storing secrets or browsing contents. Wire supported WKUIDelegate/WebKit permission APIs into this model. Treat unsupported or unavailable WebKit APIs conservatively and document the limitation. Keep download-specific permission/risk handling in issue #5.

Acceptance criteria

  • A site permission model exists for camera, microphone, geolocation, notifications, autoplay, and popup/new-window behavior, with room to mark unsupported APIs explicitly.
  • WebKit permission delegate callbacks supported by the current macOS/WebKit target route through a dedicated service or store action instead of inline view-only decisions.
  • The default for unknown or unsupported permission requests is deny or ask, not silent allow.
  • Popup/new-window requests are routed through an explicit policy path and preserve source origin context.
  • Non-sensitive permission settings can be persisted later without storing cookies, credentials, tokens, private browsing data, or page contents.
  • Threat model and WebKit limitations docs distinguish implemented permission handling from unsupported WebKit limitations.
  • Unit tests cover policy defaults and at least one allow/deny path; UI or integration tests are planned or added once issue Add Xcode app project and UI test host #4 provides the app test host.

Dependencies/blockers

Suggested tests

  • Unit tests for permission default decisions by origin and permission kind.
  • Unit tests proving private browsing permission decisions are not persisted when persistence is added.
  • WebKit fixture or UI tests for media/popup prompts once an app test host exists.
  • Documentation test/review pass confirming unsupported WebKit permission APIs are listed rather than implied as supported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions