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(tool): port upstream webfetch redirect rule checks (anomalyco/opencode#59748) by devin-ai-integration[bot] · Pull Request #1660 · AltimateAI/altimate-code

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 4, 2026 •
edited by cubic-dev-ai Bot
Loading

Uh oh!

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

Copy link
Copy Markdown

Issue for this PR

Closes #1658

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Ports the upstream webfetch permission fixes to the fork's packages/opencode/src/tool/webfetch.ts:

  • fix(core): apply webfetch URL rules to redirect targets anomalyco/opencode#59748: webfetch used fetch's default redirect: "follow", so only the URL the model passed was checked against the webfetch rules. An allowed page that redirects to a denied URL (for example http://169.254.169.254/... under {"*": "allow", "http://169.254.169.254/*": "deny"}) was fetched and returned to the model. Redirects are now followed by hand (redirect: "manual", max 10 hops). Each target is evaluated against the effective ruleset (ctx.permissions) before it is requested. A denied target throws PermissionDeniedError; as upstream does, the user is not asked again for redirect targets. Redirects to non-HTTP schemes fail.
  • fix(core): reject URL credentials and ignore fragments in web permissions anomalyco/opencode#61701: URLs with credentials are rejected, both the requested URL and redirect targets. Without this, a rule for https://docs.example.com* also matched https://[email protected]/. Fragments are dropped before rules are matched.
  • fix(core): match web permissions against the URL that is requested anomalyco/opencode#60505: the permission prompt matches the normalized URL.href, not the raw string the model typed.

Upstream made these changes in the v2 packages/core/src/tool/plugin/webfetch.ts. This PR adapts them to the fork's legacy tool and wraps the changes in altimate_change ... upstream_fix: markers. The failure cache, UA fallback and error messages are unchanged.

How did you verify your code works?

  • Added four tests to packages/opencode/test/tool/webfetch.test.ts: an allowed redirect is followed, a denied redirect target stops before it is requested, non-HTTP and endless redirects fail, and credentials are rejected. On main, the denied-redirect, scheme and credential tests fail. With this change, all 37 tests in webfetch.test.ts and webfetch-cache.test.ts pass.
  • bun run typecheck (tsgo) in packages/opencode passes, and so does the pre-push bun typecheck.
  • bun run script/upstream/analyze.ts --markers --base origin/main --strict: ok.

Cost side effects

None. A redirect issues the same number of HTTP requests as before. Rule checks are local.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR
  • I checked for cost side effects (model calls, queries or cloud resources that grow with user data) and described them, or wrote "none"

Tracked in #1478.

Written by Devin


Summary by cubic

Fixes the webfetch tool's permission checks so allowed pages can no longer redirect to denied URLs, and incoming URLs are normalized before being matched against rules.

  • Follows redirects manually (max 10 hops) and checks each target against the effective ruleset before requesting it; denied targets throw without prompting the user again.
  • Rejects URLs with embedded credentials and drops URL fragments before matching rules, so a rule like https://docs.example.com* no longer matches https://[email protected]/.
  • Permission prompts now use the normalized URL.href instead of the raw input string.
  • Adds four tests covering allowed redirects, denied redirect targets, non-HTTP and endless redirects, and credential rejection.

Written for commit 0e4745a. Summary will update on new commits.

View guided diff Turn on auto-fix

Sorry, something went wrong.

Uh oh!

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

All reactions
@devin-ai-integration
fix(tool): port upstream webfetch redirect rule checks (anomalyco/ope…
0e4745a
…ncode#59748)

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
devin-ai-integration Bot requested a review from anandgupta42 November 4, 2026 17:56
@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2a864f37-f179-4638-829f-281ca27d2892

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn
All reactions

Sorry, something went wrong.

Uh oh!

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

@devin-ai-integration devin-ai-integration Bot mentioned this pull request Nov 4, 2026
upstream: provider/security fixes not yet ported #1478
Open
29 of 90 tasks
@devin-ai-integration

devin-ai-integration Bot commented Nov 4, 2026

Copy link
Copy Markdown
Author

CI note: the only red check is TypeScript, and it failed on one test unrelated to this change. test/altimate/learn/bootstrap-import-failure.test.ts timed out at 5000ms ("instance bootstrap survives a failed capture import"). The test passes locally on this branch (2 of 2 runs), and the same job passed on #1661. The Devin integration can't re-run jobs (HTTP 403), so a maintainer re-run of the job is needed.

Written by Devin

All reactions

Sorry, something went wrong.

Uh oh!

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@anandgupta42 anandgupta42 Awaiting requested review from anandgupta42

At least 1 approving review is required to merge this pull request.

Uh oh!

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

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

webfetch follows redirects to URLs the permission rules deny

Uh oh!

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

0 participants

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.