Harden codemode browser executor#1505
Merged
Merged
Conversation
Protect iframe execution results and tool calls with per-run nonces so sandbox code cannot spoof completion messages, and surface ignored nonce mismatches as bounded warnings for easier debugging. Also reject sanitized tool name collisions and keep explicitly safe tools marked with needsApproval: false across AI, browser, and TanStack entry points. Run browser executor tests as part of the codemode package test script and update docs, README, examples, and changeset copy to describe the browser export, iframe options, and remaining timeout limitations. Co-authored-by: Cursor <cursoragent@cursor.com>
|
| Name | Type |
|---|---|
| @cloudflare/codemode | Patch |
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
Apply the same sanitized tool-name collision check to DynamicWorkerExecutor that the browser iframe executor already uses, so server-side and browser-side codemode fail consistently instead of silently overwriting colliding tools. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
needsApproval: falseremains available across AI, browser, framework-agnostic, and TanStack entry points, while approval-required tools stay excluded.Test plan
npm testinpackages/codemode(222 unit tests + 33 browser tests before TanStack coverage; later 223 unit tests + 33 browser tests after adding TanStack regression)npm run buildinpackages/codemodenpx vitest run --config vitest.browser.config.ts src/tests/iframe-executor.browser.test.tsReadLintson touched codemode files and docsNotes
while (true) {}because they block the browser event loop; this PR documents that limitation.cloudflare-docscheckout and is not part of this PR.Made with Cursor