tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
79.88k stars 2.37k forks source link

[bug] IPC perms for plugins not given to window created from rust #7599

Closed ImUrX closed 11 months ago

ImUrX commented 11 months ago

Describe the bug

If you create the main window from rust and try using plugins on it, it wont have IPC permissions to do so, this only happens on windows tho, on Linux this just works. I bypassed this by just giving IPC perms to the main window manually

"dangerousRemoteDomainIpcAccess": [
  {
    "domain": "tauri.localhost",
    "windows": ["main"],
    "plugins": ["dialog", "fs", "os", "shell", "window"]
  }
]

Reproduction

Please remind me in a week if I havent done it yet, I'm making an issue just to not forget this exists :sob:

Expected behavior

No response

Platform and versions

[✘] Environment
    - OS: NixOS 23.11.0 X64
    ✔ webkit2gtk-4.1: 2.40.5
    ✘ rsvg2: not installed
      Visit https://tauri.app/v1/guides/getting-started/prerequisites to learn more about tauri prerequisites
    ✔ rustc: 1.71.1 (eb26296b5 2023-08-03)
    ✔ Cargo: 1.71.1 (7f1d04c00 2023-07-29)
    ✔ rustup: 1.26.0 (1980-01-01)
    ✔ Rust toolchain: 1.71.1-x86_64-unknown-linux-gnu (overridden by '/home/uri/proyects/SlimeVR-Server/rust-toolchain.toml')
    - node: 18.17.1
    - npm: 9.6.7

[-] Packages
    - tauri [RUST]: 2.0.0-alpha.10
    - tauri-build [RUST]: 2.0.0-alpha.6
    - wry [RUST]: 0.28.3
    - tao [RUST]: 0.19.1
    - @tauri-apps/api [NPM]: 2.0.0-alpha.5
    - @tauri-apps/cli [NPM]: 2.0.0-alpha.10

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

Stack trace

index-5d75d3d1.js:89  Scope not defined for window `local` and URL `https://tauri.localhost/onboarding/body-proportions/choose`. See https://tauri.app/v1/api/config/#securityconfig.dangerousremotedomainipcaccess and https://docs.rs/tauri/1/tauri/scope/struct.IpcScope.html#method.configure_remote_access
Wi @ index-5d75d3d1.js:89
(anonymous) @ index-5d75d3d1.js:3254
Promise.catch (async)
(anonymous) @ index-5d75d3d1.js:3254
D @ index-5d75d3d1.js:3230
(anonymous) @ index-5d75d3d1.js:3230
_ @ index-5d75d3d1.js:3230
choose:1  
Uncaught (in promise) Scope not defined for window `local` and URL `https://tauri.localhost/onboarding/body-proportions/choose`. See https://tauri.app/v1/api/config/#securityconfig.dangerousremotedomainipcaccess and https://docs.rs/tauri/1/tauri/scope/struct.IpcScope.html#method.configure_remote_access

Additional context

No response

nikoPLP commented 11 months ago

you should try to update to 2.0.0-alpha.11 and also don't forget to update the npm packages for your frontend to the latest versions, for the api and for all the plugins you are using:

@tauri-apps/api": "2.0.0-alpha.6
@tauri-apps/plugin-window": "2.0.0-alpha.1
...etc

I say that because your bug looks like #7264 and it has been fixed in alpha.11

ImUrX commented 11 months ago

yeah, it was fixed in alpha.11