Skip to content

Mount Docker system input resources read-only - #2735

Open
Oke Iyanuoluwa Enoch (Iyanuoluwa007) wants to merge 2 commits into
microsoft:mainfrom
Iyanuoluwa007:docker-readonly-input-mounts
Open

Oke Iyanuoluwa Enoch (Iyanuoluwa007) wants to merge 2 commits into
microsoft:mainfrom
Iyanuoluwa007:docker-readonly-input-mounts

Conversation

@Iyanuoluwa007

Copy link
Copy Markdown

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.

  • Input resources are now mounted with :ro. Only resources under engine.output_dir, engine.cache_dir and engine.cache_config stay writable, since the workflow writes there.
  • The temporary config.json mount and the workflow_runner.py mount are read-only too.
  • Docs: the Docker system section of systems.md and the hf_token option in options.md now say that with hf_token: true the full HuggingFace token is passed to the container environment, where anything in the image built from build_context_path can 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

  • Add unit tests for this change.
  • Make sure all tests can pass. (pytest test/systems/docker: 14 passed)
  • Update documents if necessary.
  • Lint and apply fixes to your code by running lintrunner -a (ruff 0.15.11 check and format on changed files)
  • Is this a user-facing change? If yes, give a description of this change to be included in the release notes.
    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

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
Copilot AI balanced review requested due to automatic review settings October 16, 2026 18:58
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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.

Comment thread olive/systems/docker/docker_system.py Outdated
Comment thread olive/systems/docker/docker_system.py Outdated
@Iyanuoluwa007

Copy link
Copy Markdown
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

No deployments
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.

[FR]: Docker system - mount input resources read-only, and document/scope the HuggingFace token passed into the container

2 participants