Skip to content

dirfs: reject paths that escape the root via ".."#2047

Open
sahvx655-wq wants to merge 1 commit into
fsspec:masterfrom
sahvx655-wq:dirfs-join-escape-root
Open

dirfs: reject paths that escape the root via ".."#2047
sahvx655-wq wants to merge 1 commit into
fsspec:masterfrom
sahvx655-wq:dirfs-join-escape-root

Conversation

@sahvx655-wq

Copy link
Copy Markdown
  1. DirFileSystem is meant to keep every operation under its configured path, but _join only concatenates the prefix with the caller-supplied path and never inspects ".." segments.
  2. a relative path such as "../secret" therefore resolves above the root, and since reads and writes both funnel through _join an untrusted name escapes the directory entirely (confirmed by reading and writing a file outside the root over LocalFileSystem).

Reject in _join when the path would climb above the root; ".." that stays within the prefix is still allowed, so existing in-tree paths are unaffected.

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