🔒 Missing workspace boundary validation allows arbitrary file read

Open
#3,265 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
security

Research direction

Start in rust/crates/runtime/src/file_ops.rs at read_file, then inspect normalize_path and validate_workspace_boundary. Verify that the resolved path is checked against workspace_root before reading, including traversal and symlink escape cases; the issue is done when out-of-workspace reads are rejected while valid workspace reads still work.

Written by the indexing model from the issue text.

Description

🔒 Security · 🟡 Medium · Confidence: 96%

File: rust/crates/runtime/src/file_ops.rs
Location: read_file


What's wrong

The function reads a file path supplied by the caller without checking that it stays inside the intended workspace. The line let absolute_path = normalize_path(path)?; resolves the user‑provided path to an absolute path, but no subsequent call to validate_workspace_boundary is made, so a malicious caller can traverse out of the workspace (e.g., using ../ or symlinks) and read any file the process can access.

Suggested fix

Validate the resolved path against the workspace root before reading the file. For example:

pub fn read_file(
    path: &str,
    offset: Option<usize>,
    limit: Option<usize>,
    workspace_root: &Path,
) -> io::Result<ReadFileOutput> {
    let absolute_path = normalize_path(path)?;
    // Ensure the path stays within the workspace
    validate_workspace_boundary(&absolute_path, workspace_root)?;
    // ... rest of the function unchanged ...
}

About this report

This finding was generated by an automated audit tool using Llama 3.3 70B + verification passes.
Only findings with ≥92% confidence that passed both LLM self-verification and line reference
verification are reported. False positives are still possible — please verify before acting.

Dominant language
Rust
Stars
195k
Forks
108k
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ultraworkers/claw-code

All issues in ultraworkers/claw-code

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.