Skip to content

[bug]IPC breaks after using custom protocol #6889

@prestomation

Description

@prestomation

Describe the bug

This will be a fun one.

I'm seeing some very weird bug reports from users of my app.
This is a corporate app with some internal beta users using a Tauri app that is using the new remote IPC feature.

Our website on a remote origin uses the tauri API to communicate with our tauri app. Unrelated to Tauri, this website also opens some links using a custom protocol registered on the users OS, something like custom-protocol://.

The bug reports show that commands stop working after the user uses this custom protocol, where the scope checker thinks the current URL is the previous custom-protocol:// link even though the current origin is an allowlisted origin.

My bug reports and repro are on Windows.

tauribug

Reproduction

I have sort of repro'd this, although I don't have full instructions. The gist of it is:

  1. Have a tauri app running on a remote origin that is whitelisted
  2. Navigate to a custom protocol. It doesn't even need to be a real one/registered
  3. Notice that you get an error and you are still on your intended origin.
  4. Now invoke a tauri command and notice you get the IPC error. The URL in the error is the custom-protocol from above.

I've attached a screenshot showing me performing this repro in the dev tools. I understand it's kind of incomplete but I think the description above should be enough to understand what's going on.

Expected behavior

I expect tauri commands to continue to work when i'm on my origin and for custom procotols to not break this.

Platform and versions

[✔] Environment
    - OS: Windows 10.0.19045 X64
    ✔ WebView2: 112.0.1722.68
    ✔ MSVC: Visual Studio Build Tools 2022
    ✔ rustc: 1.68.0 (2c8cc3432 2023-03-06)
    ✔ Cargo: 1.68.0 (115f34552 2023-02-26)
    ✔ rustup: 1.25.2 (17db695f1 2023-02-01)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (environment override by RUSTUP_TOOLCHAIN)
    - node: 18.15.0
    - npm: 9.5.0

[-] Packages
    - tauri [RUST]: 1.3.0
    - tauri-build [RUST]: 1.3.0
    - wry [RUST]: 0.24.1
    - tao [RUST]: 0.16.0
    - @tauri-apps/api [NPM]: 1.2.0 (outdated, latest: 1.3.0)
    - @tauri-apps/cli [NPM]: 1.3.0

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist
    - devPath: http://localhost:1420/
    - framework: React
    - bundler: Vite

Stack trace

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: 1 highHigh priority bugs/missing features or non-crashing regressionsstatus: needs triageThis issue needs to triage, applied to new issuestype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions