fix(runtime): block click-driven navigation to internal URLs - #20
Draft
cursor[bot] wants to merge 1 commit into
Draft
fix(runtime): block click-driven navigation to internal URLs#20cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Click and type could leave the page on loopback or file targets after an allowed public navigate, so a later snapshot leaked internal HTML. Abort disallowed session requests and restore the prior page when the final URL is blocked. Co-authored-by: esadrianno <esadrianno@gmail.com>
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.
Bug
After an allowed public
navigate,click(and form submit via click) can send the page tohttp://127.0.0.1,file:, or other internal targets.snapshotthen returns that document. PR #16 only guards explicitnavigateand does not cover this path.Trigger
<a href="http://127.0.0.1:<victim>/secret">.htmlSnippet/domSummary.Live Chromium: public
data:(orlocaltest.me) page, click to loopback, marker present in snapshot before this change; companion integration test now expectsCOMMAND_FAILEDand no victim marker.Fix
@webchain/protocol(assertAllowedNavigateUrl).context.routeaborts file/internal requests for the session (covers click, form submit, JS navigation).click/type, restore the prior page if the final URL is blocked.snapshotrefuses to read a blocked page and restoresabout:blank.Distinct from #16 (schema +
navigate()only). This PR does not changeNavigateCommandSchema.Validation
pnpm lintpnpm --filter @webchain/protocol test:coveragepnpm --filter @webchain/runtime test:coveragepnpm --filter @webchain/companion testpnpm --filter @webchain/companion test:integration(includes live Chromium click-to-loopback case)