Skip to content

feat(sandbox): read the Cargo registry and rustup sources read-only - #1626

Merged
edenreich merged 1 commit into
mainfrom
fix/issue-1624
Oct 28, 2026
Merged

edenreich merged 1 commit into
mainfrom
fix/issue-1624

Conversation

@inference-gateway-maintainer

Copy link
Copy Markdown
Contributor

Resolves #1624

Summary

The sandbox's built-in read-only library carve-out covered only Go ($GOMODCACHE or $GOPATH/pkg/mod and $GOROOT/src), so reading a dependency's source from the Cargo registry was denied with "read to path '/home/runner/.cargo/registry/src/...' is denied by the sandbox". This extends the same read-only carve-out to the Cargo registry sources and the rustup toolchain sources, so Rust projects can read dependency source without configuration, and writes there keep the existing "read-only library directory" error.

Changes

  • internal/sandbox/paths.go: the read-only carve-out case now also calls isWithinRustLibDirs, covering $CARGO_HOME/registry/src and $CARGO_HOME/git/checkouts (default ~/.cargo) and $RUSTUP_HOME/toolchains/*/lib/rustlib/src (default ~/.rustup), resolved from the environment the same way the Go dirs are; the per-toolchain directory is matched by path shape (<toolchains>/<toolchain>/lib/rustlib/src[/...]) instead of listing the toolchains directory
  • internal/sandbox/paths_test.go: new TestValidateWrite_RustLibCarveOut locks in reads under both the default and the env-resolved homes, writes denied, non-carved siblings still denied (registry/cache, registry/index, lib/rustlib/<triple>/lib) and sandbox writes still allowed
  • docs/tools-reference.md: the sandbox section now lists the Go and Rust read-only library carve-out directories side by side
  • internal/sandbox/README.md and cspell.yaml: carve-out wording generalized and spelling words added (CARGO_HOME, RUSTUP_HOME, rustlib, rustup, toolchains)

Downstream impact: none beyond the CLI and its docs - this is CLI-internal sandbox policy, no schema or gateway changes, so no SDK or Helm work is expected. A [DOCS] tracking issue is filed in inference-gateway/docs for the user-facing docs site.

Extend the built-in read-only library carve-out from Go to Rust: /registry/src, /git/checkouts (default ~/.cargo) and /toolchains/*/lib/rustlib/src (default ~/.rustup) are readable without configuration, and writes there keep the read-only library directory error. Resolves #1624
@github-project-automation github-project-automation Bot moved this to Todo in 2026 Oct 28, 2026
@inference-gateway-maintainer
inference-gateway-maintainer Bot marked this pull request as ready for review October 28, 2026 13:33
@inference-gateway-maintainer
inference-gateway-maintainer Bot requested a review from a team as a code owner October 28, 2026 13:33
@edenreich
edenreich merged commit 833c97b into main Oct 28, 2026
1 check passed
@edenreich
edenreich deleted the fix/issue-1624 branch October 28, 2026 14:13
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.238.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Oct 28, 2026
@edenreich edenreich moved this from Todo to Done in 2026 Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[FEATURE] Extend the read-only library carve-out to the Cargo registry and rustup source

1 participant