mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-29 11:42:17 +00:00
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. |
||
|---|---|---|
| .. | ||
| 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 | ||