opencode/packages/core
Ryan Vogel 3d1addb2ac fix(core): ask the webfetch permission for Code Mode fetch calls
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.
2026-10-26 14:30:37 -04:00
..
script ci: separate release builds from signing and publishing (#59046) 2026-10-26 14:21:29 -04:00
src fix(core): ask the webfetch permission for Code Mode fetch calls 2026-10-26 14:30:37 -04:00
test fix(core): ask the webfetch permission for Code Mode fetch calls 2026-10-26 14:30:37 -04:00
bunfig.toml refactor(core): simplify integration test fixtures (#33292) 2026-06-22 04:15:34 +00:00
drizzle.config.ts refactor(core): move database schema ownership (#29068) 2026-05-30 21:08:38 -04:00
package.json ci: separate release builds from signing and publishing (#59046) 2026-10-26 14:21:29 -04:00
README.md refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
schema.json refactor(core): drop unused session_pending table and pin the history compaction bound (#59020) 2026-10-25 14:27:59 -07:00
sst-env.d.ts refactor: rename shared package to core (#24309) 2026-04-25 10:59:17 -04:00
tsconfig.build.json feat(core): configure package publishing 2026-08-12 09:30:34 -04:00
tsconfig.json chore: upgrade typecheck to TypeScript 7.0.2 (#56300) 2026-10-17 13:26:46 -07:00
tsconfig.tests.json chore: upgrade typecheck to TypeScript 7.0.2 (#56300) 2026-10-17 13:26:46 -07:00

@opencode/core

Core runtime services for OpenCode.