GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(core): apply webfetch URL rules to redirect targets by rekram1-node · Pull Request #59748 · anomalyco/opencode

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Oct 27, 2026 •
edited by opencodejr Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Problem

webfetch checked the URL rules for the URL the model asked for, then let fetch follow redirects on its own. So a webfetch deny rule (or a policy that only allows certain hosts) didn't apply to wherever the page redirected.

Change

webfetch now follows redirects itself and checks each new URL against the rules first. It never prompts for a redirect, it only stops when a rule denies the target.

fetch url (asks as before)
  302 → next url
    rules deny next?  → stop, "Permission denied: webfetch"
    otherwise         → follow it
  ... up to 10 redirects
  • Adds Permission.assertNotDenied: same evaluation as assert (config, session rules, saved approvals, plugin hooks) but it never asks, it only fails on deny.
  • Redirects to non http(s) URLs are rejected, and chains stop after 10 redirects.
  • No redirect means no change in behavior. Default setups see no new prompts.

Out of scope

A redirect to a URL that would normally ask is still followed without asking.

Verification

  • bun test test/permission.test.ts test/tool-webfetch.test.ts test/plugin/permission-assert.test.ts in packages/core: 200 pass
  • bun run check from the repo root: passes

Added by the opencode bot (AI-generated).

Related: #55232

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rekram1-node
fix(core): apply webfetch URL rules to redirect targets
908c54c
@github-actions github-actions Bot added the contributor label Oct 27, 2026
opencodejr[bot]
opencodejr Bot reviewed Oct 27, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. A redirect to a URL the rules deny is followed on the base and blocked with this change.

I couldn't run it through the TUI because the simulation backend blocks all outbound HTTP. Instead I ran a temporary test with the real fetch client and a local server where /redirect returns 302 to a denied /secret. On the base, webfetch returned the secret body. With this PR, it failed with "Permission denied: webfetch". Managed tool.use deny policies also apply to redirects, since they run through the same evaluate hook. The three test files pass (200 tests). The source type-checks cleanly with tsc; the package typecheck script can't run here because bun check isn't available.

Public API unchanged: Permission.Interface.assertNotDenied is internal to core, and the plugin, SDK, HTTP API and config are untouched.

No blocking concerns.

Related: #55232

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rekram1-node
rekram1-node merged commit 17837a2 into dev Oct 27, 2026
16 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@rekram1-node
rekram1-node deleted the webfetch-redirect-rules branch October 27, 2026 21:57
alsuren pushed a commit to alsuren/opencode that referenced this pull request Oct 28, 2026
@rekram1-node @alsuren
fix(core): apply webfetch URL rules to redirect targets (anomalyco#59748
22f9782
)
@Edo771977 Edo771977 mentioned this pull request Oct 28, 2026
chore: merge upstream/dev into the fork Edo771977/opencode#57
Merged
3 of 6 tasks
This was referenced Oct 29, 2026
chore(upstream): порт v2.2.1 — 71 в порт, 67 на решение gpt-mem/opencode-mem#219
Open
chore(upstream): порт v2.2.2 — 27 в порт, 88 на решение gpt-mem/opencode-mem#220
Open
@opencodejr opencodejr Bot mentioned this pull request Nov 2, 2026
Plugin http.request hook: redirect mode on the returned Request is dropped, so redirects are always followed #61272
Open
This was referenced Nov 3, 2026
Backport upstream webfetch URL-policy fixes: deny-check redirects, canonicalize before matching swxtchio/swx-opencode-archive#389
Closed
fix(core): enforce webfetch URL policy across adapters swxtchio/swx-opencode-archive#396
Merged
brentyates-swx pushed a commit to swxtchio/swx-opencode-archive that referenced this pull request Nov 3, 2026
@rekram1-node @brentyates-swx
fix(core): apply webfetch URL rules to redirect targets (anomalyco#59748
9800d21
)

