Skip to content

fix(rce): always use VM over RCE for custom tools#1233

Merged
waleedlatif1 merged 1 commit intostagingfrom
fix/rce
Sep 3, 2025
Merged

fix(rce): always use VM over RCE for custom tools#1233
waleedlatif1 merged 1 commit intostagingfrom
fix/rce

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

always use VM over RCE for custom tools, for consistency with variable/envvar resolution

Type of Change

  • Bug fix

Testing

Tested manually.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@waleedlatif1 waleedlatif1 merged commit 11d8188 into staging Sep 3, 2025
1 check passed
@waleedlatif1 waleedlatif1 deleted the fix/rce branch September 3, 2025 15:17
@vercel vercel bot temporarily deployed to Preview – docs September 3, 2025 15:17 Inactive
@vercel
Copy link

vercel bot commented Sep 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sim Building Building Preview Comment Sep 3, 2025 3:17pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Sep 3, 2025 3:17pm

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR addresses a critical consistency issue in code execution for custom tools. The change modifies the execution path selection logic in /apps/sim/app/api/function/execute/route.ts to prevent custom tools from using E2B (external sandbox execution) and forces them to always use the local VM instead.

The core modification adds !isCustomTool to the condition that determines whether to use E2B execution:

const useE2B =
  e2bEnabled &&
  !useLocalVM &&
  !isCustomTool &&  // <- This line was added
  (lang === CodeLanguage.JavaScript || lang === CodeLanguage.Python)

This change ensures that custom tools maintain consistent behavior with their existing parameter handling logic. The codebase already has special handling for custom tools in the local VM execution path (lines 759-764) where execution parameters are made directly accessible as variables (e.g., const location = params.location). Without this fix, when E2B was enabled, custom tools could bypass this specialized parameter resolution and use the E2B sandbox instead, potentially breaking their expected variable access patterns.

The fix integrates seamlessly with the existing architecture - the local VM execution path already contains the necessary custom tool handling logic, so by simply preventing the E2B execution path for custom tools, the PR ensures they always receive the consistent parameter handling they require for proper functionality.

Confidence score: 5/5

  • This PR is extremely safe to merge with virtually no risk of breaking existing functionality
  • Score reflects a minimal, well-targeted change that fixes a specific inconsistency without affecting other execution paths
  • No files require special attention as the change is isolated and surgical

1 file reviewed, no comments

Edit Code Review Bot Settings | Greptile

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