Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactors JailFS #6161

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft

Refactors JailFS #6161

wants to merge 6 commits into from

Conversation

arcanis
Copy link
Member

@arcanis arcanis commented Mar 9, 2024

What's the problem this PR addresses?

While adding tests to JailFS I came across a behaviour I didn't expect - calling readFile("foo.txt") would join foo.txt to the JailFS target path, but calling resolve("foo.txt") would return /foo.txt. This seems conflating two different things: the jail, and obtaining a "partial view" of the filesystem.

How did you fix it?

I'm looking whether it'd make sense to split those two concerns in two separate FS classes: JailFS would strictly forbid accessing paths outside of the specified directory (and would check absolute paths unmodified), while SubFS would pretend that anything outside of the provided directory doesn't exist (/ would thus internally point to the SubFS target path).

It's a little experimental, and a breaking change for the fslib, so I have to think a little whether this all make sense. Originally I implemented something similar to SubFS to supplement MountFS, and only then noticed that JailFS was kind of the same, except that not really, and perhaps it shouldn't be the same at all.

Checklist

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

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.

None yet

1 participant