Skip to content

fix(sandbox): move skills dirs into default Sandbox.Directories unconditionally - #578

Merged
edenreich merged 3 commits into
mainfrom
fix/skills-sandbox-unconditional
Jun 2, 2026
Merged

edenreich merged 3 commits into
mainfrom
fix/skills-sandbox-unconditional

Conversation

@inference-gateway-maintainer

@inference-gateway-maintainer inference-gateway-maintainer Bot commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

Resolves #577

Summary

Follow-up to #569 / #571 (shipped in v0.117.0). The sandbox carve-out for ~/.infer/skills and ./.infer/skills was conditional on c.Agent.Skills.Enabled being true at ValidatePathInSandbox time. When that flag is not set — running with default config, before infer config agent skills enable has run, or when the INFER_AGENT_SKILLS_ENABLED override has not reached the validator — the carve-out silently did not fire and reads of SKILL.md were denied with outside configured sandbox directories.

Skills directories are a well-known, read-only allowlist under ~/.infer/. Gating their sandbox visibility on a runtime feature flag re-introduces the failure mode #569 was meant to remove.

Changes

  1. DefaultConfig(): Include ./.infer/skills and ~/.infer/skills in Sandbox.Directories unconditionally (no flag gating).
  2. ValidatePathInSandbox(): Remove the c.Agent.Skills.Enabled-gated isWithinSkillsDir branch from the carveOut expression. The tmp/plans carve-out is preserved as it is orthogonal.
  3. checkProtectedPaths(): Add isWithinSkillsDir() short-circuit at the top so that the broader .infer/ protected-path pattern does not deny readable skills files. Skills dirs are fully trusted.
  4. Tests: Rewrite TestValidatePathInSandbox_SkillsCarveOut to verify that skills reads succeed with DefaultConfig() and Skills.Enabled=false, that ~/.infer/config.yaml and conversations.db remain protected, and that skills-evil sibling dirs are still rejected.

Why this is better

  • One source of truth for what is readable: Sandbox.Directories. No second runtime predicate to keep in sync.
  • agent.skills.enabled goes back to meaning exactly "load skill metadata into the prompt and offer them to the agent" — purely about discovery/loading, no sandbox semantics.
  • No env-var plumbing required from infer-action or any other consumer.
  • Behavior is identical across chat, infer agent, channels, and heartbeat — no per-mode flag drift.

Follow-up

Once this lands and a new CLI is cut:

  • inference-gateway/infer-action — bump inputs.version.default in action.yml to the new CLI release.
  • inference-gateway/.github — bump cli-version default in the centralized infer workflow.

@inference-gateway-maintainer
inference-gateway-maintainer Bot requested a review from a team as a code owner June 2, 2026 08:42
@inference-gateway-maintainer
inference-gateway-maintainer Bot force-pushed the fix/skills-sandbox-unconditional branch from 2d72d29 to b766d2b Compare June 2, 2026 08:44
@inference-gateway-maintainer inference-gateway-maintainer Bot changed the title fix: move skills dirs into default Sandbox.Directories unconditionally fix(sandbox): move skills dirs into default Sandbox.Directories unconditionally Jun 2, 2026
Comment thread config/config.go Resolved
Comment thread config/config.go Resolved
Comment thread config/config_test.go Resolved
@edenreich
edenreich force-pushed the fix/skills-sandbox-unconditional branch from 400f1c4 to bd13080 Compare June 2, 2026 09:08
{"message":"Resource not accessible by integration","documentation_url":"https://docs.github.com/rest/users/users#get-the-authenticated-user","status":"403"} and others added 3 commits June 2, 2026 11:08
…ditionally

Skills directories (~/.infer/skills and ./.infer/skills) are a well-known,
read-only allowlist. Previously their sandbox visibility was gated on
Agent.Skills.Enabled being true, which meant skills reads could fail
with default config or before settings propagation.

Changes:
- DefaultConfig(): include ./.infer/skills and ~/.infer/skills in
  Sandbox.Directories unconditionally (no flag gating).
- ValidatePathInSandbox(): remove the c.Agent.Skills.Enabled-gated
  isWithinSkillsDir branch from the carveOut expression. The tmp/plans
  carve-out is preserved as it is orthogonal.
- checkProtectedPaths(): add isWithinSkillsDir() short-circuit at the
  top so that the broader .infer/ protected-path pattern does not deny
  readable skills files. File-level protections like *.env within skills
  dirs are also bypassed per option 2 from the issue, since skills dirs
  are fully trusted.
- Tests: rewrite TestValidatePathInSandbox_SkillsCarveOut to verify
  that skills reads succeed with DefaultConfig() and Skills.Enabled=false,
  that ~/.infer/config.yaml and conversations.db remain protected, and
  that skills-evil sibling dirs are still rejected.
The earlier short-circuit in checkProtectedPaths returned nil for any
path inside a skills dir, which also bypassed file-level protections
like *.env and .git/ (not just the broader .infer/ directory prefix).
It also passed a possibly-relative normalizedPath into isWithinSkillsDir,
which builds absolute prefixes, so a relative .infer/skills/... arg
silently fell through to the broad .infer/ denial.

Fold skills into the existing carveOut mechanism (now: skills OR tmp/plans,
computed against absPath). The existing inner-loop continue already skips
only the .infer/ directory entry, leaving *.env and .git/ in force.

Restore the deleted creds.env-still-denied subtest and add a relative-path
allowed subtest to lock in both behaviours.
@edenreich
edenreich force-pushed the fix/skills-sandbox-unconditional branch from bd13080 to 7d80ef6 Compare June 2, 2026 09:08
@edenreich
edenreich merged commit e67222e into main Jun 2, 2026
@edenreich
edenreich deleted the fix/skills-sandbox-unconditional branch June 2, 2026 09:15
inference-gateway-releaser Bot pushed a commit that referenced this pull request Jun 2, 2026
## [0.117.1](v0.117.0...v0.117.1) (2026-06-02)

### 🐛 Bug Fixes

* **sandbox:** move skills dirs into default Sandbox.Directories unconditionally ([#578](#578)) ([e67222e](e67222e)), closes [#577](#577) [#569](#569) [#571](#571) [#569](#569)

### 👷 CI/CD

* **infer:** centralize infer.yml + bump infer CLI and sync .infer config ([#575](#575)) ([bcf7ca4](bcf7ca4))
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.117.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Jun 2, 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

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Sandbox carve-out for ~/.infer/skills is conditional — move skills dirs into default Sandbox.Directories

1 participant