Skip to content

feat: expose wry permission handler API in tauri#14865

Open
F0RLE wants to merge 4 commits into
tauri-apps:devfrom
F0RLE:feat/permission-handler
Open

feat: expose wry permission handler API in tauri#14865
F0RLE wants to merge 4 commits into
tauri-apps:devfrom
F0RLE:feat/permission-handler

Conversation

@F0RLE
Copy link
Copy Markdown

@F0RLE F0RLE commented Jan 31, 2026

Description

This PR exposes the expanded wry Permission Handler API through Tauri, allowing applications and plugins to intercept, manage, and respond to WebView permission requests across supported backends.

It wires the permission handler through tauri-runtime, tauri-runtime-wry, Tauri core builders, individual webviews, and the plugin system. Until the matching wry changes are released, tauri-runtime-wry points at the corresponding wry PR revision.

Key Changes

  • Updated Enums: Added the expanded PermissionKind and PermissionResponse types to tauri-runtime and tauri-runtime-wry, mirroring wry's permission API. The permission kinds include DisplayCapture, Midi, Sensors, MediaKeySystemAccess, LocalFonts, WindowManagement, PointerLock, AutomaticDownloads, FileSystemAccess, and Autoplay.
  • Global App Hook: Added on_permission_request to tauri::Builder, allowing applications to intercept permission requests globally for all webviews.
  • Per-Webview Hook: Added on_permission_request to tauri::webview::WebviewBuilder and tauri::window::WebviewWindowBuilder, providing granular control for specific webviews/windows.
  • Plugin Integration: Added an on_permission_request callback to the Plugin trait and tauri::plugin::Builder, allowing plugins to handle permission requests for their own domain when the application does not override them.

Permission Resolution Order

Incoming permission requests now flow through a clear hierarchy:

  1. Webview-level Handler: Checked first via the individual webview's on_permission_request.
  2. App-level Handler: If the webview returns Default (or has no handler), the global tauri::Builder handler evaluates the request.
  3. Plugin Handlers: If the app handler also returns Default, the request iterates through registered plugins via PluginStore::on_permission_request.
  4. Wry / OS Default: If all handlers yield Default, the underlying wry implementation falls back to the native backend behavior.

@F0RLE F0RLE requested a review from a team as a code owner January 31, 2026 22:47
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 1, 2026

Package Changes Through 5662578

There are 9 changes which include tauri with minor, @tauri-apps/cli with minor, tauri-cli with minor, tauri-utils with patch, tauri-build with patch, tauri-macos-sign with patch, tauri-bundler with minor, tauri-runtime-wry with minor, tauri-runtime with minor

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
tauri-utils 2.8.1 2.8.2
tauri-macos-sign 2.3.2 2.3.3
tauri-bundler 2.7.5 2.8.0
tauri-runtime 2.9.2 2.10.0
tauri-runtime-wry 2.9.3 2.10.0
tauri-codegen 2.5.2 2.5.3
tauri-macros 2.5.2 2.5.3
tauri-plugin 2.5.2 2.5.3
tauri-build 2.5.3 2.5.4
tauri 2.9.5 2.10.0
@tauri-apps/cli 2.9.6 2.10.0
tauri-cli 2.9.6 2.10.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@F0RLE F0RLE force-pushed the feat/permission-handler branch from 5662578 to 3a3f629 Compare February 20, 2026 17:33
Exposes the with_permission_handler API from wry through Tauri's public
interface, allowing Tauri applications to programmatically handle webview
permission requests.

New public types in 	auri-runtime:
- PermissionKind - 17 variants matching wry's API, with Hash and Display.
  Display uses kebab-case (e.g. display-capture, pointer-lock).
- PermissionResponse - Allow, Deny, Default (default), Prompt. With Hash.

WebviewBuilder::on_permission_request accepts a closure called whenever
the webview requests a browser permission (media, geolocation, etc.).

Platform support mirrors wry:
- Windows (WebView2): Full coverage of all 12 permission kinds.
- macOS / iOS (WKWebView): Camera and microphone, secure Default behavior.
- Linux (WebKitGTK): UserMedia, Geolocation, Notifications, PointerLock.
  DisplayCapture fallback for WebKitGTK < 2.42.
- Android: Experimental support via JNI bridge.

Signed-off-by: F0RLE <lrshka.klim7766@gmail.com>
@F0RLE F0RLE force-pushed the feat/permission-handler branch 2 times, most recently from bec30a9 to 832652b Compare February 23, 2026 20:44
@F0RLE F0RLE force-pushed the feat/permission-handler branch from 832652b to 940e9c4 Compare February 24, 2026 05:22
@Legend-Master Legend-Master modified the milestone: 2.11 Mar 3, 2026
@Legend-Master Legend-Master modified the milestones: 2.11, 2.12 Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants