mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-29 11:42:17 +00:00
The execute (Code Mode) tool exposes a `fetch` global that went straight to the network. The webfetch tool asks the `webfetch` permission for every URL, but Code Mode did not, so a `webfetch: deny` rule or a Console "Can't fetch the web" policy did nothing against a model that used `execute` to send data to any server. - core: the tool registry now asserts the `webfetch` permission (resource = the URL, same shape as the webfetch tool) in the extension.before hook of every fetch a Code Mode program makes. A denied URL throws inside the program and its progress row settles as an error. Tool.node now depends on Permission.node. - codemode: extension globals were called before their `extension.before` hook ran, so a failing hook only hid the result while the request had already been sent. The hook now runs first and a denied call never reaches the host function. A denied async global still rejects its promise; any other denied global throws. Verified: new cases in codemode/test/codemode.test.ts (denied host function is never called) and core/test/tool-execute.test.ts (webfetch deny rule fails the script's fetch, allow rule lets it through, each URL is asserted) both go red without the fix. bun typecheck in core and codemode, codemode suite (1415 pass), core suite (only pre-existing local failures: ripgrep download and macOS bash 3.2 shell tests, also failing on dev), bun run check. |
||
|---|---|---|
| .. | ||
| ai | ||
| app | ||
| cli | ||
| client | ||
| codemode | ||
| console | ||
| core | ||
| desktop | ||
| effect-drizzle-sqlite | ||
| function | ||
| gui-extensions | ||
| http-recorder | ||
| httpapi-codegen | ||
| identity | ||
| latex | ||
| merman | ||
| patchmark | ||
| plugin | ||
| plugin-browser | ||
| plugins | ||
| posts | ||
| protocol | ||
| schema | ||
| script | ||
| sdk | ||
| server | ||
| session-ui | ||
| simulation | ||
| stats | ||
| stories | ||
| theme | ||
| tui | ||
| ui | ||
| util | ||
| web | ||