Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Infinite loop in scope::fs::push_pattern #10815

Open
alexmoon opened this issue Aug 28, 2024 · 0 comments · May be fixed by #10838
Open

[bug] Infinite loop in scope::fs::push_pattern #10815

alexmoon opened this issue Aug 28, 2024 · 0 comments · May be fixed by #10838
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@alexmoon
Copy link

alexmoon commented Aug 28, 2024

Describe the bug

On Windows, calling tauri::scope::fs::push_pattern with a pattern of "\\?\**" results in an infinite loop attempting to create the canonicalized path.

Reproduction

  1. In an app's capabilities JSON add to the permissions array:
{ "identifier": "fs:scope", "allow": ["\\\\?\\**"] }
  1. Perform any fs API call from the frontend. The backend will lock up in an infinite loop when creating the Scope.

Expected behavior

push_pattern should either return an error or process the pattern successfully.

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.19045 X64
    ✔ WebView2: 128.0.2739.42
    ✔ MSVC: Visual Studio Community 2022
    ✔ rustc: 1.80.0 (051478957 2024-07-21)
    ✔ cargo: 1.80.0 (376290515 2024-07-16)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 18.19.1
    - pnpm: 9.9.0
    - npm: 10.2.4

[-] Packages
    - tauri [RUST]: 2.0.0-rc.2
    - tauri-build [RUST]: 2.0.0-rc.2
    - wry [RUST]: 0.41.0
    - tao [RUST]: 0.28.1
    - tauri-cli [RUST]: 1.5.11
    - @tauri-apps/api [NPM]: 2.0.0-rc.0
    - @tauri-apps/cli [NPM]: 2.0.0-rc.3

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:5173/
    - framework: SolidJS
    - bundler: Vite

Stack trace

No response

Additional context

No response

@alexmoon alexmoon added status: needs triage This issue needs to triage, applied to new issues type: bug labels Aug 28, 2024
alexmoon added a commit to tactile-eng/tauri that referenced this issue Aug 30, 2024
If the root path element of a pattern could not be canonicalized, `scope::fs::push_pattern` would enter an infinite loop. This is because `path.pop()` does nothing and returns `false` when called on a path with no parent, which can happen even when the path element iterator is non-empty. This could occur on Windows, for example, with a pattern of `\\\\?\\**`.

Fixes tauri-apps#10815
alexmoon added a commit to tactile-eng/tauri that referenced this issue Aug 30, 2024
If the root path element of a pattern could not be canonicalized, `scope::fs::push_pattern` would enter an infinite loop. This is because `path.pop()` does nothing and returns `false` when called on a path with no parent, which can happen even when the path element iterator is non-empty. This could occur on Windows, for example, with a pattern of `\\\\?\\**`.

Fixes tauri-apps#10815
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant