Skip to content

[issue #7] Validate host paths and container mounts#36

Merged
Saber5656 merged 3 commits into
mainfrom
codex/issue-7-security-validation
Jul 14, 2026
Merged

[issue #7] Validate host paths and container mounts#36
Saber5656 merged 3 commits into
mainfrom
codex/issue-7-security-validation

Conversation

@Saber5656

@Saber5656 Saber5656 commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • add fail-closed validation for host files, directories, and relative sync paths
  • parse and validate Docker/Podman volume, bind-mount, tmpfs, and device arguments
  • block runtime sockets, configuration directories, ancestor mounts, symlink aliases, rootless containerd paths, and local volume-driver escapes
  • keep internal mount provenance crate-controlled and validate normalized mount state

Validation

  • cargo fmt --all -- --check
  • cargo test --all-features --locked
  • cargo clippy --all-targets --all-features --locked -- -D warnings
  • git diff --check
  • independent tech-security review: approve

Closes #7

Summary by CodeRabbit

  • New Features

    • Added security validation for container mount arguments, including bind mounts, devices, named volumes, and temporary filesystems.
    • Added safeguards to block mounts targeting protected runtime and configuration paths.
    • Added validation for directory paths, file paths, and project-relative sync paths, including traversal and symlink escape checks.
    • Malformed or unsupported mount configurations are rejected safely.
  • Tests

    • Added comprehensive coverage for mount parsing, path validation, and security boundary cases.

@Saber5656 Saber5656 added the enhancement New feature or request label Jul 14, 2026
@Saber5656 Saber5656 self-assigned this Jul 14, 2026
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Saber5656, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 13 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0ca368a5-0ab8-44ed-b49a-6c6f6e75793c

📥 Commits

Reviewing files that changed from the base of the PR and between 8c09dc2 and f96f5f1.

📒 Files selected for processing (3)
  • src/security/mod.rs
  • src/security/mount.rs
  • src/security/path.rs
📝 Walkthrough

Walkthrough

Adds security path validation and runtime mount parsing. It canonicalizes filesystem inputs, blocks protected runtime/config paths, validates relative sync destinations, normalizes supported mount flags, and enforces mount provenance and shape rules.

Changes

Security validation

Layer / File(s) Summary
Path validation policy
src/security/path.rs
Defines SecurityError, blocked-root policy checks, directory validation, canonicalization helpers, and filesystem path safety rules.
Relative sync path validation
src/security/path.rs
Validates sync destinations against the canonical project root, including missing leaf files and symlink escapes.
Runtime mount parsing
src/security/mount.rs
Adds mount types and parses -v, --volume, --mount, and --device forms, including named-volume and tmpfs handling.
Mount policy enforcement
src/security/mount.rs, src/security/mod.rs
Validates mount shape, applies host-path checks to user mounts, preserves internal and named-volume bypasses, and re-exports the security API.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant RuntimeArgs
  participant parse_runtime_mounts
  participant Mount
  participant validate_mounts
  participant PathPolicy
  participant Filesystem

  RuntimeArgs->>parse_runtime_mounts: recognized mount arguments
  parse_runtime_mounts->>Mount: normalized mount data
  Mount->>validate_mounts: parsed mounts
  validate_mounts->>PathPolicy: user host path
  PathPolicy->>Filesystem: canonicalize and inspect path
  Filesystem-->>PathPolicy: resolved path
  PathPolicy-->>validate_mounts: validation result
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: validating host paths and container mounts.
Linked Issues check ✅ Passed The changes implement the requested security layer for path validation, mount parsing, internal mount handling, and runtime socket blocking.
Out of Scope Changes check ✅ Passed The PR stays within the security validation scope and does not introduce unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/issue-7-security-validation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: be404db174

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/security/mount.rs Outdated
Comment thread src/security/mount.rs
Comment thread src/security/mount.rs Outdated
Comment thread src/security/mount.rs
@Saber5656
Saber5656 merged commit 94cf1e6 into main Jul 14, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Phase 1] Implement Security Layer path and volume validation

1 participant