Skip to content

Security: Arbitrary File Read via read_trace Tauri Command#1615

Open
tomaioo wants to merge 1 commit into
IBM:mainfrom
tomaioo:fix/security/arbitrary-file-read-via-read-trace-tauri
Open

Security: Arbitrary File Read via read_trace Tauri Command#1615
tomaioo wants to merge 1 commit into
IBM:mainfrom
tomaioo:fix/security/arbitrary-file-read-via-read-trace-tauri

Conversation

@tomaioo

@tomaioo tomaioo commented May 22, 2026

Copy link
Copy Markdown

Summary

Security: Arbitrary File Read via read_trace Tauri Command

Problem

Severity: High | File: pdl-live-react/src-tauri/src/commands/read_trace.rs:L1

The read_trace Tauri command in read_trace.rs accepts a file path string and directly reads it using std::fs::read. There is no path validation, sanitization, or restriction to prevent reading files outside of intended directories. This allows an attacker to read arbitrary files on the system by passing paths like ../../../etc/passwd or C:\Windows\System32\config\SAM. Since this is exposed as a Tauri command, it can be invoked from the frontend JavaScript.

Solution

Validate and restrict the file path to a specific allowed directory. Use std::path::Path::canonicalize and ensure the resolved path is within an allowed base directory. Consider using a whitelist or sandbox approach. Also validate that the file extension is .json or .pdl as expected.

Changes

  • pdl-live-react/src-tauri/src/commands/read_trace.rs (modified)

The `read_trace` Tauri command in `read_trace.rs` accepts a file path string and directly reads it using `std::fs::read`. There is no path validation, sanitization, or restriction to prevent reading files outside of intended directories. This allows an attacker to read arbitrary files on the system by passing paths like `../../../etc/passwd` or `C:\Windows\System32\config\SAM`. Since this is exposed as a Tauri command, it can be invoked from the frontend JavaScript.

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant