Repository navigation
fix(extension): reject tab URLs without a scheme - #580
Open
columbia11 wants to merge 10 commits into
Open
columbia11 wants to merge 10 commits into
columbia11 wants to merge 10 commits into
Conversation
`navigate`, `tab_create` and `record_start` passed the requested URL straight to Chrome. Chrome resolves a relative tab URL against the extension: in Chrome 156 both chrome.tabs.create and chrome.tabs.update turned `example.com` into chrome-extension://<id>/example.com. That is what `bsk tab new --url example.com` opened, and what `bsk navigate example.com` opened from a page that cannot be driven over CDP (for example chrome://newtab). Over CDP, navigate failed as `cdp_failed: Invalid URL` after the tab was prepared. Reject a URL that does not parse as absolute with `invalid_params` before touching the tab. `localhost:3000` and `example.com:8080` parse with the host as their scheme, so an opaque URL whose path is a port is rejected too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
columbia11
force-pushed
the
fix/reject-relative-urls
branch
from
November 4, 2026 06:26
2fb18c0 to
69cda79
Compare
Keep both Unreleased "Fixed" entries in CHANGELOG.md and add the Chinese entries for this PR and for Tencent#583 (merged before the Chinese changelog landed), so check-changelog-sync passes again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep both Unreleased "Fixed" entries (this PR's and Tencent#579's) in both changelogs; Tencent#583's Chinese entry is now on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
「Windows daemon, installer and cancellation regression tests」在 #580 上失败过两次,都出在 #601 新增的
同一份代码在 main(4c87b51f、ac6aea9a)和 #578/#577/#573/#572 上通过,#567 也遇到了同一个用例失败;#580 没有改动 Rust 代码。看起来是这组测试在 Windows runner 上不稳定。刚合入最新 main(e64b882a)已重新触发 CI,如果这个 job 再失败,麻烦帮忙重跑一下(fork 这边没有重跑权限)。 |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
navigate,tab_createandrecord_startpass the requested URL straight to Chrome. Chrome resolves a relative tab URL against the extension. Checked in Chrome 156.0.8078.80 with a throwaway extension:So:
bsk tab new --url example.comopens the extension's own (missing) page.bsk navigate example.comfrom a page that cannot be driven over CDP, such aschrome://newtab, takes thechrome.tabs.updatefallback and lands on the same page.cdp_failed: Invalid URL, fromnew URL(params.url), after the tab was already prepared.localhost:3000andexample.com:8080/pathparse as URLs withlocalhost:/example.com:as the scheme, so they also pass through and cannot open as websites.Fix
relativeUrlError()intools/shared.tsreturnsinvalid_params("url must be absolute, including its scheme (for example https://example.com)") when the URL does not parse, or when it is an opaque URL whose path is a port (host:port typed without a scheme;tel:andsms:are allowed).navigate,tab_createandrecord_startcall it before touching the tab.Tests
shared.test.ts: rejectsexample.com,/path,localhost:3000,example.com:8080/path; acceptshttps://,about:blank,data:,tel:and an omitted URL. The host:port cases fail without the port check.navigation.test.ts,tabs.test.ts,record-steps.test.ts: each entry point returnsinvalid_paramswithout sending CDP commands, creating a tab or messaging the page. These fail without the fix.vitest run: 3626 passed, 418 skipped.tsc --noEmitclean.biome checkclean on the changed files.This and #579 both add a line at the top of the CHANGELOG's Fixed list, so whichever merges second needs a trivial rebase.
🤖 Generated with Claude Code