Skip to content

Plan safe host-mounted workspaces (4.2.2) - #110

Draft
lodyai[bot] wants to merge 2 commits into
mainfrom
4-2-2-safe-host-mounted-workspaces
Draft

Plan safe host-mounted workspaces (4.2.2)#110
lodyai[bot] wants to merge 2 commits into
mainfrom
4-2-2-safe-host-mounted-workspaces

Conversation

@lodyai

@lodyai lodyai Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

Summary

This draft PR carries the ExecPlan for roadmap step 4.2.2, "Implement safe
host-mounted workspaces", at docs/execplans/4-2-2-safe-host-mounted-workspaces.md.
The plan materialises host-mounted workspaces with an explicit deny-by-default
allowlist, symlink-resolving canonicalisation, symlink-escape rejection, and a
rootless write-permission probe, then attaches a hardened typed bind mount.

  • Hexagonal split: pure domain + planner in src/api/host_mount.rs, a
    single-pass HostPathProbe driven port, and a default adapter in
    src/engine/connection/host_mount/. The engine adapter populates
    HostConfig.mounts with a typed bollard::models::Mount (RPRIVATE
    propagation, non_recursive, explicit read_only) only when
    workspace.source = "host_mount".
  • New [mounts] configuration section and two PODBOT_MOUNTS_* environment
    variables; additive FilesystemError variants for allowlist and
    write-probe failures; rstest / rstest-bdd / proptest /
    testcontainers coverage.

The plan is in DRAFT and must be approved before implementation begins.

Revision (2026-06-18)

This revision supersedes the original 2026-05-29 draft on this branch after a
fresh round of external research and a community-of-experts design review. Key
upgrades: the writability probe now runs through a single held cap-std
capability (closing the in-process resolve-then-probe TOCTOU window); a
CanonicalHostPath newtype makes non-canonical containment checks
unrepresentable; the residual cross-process mount-time race (runc
CVE-2025-31133 class) and the operator's trusted-parent-chain precondition are
stated precisely and embedded as a verbatim threat-model boundary; the
negative-coverage matrix gains the sibling-prefix trap, exact-root match,
symlinked-root, and no-litter cases; googletest, pretty_assertions, an
insta denial-message snapshot, and a trybuild signature-stability fixture
are adopted; and the choice of proptest over kani/verus is justified.
See the plan's Supersession note and Decision log for the full rationale.

Test plan

  • make check-fmt
  • make lint
  • make test (rstest + rstest-bdd + proptest)
  • testcontainers-backed end-to-end scenario for the host-mount bind
  • make markdownlint, make nixie

References

Add ExecPlan for roadmap step 4.2.2 covering host-mount path
canonicalisation, allowlist enforcement, symlink-escape rejection,
rootless write-probe validation, and bollard bind-mount materialisation.

The plan adopts a hexagonal split: domain types and planner live in
src/api/host_mount.rs, a HostPathProbe driven port abstracts filesystem
operations, and a DefaultHostPathProbe adapter under
src/engine/connection/host_mount/ uses std::fs and cap_std at the host
trust boundary. The engine integration populates HostConfig.mounts with
typed bollard Mount values (RPRIVATE propagation, non_recursive,
explicit read_only) only when workspace.source = "host_mount".

The plan also introduces a [mounts] configuration section with an
allowlist and read-only default, additive FilesystemError variants for
allowlist and write-probe failures, rstest/proptest unit coverage,
rstest-bdd behavioural coverage, and a testcontainers-backed e2e
scenario proving a real rootless engine can read and write the bound
directory.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5f33f796-1391-4ff8-9c07-e208e80e3588

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 4-2-2-safe-host-mounted-workspaces

Comment @coderabbitai help to get the list of available commands and usage tips.

@sourcery-ai

sourcery-ai Bot commented May 29, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds a detailed ExecPlan document for roadmap step 4.2.2 that designs and constrains the future implementation of safe host-mounted workspaces, including config schema changes, a hexagonal domain/adapter split, validation rules, testing strategy, and rollout steps, but makes no code or behaviour changes yet.

Sequence diagram for planning and applying a host-mounted workspace

sequenceDiagram
actor Operator
participant CLI
participant Library
participant Probe as DefaultHostPathProbe
participant Engine as EngineConnector
participant Docker as Bollard

Operator->>CLI: Configure workspace.source=HostMount
CLI->>Library: plan_host_mount_workspace(AppConfig, Probe)
Library->>Probe: canonicalize(host_path)
Probe-->>Library: canonical_host_path
Library->>Probe: probe_writable(canonical_host_path)
Probe-->>Library: Result
Library-->>CLI: HostMountPlan
CLI->>Engine: create_container_async(HostMountPlan)
Engine->>Docker: create_container(HostConfig.mounts with Mount)
Docker-->>Engine: container_id
Engine-->>CLI: container_id
CLI-->>Operator: Container with host-mounted workspace
Loading

File-Level Changes

Change Details Files
Introduce an ExecPlan document that fully specifies how to implement safe host-mounted workspaces, including domain model, configuration, validation, engine integration, testing, and rollout process.
  • Describe current behaviour where host-mounted workspaces are configured but not actually mounted into containers, and define the desired end state with canonicalisation, allowlists, symlink-escape checks, and write-probe validation.
  • Define architectural constraints and tolerances, including a hexagonal split with a HostPathProbe port, path-handling rules (cap-std, Utf8PathBuf), error-handling policies, and config-surface rules for host mounts.
  • Specify new configuration surface ([mounts] section and PODBOT_MOUNTS_* env vars), validation semantics for allowlists and reserved container paths, and how planning should be exposed via plan_host_mount_workspace and HostMountPlan types.
  • Lay out a milestone-based implementation plan covering config wiring, domain types and planner logic, default HostPathProbe adapter, engine integration with bollard::models::Mount, BDD/proptest/testcontainers coverage, documentation updates, and PR workflow.
  • Capture risks, threat model, residual TOCTOU concerns, decision log entries (e.g., using HostConfig.mounts with typed Mount and RPRIVATE), and acceptance/quality criteria for when step 4.2.2 is considered complete.
docs/execplans/4-2-2-safe-host-mounted-workspaces.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

codescene-delta-analysis[bot]

This comment was marked as outdated.

Supersede the prior 4.2.2 draft on this branch with a revision that
sharpens the security-critical details after fresh external research and
a community-of-experts review. The overall shape is unchanged: a
dedicated [mounts] config section, a hexagonal HostPathProbe split, a
typed bollard Mount, a deny-by-default allowlist, and a testcontainers
write proof.

Substantive changes:

- Probe writability through a single held cap-std capability opened from
  the canonical path, closing the in-process resolve-then-probe TOCTOU
  window the prior draft left open.
- Add a CanonicalHostPath newtype so the containment check can only run
  on canonicalised paths.
- State the residual cross-process mount-time race precisely and embed a
  verbatim threat-model boundary (operator must own the parent chain).
- Expand the negative-coverage matrix: sibling-prefix trap, exact-root
  match, symlinked allowlist root, and a no-litter-on-failure assertion.
- Adopt googletest and pretty_assertions, an insta denial-message
  snapshot, and a trybuild signature-stability fixture.
- Justify and record proptest over kani/verus for the containment
  invariant.
- Reaffirm the [mounts] section over a [sandbox] alternative.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant