Skip to content

Sandbox SDKs? #8452

Closed
Closed

Description

@shykes

Problem

Dagger SDKs have access to the entire context of their host project. This allows for in-depth integration, but it also creates the risk of SDKs accidentally interfering with the project. This risk increases with the number of SDKs, and the fragmentation of host projects (different package managers, different conventions, etc).

Recently I have noticed an increase in the number of users reporting problems of this nature.

Solution

I propose sandboxing SDKs. This would prevent them from changing any files outside of their allocated source directory. This would make it impossible for SDKs to break their host project.

On the other hand, it would limit how deeply they can integrate. For example, the Go SDK currently will detect a go.work in the context, and edit it to add the module. That wouldn't be possible with sandboxing, because the go.work file is outside of the source directory.

I think this would be the right tradeoff: lost convenience can always be added later, in the form of exceptions, utilities etc. But lost confidence - not trusting Dagger to not make a mess in my project - is very hard to regain.

I am curious to hear everyone's thoughts!

Activity

  1. helderco commented on Sep 14, 2024

    @helderco
    Contributor

    For me, ideally, you'd sandbox by default (in any case), but allow users to explicitly specify what else from the repo should be included when the module loads.

    Solutions may vary to allow for it, but when it's managed by the user explicitly, it still allows some advanced use cases, without the confusion in simple ones.

  2. helderco commented on Sep 19, 2024

    @helderco
    Contributor

    To be clear, the Go SDK no longer modifies the parent go.mod during codegen:

    But the Go SDK is still the only one that loads files from outside the root directory, in all cases:

    If we stop overwriting existing files on init, it's a simple change that goes a long way towards this:

    So then, the only thing remaining to completely sandbox, would be for the engine to export only the root directory, and not the context directory during init, but also develop.

    I'm in favor of all that. If the user wants more integration with the existing project (like sharing the go.mod), they'll have to manage it themselves outside the module (a reusable Dagger module could help there), instead of the SDK itself.

  3. jedevc commented on Sep 19, 2024

    @jedevc
    Contributor

    Agreed, this sounds like the right approach - if we do this, do we go for a slow deprecation with backwards-compat? Honestly, it feels unlikely to break reusable modules in the daggerverse, and more likely to effect the monorepo use case.

    I think it's potentially worth considering a hard break here, since supporting both the code paths for this very tricky logic seems quite challening.

  4. locked and limited conversation to collaborators on Mar 24, 2026
  5. converted this issue into a discussion #12167 on Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions