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

Design & Plan to add Local Filesystem cloning #154

Closed
31 tasks done
mpacer opened this issue Aug 1, 2019 · 3 comments
Closed
31 tasks done

Design & Plan to add Local Filesystem cloning #154

mpacer opened this issue Aug 1, 2019 · 3 comments
Labels
enhancement New feature or request
Milestone

Comments

@mpacer
Copy link
Member

mpacer commented Aug 1, 2019

Proposal - Local Filesystem Cloning

This proposes adding the ability to clone from files beneath a privileged directory on your filesystem to your local directory.

Current Limitation

The Jupyter ContentManager API is not normally allowed to access anything outside of its base directory. This prevents users from accessing files above the base directory.

Use Case

The use case arises in cases where you want to provide access to content that is not normally available to the Jupyter Contents API.

For example, suppose that you were running JupyterHub for a number of users and had a filesystem of content that all users should have access to in a readonly way.

Workflow option - Rejected

You could display the contents with commuter, but users would then need to download and upload the content to their local server to be able to get an executable copy of the content. You could mount the file system beneath their Jupyter directory which would let you copy the contents. But that could lead to confusion and clutter in the user's filesystem.

Proposed Workflow

File system cloning would allow you to mount the volume at a in a standard location not beneath the users' base dir, and provide a way for users to directly clone that content as a copy into their local directory. Commuter could then show a clone button that would trigger this API, massively simplifying the workflow needed to go from a readonly to an executable copy of a notebook.

Key Benefit: This allows a similar workflow to be shared by both content hosted on s3 (what bookstore currently supports) as well as content on a filesystem.

^ Edited: The above description was added based on a super helpful suggestion from @willingc

A proposed model for filesystem cloning:

Design

  • filesystem cloning is disabled by default (any default would potentially pose a security issue)
  • filesystem cloning will only work for files that are children of a specific base directory (fs_cloning_basedir)
  • cloning source will be defined using a relative path from the fs_cloning_basedir
  • we will use the notebook contents manager to handle security policies around the cloning target path
  • separate validation checks for s3 cloning and fs cloning
  • create new /api/fs-clone and fs-clone endpoints with relpath query parameter and model key
  • modify clone.html template to be used by both sets of handlers

Plan

@chyzzqo2, does this sound like a good plan?

Replaces #110.

@willingc willingc added the enhancement New feature or request label Aug 2, 2019
@willingc
Copy link
Member

willingc commented Aug 2, 2019

@mpacer Thanks for updating the design and plan. I've added a few headings for readability for devs in the future. 😄

@mpacer
Copy link
Member Author

mpacer commented Aug 2, 2019

@willingc Thank you so much for adding the structure — it really does make this much easier to read!

@mpacer mpacer added this to the 2.4.0 milestone Aug 6, 2019
@mpacer
Copy link
Member Author

mpacer commented Aug 6, 2019

So happy we got through all this so quickly thanks @willingc and @chyzzqo2 for helping make that happen!!

@mpacer mpacer closed this as completed Aug 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants