Skip to content

allow dynamic LocalDir access#3228

Merged
tonistiigi merged 1 commit into
moby:masterfrom
vito:dynamic-filesync
Oct 27, 2022
Merged

allow dynamic LocalDir access#3228
tonistiigi merged 1 commit into
moby:masterfrom
vito:dynamic-filesync

Conversation

@vito
Copy link
Copy Markdown
Contributor

@vito vito commented Oct 26, 2022

Changes the filesync attachable to accept an interface instead of a static allowlist of dirs. This way a single session can support syncing directories not known ahead of time.

Use case: for Dagger we currently run the entire API server with a single Buildkit session, but we would like our API to support reading arbitrary host directories. Currently the user has to configure directories statically ahead of time, which results in an awkward API + configuration coupling we'd like to avoid. The relevant PR is dagger/dagger#3560 - currently it uses an extracted filesync package, so we're not blocked on this PR.

With this change we can manually add a filesync session.Attachable that allows arbitrary access using the path as the directory name, e.g. llb.Local("/foo/bar").

Note: we totally understand the risk of allowing unfettered host filesystem access, and will have to defend against it ourselves. Fortunately this is pretty easy to do by just implementing our own DirSource with our own access control logic.

Copy link
Copy Markdown
Member

@tonistiigi tonistiigi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the DCO

Changes the filesync attachable to accept an interface instead of a
static allowlist of dirs. This way a single session can support syncing
directories not known ahead of time.

Signed-off-by: Alex Suraci <suraci.alex@gmail.com>
@vito vito force-pushed the dynamic-filesync branch from affda29 to 3548517 Compare October 27, 2022 01:05
@vito
Copy link
Copy Markdown
Contributor Author

vito commented Oct 27, 2022

@tonistiigi Done!

@tonistiigi tonistiigi merged commit b78713c into moby:master Oct 27, 2022
@vito vito deleted the dynamic-filesync branch October 27, 2022 01:56
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.

2 participants