Skip to content

fix(connectors/filesystem): prevent path traversal in read_file#34

Open
mhajder wants to merge 1 commit into
open-webui:mainfrom
mhajder:fix/connectors/filesystem
Open

fix(connectors/filesystem): prevent path traversal in read_file#34
mhajder wants to merge 1 commit into
open-webui:mainfrom
mhajder:fix/connectors/filesystem

Conversation

@mhajder

@mhajder mhajder commented Jun 6, 2026

Copy link
Copy Markdown

This pull request adds a security enhancement to the read_file method in filesystem.py to prevent directory traversal attacks. Now, before reading a file, the code checks that the resolved file path is within the allowed root directory.

Resolve the file path and verify that it remains within the connector's root directory using `is_relative_to()`. Raises a `PermissionError` if a path traversal attempt is detected.
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