Cherry-pick: feat: enhance sandbox boundary checks to prevent access to internal constructors and ensure plain JSON serialization of tool schemas - #514
Conversation
…onstructors and ensure plain JSON serialization of tool schemas (#512) * Cherry-pick: chore: update mcp-from-openapi to version 2.5.1 in package.json and yarn.lock (#509) Cherry-picked from #508 (merged to release/1.5.x) Original commit: 82f5351 Co-authored-by: agentfront[bot] <agentfront[bot]@users.noreply.github.com> Co-authored-by: frontegg-david <69419539+frontegg-david@users.noreply.github.com> * Cherry-pick: fix: enhance SSRF protection in OpenAPI polling to block internal addresses by default and allow configuration for trusted environments (#511) Cherry-picked from #510 (merged to release/1.5.x) Original commit: 077201e Co-authored-by: agentfront[bot] <agentfront[bot]@users.noreply.github.com> Co-authored-by: frontegg-david <69419539+frontegg-david@users.noreply.github.com> * feat: enhance sandbox boundary checks to prevent access to internal constructors and ensure plain JSON serialization of tool schemas * feat: enhance tool introspection to return undefined for tools outside the allowedTools whitelist and improve plain JSON schema handling * feat: update tool description retrieval to handle undefined cases and improve schema handling * feat: update tool description retrieval to handle undefined cases and improve schema handling * feat: update tool description retrieval to handle undefined cases and improve schema handling * feat: update tool description retrieval to handle undefined cases and improve schema handling --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: agentfront[bot] <agentfront[bot]@users.noreply.github.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (19)
📝 WalkthroughWalkthroughThe PR hardens CodeCall and enclave boundaries by plainizing tool metadata and MCP content, cloning sandbox inputs and outputs, blocking sandbox escape paths, validating package installation containment, and synchronizing related package versions. ChangesCodeCall boundary hardening
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Script
participant CodeCall
participant Enclave
participant Tool
Script->>CodeCall: getTool(name)
CodeCall->>CodeCall: filter and plainize metadata
CodeCall-->>Script: metadata or undefined
Script->>Enclave: execute(input)
Enclave->>Tool: callTool or getTool
Tool-->>Enclave: tool result
Enclave-->>Script: cloned result or ToolError
Possibly related PRs
Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
This PR hardens sandbox boundary behavior and tool introspection, primarily in the CodeCall plugin and the SDK’s Enclave bridge, while also updating related package versions and strengthening CLI install-time path containment checks.
Changes:
- Updated CodeCall’s
getToolintrospection and tool-result extraction to return plain JSON projections (orundefined) and to enforce the same self-reference +allowedToolsvisibility rules as tool execution. - Tightened the SDK Job Enclave bridge boundary by structured-cloning inputs and tool callback results before they cross into the sandbox.
- Strengthened
frontmcp installfile-copy handling (plugin name validation + contained, realpath-resolved regular-file checks) and refreshed dependency/package versions (incl.@enclave-vm/*,mcp-from-openapi, and workspace version bumps).
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Updates lockfile for dependency/version bumps (workspace + enclave-vm + mcp-from-openapi). |
| plugins/plugin-codecall/src/utils/plain-json.ts | Adds toPlainJson helper to project values into plain JSON-safe structures. |
| plugins/plugin-codecall/src/utils/mcp-result.ts | Uses toPlainJson for complex MCP content extraction to avoid leaking prototypes/constructors. |
| plugins/plugin-codecall/src/utils/index.ts | Re-exports the new plain-JSON helper. |
| plugins/plugin-codecall/src/tools/execute.tool.ts | Aligns getTool introspection visibility with callTool rules and returns plain JSON schemas. |
| plugins/plugin-codecall/src/README.md | Documents getTool returning undefined and schema/null behavior. |
| plugins/plugin-codecall/src/codecall.symbol.ts | Introduces CodeCallToolDescription and clarifies getTool return semantics. |
| plugins/plugin-codecall/src/tests/plain-json.spec.ts | Adds unit coverage for JSON projection behavior and edge cases (cycles, pinned props). |
| plugins/plugin-codecall/src/tests/mcp-result.spec.ts | Adds tests ensuring multi-content results are copied/flattened or become undefined if non-representable. |
| plugins/plugin-codecall/src/tests/execute.tool.spec.ts | Updates/extends tests for getTool schema projection, whitelist behavior, and meta-tool hiding. |
| plugins/plugin-codecall/package.json | Bumps plugin version and aligns deps/peerDeps to 1.5.6 and enclave-vm ^2.15.1. |
| package.json | Bumps root dependency on @enclave-vm/core to ^2.15.1. |
| libs/utils/package.json | Bumps @enclave-vm/ast to ^2.15.1. |
| libs/sdk/src/job/enclave/job-enclave.bridge.ts | Adds boundary cloning via structuredClone for inputs and tool callback results. |
| libs/sdk/src/job/enclave/tests/job-enclave.bridge.spec.ts | Adds test coverage for clone semantics, lifecycle, and rejection of non-cloneables. |
| libs/sdk/package.json | Bumps SDK version and aligns internal deps/peerDeps to 1.5.6 and enclave-vm ^2.15.1. |
| libs/cli/src/commands/package/install.ts | Validates plugin name and ensures copied files are contained + regular files using realpath/stat. |
| libs/cli/src/commands/package/tests/install.spec.ts | Adds extensive tests for install source handling and containment/symlink/file-type protections. |
| docs/frontmcp/plugins/codecall/agentscript.mdx | Updates docs for getTool visibility rules and plain JSON schema/null behavior. |
| apps/e2e/demo-e2e-codecall/e2e/codecall.e2e.spec.ts | Adds E2E coverage for schema inertness and sandbox boundary escape hardening. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Cherry-picked from #508 (merged to release/1.5.x)
Original commit: 82f5351
Co-authored-by: agentfront[bot] <agentfront[bot]@users.noreply.github.com>
Co-authored-by: frontegg-david 69419539+frontegg-david@users.noreply.github.com
Cherry-picked from #510 (merged to release/1.5.x)
Original commit: 077201e
Co-authored-by: agentfront[bot] <agentfront[bot]@users.noreply.github.com>
Co-authored-by: frontegg-david 69419539+frontegg-david@users.noreply.github.com
feat: enhance sandbox boundary checks to prevent access to internal constructors and ensure plain JSON serialization of tool schemas
feat: enhance tool introspection to return undefined for tools outside the allowedTools whitelist and improve plain JSON schema handling
feat: update tool description retrieval to handle undefined cases and improve schema handling
feat: update tool description retrieval to handle undefined cases and improve schema handling
feat: update tool description retrieval to handle undefined cases and improve schema handling
feat: update tool description retrieval to handle undefined cases and improve schema handling
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: agentfront[bot] <agentfront[bot]@users.noreply.github.com>
Summary by CodeRabbit
Security Enhancements
Bug Fixes
Documentation
getToolbehavior, including unavailable tools and optional metadata.