tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[bug]

Open farhoudi opened this issue 1 year ago • 4 comments

Describe the bug

When trying to to send command to a plugin the requested path will be like plugin:plugin_name and windows will reject the request and will log this error:

Source:        ASP.NET 4.0.30319.0
Date:          07/24/2024 8:10:41 AM
Event ID:      1309
Task Category: Web Event
Level:         Warning
Keywords:      Classic
User:          N/A
Computer:      PC-JanatAbad
Description:
Event code: 3005 
Event message: An unhandled exception has occurred. 
Event time: 7/24/2024 8:10:41 AM 
Event time (UTC): 7/24/2024 4:40:41 AM 
Event ID: 39404e09dbd243c3b5085fdf9e9d8d0a 
Event sequence: 3 
Event occurrence: 2 
Event detail code: 0 
 
Application information: 
    Application domain: /LM/W3SVC/1/ROOT-1-133662695080433835 
    Trust level: Full 
    Application Virtual Path: / 
    Application Path: C:\inetpub\wwwroot\ 
    Machine name: PC-JANATABAD 
 
Process information: 
    Process ID: 81960 
    Process name: w3wp.exe 
    Account name: IIS APPPOOL\DefaultAppPool 
 
Exception information: 
    Exception type: HttpException 
    Exception message: A potentially dangerous Request.Path value was detected from the client (:).
   at System.Web.HttpRequest.ValidateInputIfRequiredByConfig()
   at System.Web.HttpApplication.PipelineStepManager.ValidateHelper(HttpContext context)

 
 
Request information: 
    Request URL: http://ipc.localhost/plugin:printer|get_printers 
    Request path: /plugin:printer|get_printers 
    User host address: ::1 
    User:  
    Is authenticated: False 
    Authentication Type:  
    Thread account name: IIS APPPOOL\DefaultAppPool 
 
Thread information: 
    Thread ID: 9 
    Thread account name: IIS APPPOOL\DefaultAppPool 
    Is impersonating: False 
    Stack trace:    at System.Web.HttpRequest.ValidateInputIfRequiredByConfig()
   at System.Web.HttpApplication.PipelineStepManager.ValidateHelper(HttpContext context)```

Reproduction

Just add printer plugin and try to get list of printers

Expected behavior

No response

Full tauri info output

This is the environment I build the application. Output show Windows 10 but actually my windows version is windows 11 pro 23H2

[✔] Environment
    - OS: Windows 10.0.22631 X64
    ✔ WebView2: 126.0.2592.113
    ✔ MSVC: Visual Studio Build Tools 2022
    ✔ rustc: 1.78.0 (9b00956e5 2024-04-29)
    ✔ cargo: 1.78.0 (54d8815d0 2024-03-26)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 20.14.0
    - pnpm: 9.1.3
    - npm: 10.8.1

[-] Packages
    - tauri [RUST]: 2.0.0-beta.23
    - tauri-build [RUST]: 2.0.0-beta.18
    - wry [RUST]: 0.41.0
    - tao [RUST]: 0.28.1
    - @tauri-apps/api [NPM]: 2.0.0-rc.0
    - @tauri-apps/cli [NPM]: 2.0.0-rc.0

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../build
    - devUrl: http://localhost:8080/
    - framework: React
    - bundler: Vite

Stack trace

No response

Additional context

The application will crash and error log will be logged in windows event viewer. This will happen in windows versions less than 11.

farhoudi avatar Aug 05 '24 12:08 farhoudi

Can you please post the output of the tauri info command as required by the issue template?

Also a bit of code, or maybe even a minimal reproduction may be helpful since .net frontend frameworks are still quite uncommon in tauri land.

FabianLars avatar Aug 05 '24 13:08 FabianLars

Sorry for missing info on issue. I just updated the description.

This is the command I use to get printer list: const printers = await getPrinters();

And then the crash happens and the error is logged in windows event logs.

farhoudi avatar Aug 06 '24 09:08 farhoudi

I have the same issue, any updates?

47vigen avatar Aug 07 '24 13:08 47vigen

@farhoudi I assume you mean this plugin: https://github.com/alfianlensundev/tauri-plugin-printer ?

If so, then it might just not be compatible with Tauri V2: https://github.com/alfianlensundev/tauri-plugin-printer/issues/20 It has not been updated in a while.

To that effect, you might be better using Rust to get the list of printers with something like https://docs.rs/printers/latest/printers/ (NB I have not personally used). As far as I am aware, this cannot be done from the JS side.

Hope this helps

ShaunSHamilton avatar Oct 11 '24 18:10 ShaunSHamilton