Skip to content

bug : Path traversal in /files and /open_folder because task_id is not validated #88

@yomo40

Description

@yomo40

Both files and /open_folder call get_work_dir(task_id); however, get_work_dir simply performs os.path.join("project", "work_dir", task_id) followed by os.path.exists(), unlike /messages which first checks ensure_safe_task_id. This means that when passing values ​​like ../../.., the path might be resolved to a directory outside the task directory.

Caution

/files can be used to enumerate a list of files in any existing directory; /open_folder might even attempt to open the path on the server. It is a potential entry point for path traversal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions