Repository navigation
fix(browser): resolve DOM destinations against document base URL - #780
Closed
rudycelekli wants to merge 1 commit into
Closed
rudycelekli wants to merge 1 commit into
rudycelekli wants to merge 1 commit into
Conversation
Signed-off-by: Rudy Celekli <[email protected]>
Owner
|
Superseded by #815, which integrated this change and has now merged (3af3811). Thanks @rudycelekli for the fix and the thorough verification — much appreciated! |
This was referenced Oct 7, 2026
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.
Summary
Resolve live DOM destinations against Chrome's document base URL. Self-contained browser capture bug; no separate issue linked.
Problem and expected behavior
A page with
<base href="assets/">exposes its resolveddocument.baseURIin DOMSnapshot. Capture ignored it and resolved relative link/form/agent declarations against the document URL, producing wrong metadata. A base pointing outside the allowed origins also caused relative declarations to appear approved under the document origin. Metadata should match native browser resolution and then apply the existing destination policy.Change and scope
Use DOMSnapshot's indexed
baseURL, falling back to the document URL when absent. Resolve the BASE element's own href against the fallback document URL to avoid applying its relative base twice. Document admission still uses the document URL; destination admission still uses the resolved URL's allowed origin. Passive metadata only: no navigation or authority changes.Related merged #589 corrected static local artifact HTML script path relationships in
JavaScriptArtifactPathResolution. This changes the separate live CDP DOMSnapshot producer and its DOM URL/form-action/agent-hint metadata; it does not change local artifact path resolution or confinement. The prior PR's complete diff and owner follow-up were reviewed for overlap.Contract and boundary impact
docs/product-catalog.json), package, or installation impact: none.Evidence and regression coverage
guideunderassets/now reports<origin>/assets/guide; foreign-base destinations report null andoutside_policy.For evidence-bearing changes:
Validation performed
npm run test:focused -- src/browser/CdpCaptureDocuments.baseUrl.test.ts src/browser/CdpCaptureDocuments.test.ts tests/boundary/browser/cdpBrowserProvider.sensitive_data.test.ts— 14 passed across 3 files.npm run check— 5 tasks successful; 125 existing warnings, zero errors.npm run check:fast— 2 tasks successful.npm run verify:browser— actual Chrome154/PWcore1.58.2, verified true; CLI/MCP capture, source maps, 9.4MiB native PNG, popup and scenario cleanup controls pass. Process-lineage limitation stated above.git diff --check— passed; SSH signature and DCO verified. Reused exact Node24.18.0/Vitest5.0.3/TypeScript7.0.2 without dependency edits.Compatibility, safety, and release
AI assistance: implemented and independently source reviewed with Codex on behalf of @rudycelekli before publication.
Review checklist
type(scope): outcome.