opencode/packages
Ryan Vogel 4a383ee7d4 fix(core): check webfetch permission on every redirect hop
webfetch checked the URL scheme and asked for permission only for the URL
the model requested, then let fetch follow redirects automatically. A page
the user approved (or allow-listed by host) could redirect to localhost,
169.254.169.254 or a LAN address and the body was returned without the
user or their deny rules ever seeing that target.

webfetch now fetches with `redirect: "manual"` (per request, through
FetchHttpClient.RequestInit, not by changing the shared client layer) and
follows 301/302/303/307/308 itself: each Location is resolved against the
current URL and goes through the same http(s) check and permission.assert
before it is requested. Chains are capped at 10 redirects. Each hop gets
its own timeout so a permission prompt for a redirect target does not
count against it. Behaviour without redirects is unchanged; the output
url is still the requested URL.

Removed behaviour: automatic redirect following without a permission
check; redirect chains longer than 10 now fail.

Verified: bun test test/tool-webfetch.test.ts (90 pass) from packages/core;
the updated 302 test, the new denied-target test and the scheme/cap test
fail against the old implementation; bun run typecheck:tsc in packages/core;
bun run check from the repo root.
2026-10-26 14:26:07 -04:00
..
ai ci: separate release builds from signing and publishing (#59046) 2026-10-26 14:21:29 -04:00
app ci: separate release builds from signing and publishing (#59046) 2026-10-26 14:21:29 -04:00
cli ci: separate release builds from signing and publishing (#59046) 2026-10-26 14:21:29 -04:00
client ci: separate release builds from signing and publishing (#59046) 2026-10-26 14:21:29 -04:00
codemode ci: separate release builds from signing and publishing (#59046) 2026-10-26 14:21:29 -04:00
console feat(console): serve apple-app-site-association for iOS pair links (#58540) 2026-10-25 15:53:00 -07:00
core fix(core): check webfetch permission on every redirect hop 2026-10-26 14:26:07 -04:00
desktop ci: separate release builds from signing and publishing (#59046) 2026-10-26 14:21:29 -04:00
effect-drizzle-sqlite sync release versions for v1.18.35 2026-10-06 20:18:36 +00:00
function sync release versions for v2.1.4 [skip ci] 2026-10-23 10:15:01 +00:00
gui-extensions ci: separate release builds from signing and publishing (#59046) 2026-10-26 14:21:29 -04:00
http-recorder sync release versions for v2.1.4 [skip ci] 2026-10-23 10:15:01 +00:00
httpapi-codegen fix(httpapi-codegen): emit flat Promise input field types (#58875) 2026-10-26 01:33:32 -05:00
identity
latex sync release versions for v2.1.4 [skip ci] 2026-10-23 10:15:01 +00:00
merman sync release versions for v2.1.4 [skip ci] 2026-10-23 10:15:01 +00:00
patchmark feat(session-ui): replace marked + remend streaming re-lexing with @opencode/patchmark (#57016) 2026-10-19 22:32:18 -07:00
plugin ci: separate release builds from signing and publishing (#59046) 2026-10-26 14:21:29 -04:00
plugin-browser ci: separate release builds from signing and publishing (#59046) 2026-10-26 14:21:29 -04:00
plugins sync release versions for v2.1.4 [skip ci] 2026-10-23 10:15:01 +00:00
posts chore: use bun check for local typechecks and TypeScript 7.1 in CI (#58253) 2026-10-23 09:23:31 +10:00
protocol ci: separate release builds from signing and publishing (#59046) 2026-10-26 14:21:29 -04:00
schema ci: separate release builds from signing and publishing (#59046) 2026-10-26 14:21:29 -04:00
script ci: separate release builds from signing and publishing (#59046) 2026-10-26 14:21:29 -04:00
sdk ci: separate release builds from signing and publishing (#59046) 2026-10-26 14:21:29 -04:00
server ci: separate release builds from signing and publishing (#59046) 2026-10-26 14:21:29 -04:00
session-ui fix(session-ui): make question highlight instant and hover-only (#59333) 2026-10-26 11:03:11 -07:00
simulation ci: separate release builds from signing and publishing (#59046) 2026-10-26 14:21:29 -04:00
stats docs(go): add Iceman Contributor Free (#58792) 2026-10-24 13:24:13 -07:00
stories chore: merge beta into dev 2026-10-26 13:56:31 +10:00
theme ci: separate release builds from signing and publishing (#59046) 2026-10-26 14:21:29 -04:00
tui fix(tui): keep pasted text intact when you copy it out of the prompt (#59209) 2026-10-26 09:57:10 -07:00
ui ci: separate release builds from signing and publishing (#59046) 2026-10-26 14:21:29 -04:00
util ci: separate release builds from signing and publishing (#59046) 2026-10-26 14:21:29 -04:00
web sync release versions for v2.1.4 [skip ci] 2026-10-23 10:15:01 +00:00