Port redirect denial into the current V2 built-in and separate V1 adapter. The V2 deny-only check uses the explicit invocation agent; V1 binds the merged agent/session rules through SessionTools. Resolve and deny-check each HTTP(S) redirect before transport; allow and ask-only destinations continue without a new prompt. Preserve both adapters' existing output contracts and Cloudflare retry behavior. Canonical URL identity remains the next donor's scope.

(cherry picked from commit 17837a2)
brentyates-swx added a commit to swxtchio/swx-opencode-archive that referenced this pull request Nov 4, 2026
@brentyates-swx @rekram1-node
fix(core): enforce webfetch URL policy across adapters (#396)
1b2e934
* chore(core): plan webfetch URL policy backport

1. Cherry-pick the redirect-denial donor first and adapt deny-only checks to the current V2 permission service and the V1 session-bound policy path.
2. Cherry-pick the canonicalization donor second; use parsed HTTP(S) serialization for policy and transport in both adapters, while leaving Code Mode out.
3. Add executor-driven regressions for canonical allow/deny, redirect targets and chains, ask-only destinations, unsupported URLs, and live transport request evidence; demonstrate focused red/green absence proofs.
4. Record donor provenance, compatibility adaptations, fork paths, and executed focused results in CHANGESET.md, then run the required crew gates.

* fix(core): apply webfetch URL rules to redirect targets (anomalyco#59748)

Port redirect denial into the current V2 built-in and separate V1 adapter. The V2 deny-only check uses the explicit invocation agent; V1 binds the merged agent/session rules through SessionTools. Resolve and deny-check each HTTP(S) redirect before transport; allow and ask-only destinations continue without a new prompt. Preserve both adapters' existing output contracts and Cloudflare retry behavior. Canonical URL identity remains the next donor's scope.

(cherry picked from commit 17837a2)

* fix(core): match web permissions against the URL that is requested (anomalyco#60505)

Port canonical URL identity into the fork's existing V2 and V1 webfetch owners, using the parsed HTTP(S) href for initial policy matching and transport. Redirect targets remain resolved and checked by their serialized URL. Preserve the V1 image attachment and V2 unsupported-attachment contracts.

This is a partial port of anomalyco#60505: exclude its packages/core/src/codemode/fetch.ts changes because that Code Mode API is not a drop-in to this fork's current path. Adapted owners: packages/core/src/tool/webfetch.ts and packages/opencode/src/tool/webfetch.ts.

(cherry picked from commit 805a4b8)

* docs(opencode): record webfetch URL policy backport

* fix(webfetch): cancel discarded response bodies

Cancel unread redirect and rejected-response bodies in the V1 and V2 executors, with live streaming regressions for release paths. Record the adoption split as partly upstream.

Claude-Session: ses_e5cdbcb11ffeK5x75lZZqBWCmy

* docs(opencode): record webfetch response release proofs

Claude-Session: ses_e5cdbcb11ffeK5x75lZZqBWCmy

---------

Co-authored-by: Aiden Cline <[email protected]>
This was referenced Nov 4, 2026
webfetch follows redirects to URLs the permission rules deny AltimateAI/altimate-code#1658
Open
fix(tool): port upstream webfetch redirect rule checks (anomalyco/opencode#59748) AltimateAI/altimate-code#1660
Open
upstream: provider/security fixes not yet ported AltimateAI/altimate-code#1478
Open
AbizardShafwan pushed a commit to AbizardShafwan/opencode that referenced this pull request Nov 9, 2026
@rekram1-node Abizard Sulaiman
fix(core): apply webfetch URL rules to redirect targets (anomalyco#59748
0b9b4cb
)
hunterchristian added a commit to chipp-ai/opencode that referenced this pull request Nov 13, 2026
@hunterchristian
fix(core): check webfetch redirect permissions before requests
eda5035
Adapt anomalyco/opencode 17837a2 (anomalyco#59748), 125655e (anomalyco#61701), and e803323 (anomalyco#62373). Use this fork's existing permission assertions per redirect; reject URL credentials, ignore fragments, and bound redirects. Prove denied destinations receive no HTTP request.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencodejr opencodejr[bot] opencodejr[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

contributor

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@rekram1-node
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.