[GSoC 2026] Sandboxed Execution Environments with Devcontainers: Implement @devcontainer decorator for local sandboxing#3069
Conversation
Phase 1: Registration — Metaflow recognizes @devcontainer via plugins/__init__.py. Phase 2: CLI Hijack + Spec Parsing — runs steps inside Docker using image and env vars from .devcontainer/devcontainer.json. Uses Docker SDK (docker-py) backend to fix host environment leakage. The shell approach passed the host's full env into the container; the SDK passes only explicitly specified vars (clean boot).
Greptile SummaryThis PR introduces a The implementation has matured considerably from the initial prototype: prior feedback around shell injection, broad home-directory mounts, Windows UID availability, stale Metaflow version installation, container accumulation, and spec-path fragility has all been addressed. One new critical issue was introduced during those fixes:
Confidence Score: 3/5Not safe to merge — the exit-code propagation bug makes every successful decorated step appear to have failed The PR resolves all previously flagged concerns (injection, broad mounts, UID portability, version pinning, container leaks, path discovery), but the fix for container cleanup introduced a new P1 regression: using
Important Files Changed
|
|
Hi @savingoyal @saikonen @romain-intel @valayDave I’m currently working on a GSoC proposal for the project “Sandboxed Execution Environments with Devcontainers” in Metaflow. I’ve pushed a draft version here: This draft is based on a working prototype I’ve been developing around the core execution flow ( It’s still not final—I’m actively refining it—but I wanted to share it early to get feedback on the approach, scope, and alignment before I submit the final version tonight. Any guidance or pointers would be really helpful. Thanks! |
|
Please submit your proposal on the GSOC website directly. We won't be able to consider just the PRs or email submissions. |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
… discovery Summary of changes: - Resolved shell injection risk using shlex-based command sanitization. - Implemented recursive parent-directory search for .devcontainer.json discovery. - Applied Principle of Least Privilege to volume mounts (restricting to ~/.metaflow). - Added auto_remove=True to launcher to ensure container cleanup. - Synchronized host/container Metaflow versions for environment parity. - Integrated docker-py into extras_require in setup.py.
Hardened the sandbox architecture to address P1 security and reliability concerns: - Security: Implemented shlex-based command sanitization to prevent shell injection. - Security: Applied Principle of Least Privilege by restricting volume mounts to ~/.metaflow. - Robustness: Replaced os.getcwd() with a recursive parent-search for .devcontainer discovery. - Reliability: Integrated auto_remove=True in Docker SDK to prevent orphan container leaks. - Compatibility: Pinned host/container Metaflow versions and added Windows/WSL2 platform guards. - Project Hygiene: Moved Docker SDK to extras_require and sanitized configuration templates. This update aligns the prototype with production standards while the official proposal is under review.
Thank you, @talsperre. I have officially submitted my proposal on the GSoC website as required. I’ve just updated this RFC branch to reflect the final technical approach in my proposal. This update "hardens" the sandbox architecture by resolving the initial feedback regarding shell injection (via shlex), implementing the Principle of Least Privilege for volume mounts, and adding robust recursive path discovery for .devcontainer specs. I'm keeping this prototype active here to demonstrate the production-readiness of the proposed implementation. Thanks for the guidance! |
PR Type
Summary
Introduces the
@devcontainerdecorator, enabling Metaflow steps to run in isolated, reproducible Docker sandboxes locally using the [DevContainer specification] This bridges the gap between uncontained local execution and cloud-based container orchestration.Issue
Fixes # (Not applicable - This is a GSoC 2026 RFC/Prototype)
Reproduction
This PR includes a functional prototype and validation flows.
Runtime: local (Docker)
Commands to run:
Where evidence shows up: Parent console (stdout)
After (Evidence of Zero Leakage & UID Mapping)