tauri-apps / tauri

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

[bug] scope issues with fs on Linux #8653

Closed thewh1teagle closed 7 months ago

thewh1teagle commented 7 months ago

Describe the bug

fs.readDir throwed path not allowed on the configured scope: ...

I found a workround with help in discord, but I think it's still worth an issue

Reason: dot paths in Linux Solution:

"scope": {
  "allow": ["**"],
  "requireLiteralLeadingDot": false
}

Reproduction

Use fs.readDir in Linux with scope configured to **

Expected behavior

It should read it, but it throws error

Full tauri info output

[✔] Environment
    - OS: Ubuntu 22.04 X64
    ✔ webkit2gtk-4.0: 2.42.4
    ✔ rsvg2: 2.52.5
    ✔ rustc: 1.75.0 (82e1608df 2023-12-21)
    ✔ cargo: 1.75.0 (1d8b05cdd 2023-11-20)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (environment override by RUSTUP_TOOLCHAIN)
    - node: 20.7.0
    - npm: 10.1.0
    - bun: 1.0.3

[-] Packages
    - tauri [RUST]: 1.5.4
    - tauri-build [RUST]: 1.5.1
    - wry [RUST]: 0.24.7
    - tao [RUST]: 0.16.5
    - tauri-cli [RUST]: 1.5.9
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli [NPM]: 1.5.9

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

Stack trace

No response

Additional context

Ubuntu 22.04, Wayland https://discord.com/channels/616186924390023171/1198765010558664704

amrbashir commented 7 months ago

This is the expected behavior, you need to opt into reading dot files by specifying requireLiteralLeadingDot: false or configure your glob pattern to include the dot.