Repository navigation
Mount Docker system input resources read-only - #2735
Open
Oke Iyanuoluwa Enoch (Iyanuoluwa007) wants to merge 2 commits into
Open
Oke Iyanuoluwa Enoch (Iyanuoluwa007) wants to merge 2 commits into
Oke Iyanuoluwa Enoch (Iyanuoluwa007) wants to merge 2 commits into
Conversation
Workflow resources found in the run config were all mounted into the container read-write. Input models, data files and user scripts only need to be read, so they are now mounted with `:ro`. Only `engine.output_dir` and the engine cache directory stay writable. The temporary config.json and the runner script mounts are read-only as well. Also document that `hf_token: true` passes the full HuggingFace token into the container environment for the Docker system. Fixes microsoft#2675
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Writable aliases bypass input protection, and legitimate auxiliary output directories become read-only.
2 open findings
What changed in this PR
This PR hardens Olive’s Docker workflow execution by restricting resource mounts and documenting token exposure.
Changes:
- Mount inputs, workflow config, and runner script read-only while preserving engine output/cache writes.
- Add mount-permission tests.
- Document HuggingFace token exposure and recommend trusted images and read-only tokens.
| File | Description |
|---|---|
| test/systems/docker/test_docker_system.py | Tests resource classification and read-only mounts. |
| olive/systems/docker/docker_system.py | Adds read-only mounts and writable-resource classification. |
| docs/source/reference/options.md | Clarifies Docker token exposure. |
| docs/source/how-to/configure-workflows/systems.md | Documents mount permissions and token precautions. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Author
|
@microsoft-github-policy-service agree |
- Match writable resources by config field name (output_dir, cache_dir, logging_dir, sample_log_dir) instead of only engine keys, so existing LoRA/QLoRA training output dirs and evaluator sample log dirs are not mounted read-only. - An input that lives inside a writable directory (for example under the default output dir, which is the working directory) was still writable through that directory's mount. Bind it read-only at its nested location as well so the read-only mount shadows the writable view.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Describe your changes
The Docker system mounted every workflow resource found in the run config read-write, so code inside the container could modify user supplied input models, data files and scripts.
:ro. Only resources underengine.output_dir,engine.cache_dirandengine.cache_configstay writable, since the workflow writes there.config.jsonmount and theworkflow_runner.pymount are read-only too.systems.mdand thehf_tokenoption inoptions.mdnow say that withhf_token: truethe full HuggingFace token is passed to the container environment, where anything in the image built frombuild_context_pathcan read it, and recommend a fine-grained read-only token.Supporting a scoped token value for
hf_token(instead of a bool) is left for a follow-up since it changes the config schema.Checklist before requesting a review
pytest test/systems/docker: 14 passed)lintrunner -a(ruff 0.15.11 check and format on changed files)Docker system now mounts workflow input resources read-only; only the output and cache directories are writable inside the container.
(Optional) Issue link
Fixes #2675