Cherry-pick 301765.417@safari-7623-branch (75bcb9f43cbe). rdar://169213380#61371
Merged
webkit-commit-queue merged 1 commit intoWebKit:mainfrom Mar 27, 2026
Merged
Conversation
Collaborator
|
EWS run on previous version of this PR (hash 249828e) Details |
249828e to
4cb277e
Compare
Collaborator
|
EWS run on previous version of this PR (hash 4cb277e) Details
|
Collaborator
macOS Safer C++ Build #88800 (249828e)❌ Found 1 failing file with 4 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming. |
Collaborator
macOS Safer C++ Build #88814 (4cb277e)❌ Found 1 failing file with 4 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming. |
4cb277e to
fd1caf7
Compare
Collaborator
|
EWS run on current version of this PR (hash fd1caf7) Details |
…13380
Block text fragments in cross-origin window.open() popups.
rdar://163804356
Reviewed by Chris Dumez.
This implements a security defense against timing side-channel attacks
using Text Fragments in cross-origin popups.
The exploit pattern:
w = window.open("attacker.com");
w.location = "victim.com";
w.location = "victim.com#:~:text=secret";
w.location = "about:blank";
// Measure timing to detect if text was found
Defense mechanism:
- Add checkTextFragmentSecurity() in LocalFrameView.cpp
- Block text fragments when opener origin ≠ current document origin
- Allow text fragments in same-origin popups (legitimate use)
- Allow text fragments in top-level navigation (no opener)
This aligns with Chrome's 2019 defense (commit c0d3c4cca8b16),
which uses RelatedPages().size() check. WebKit uses a simpler
cross-origin check that achieves the same security goal.
The fix does not affect about:blank origin inheritance or WPT tests,
as those don't use text fragments.
Tests: http/tests/security/text-fragment/popup-cross-origin-blocked.html
http/tests/security/text-fragment/popup-same-origin-allowed.html
* LayoutTests/http/tests/security/resources/page-with-text.html: Added.
* LayoutTests/http/tests/security/text-fragment/popup-cross-origin-blocked-expected.txt: Added.
* LayoutTests/http/tests/security/text-fragment/popup-cross-origin-blocked.html: Added.
* LayoutTests/http/tests/security/text-fragment/popup-same-origin-allowed-expected.txt: Added.
* LayoutTests/http/tests/security/text-fragment/popup-same-origin-allowed.html: Added.
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::checkTextFragmentSecurity):
(WebCore::LocalFrameView::scrollToTextFragment):
Identifier: 301765.417@safari-7623-branch
Identifier: 305413.221@safari-7624-branch
Canonical link: https://commits.webkit.org/310046@main
fd1caf7 to
279154a
Compare
Collaborator
|
Committed 310046@main (279154a): https://commits.webkit.org/310046@main Reviewed commits have been landed. Closing PR #61371 and removing active labels. |
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.
🛠 vision-apple
279154a
fd1caf7