Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 756cb4b84bc86bc86d68b63f2af8b38f3e48bce2
      
https://github.com/WebKit/WebKit/commit/756cb4b84bc86bc86d68b63f2af8b38f3e48bce2
  Author: Wenson Hsieh <[email protected]>
  Date:   2026-09-14 (Mon, 14 Sep 2026)

  Changed paths:
    M Source/WebKit/Shared/TextExtractionToStringConversion.cpp
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm

  Log Message:
  -----------
  [Text Extraction] Usernames/email addresses are sometimes unredacted when 
`replacementStrings` is set
https://bugs.webkit.org/show_bug.cgi?id=324207
rdar://187424259

Reviewed by Abrar Rahman Protyasha.

Add more heuristics around how `replacementStrings` are applied:

1.  Fall back to filtering out any match in a word regardless of word 
boundaries, as long as the
    matched word contains an `@`. This allows the redactor to (much more 
effectively) filter out
    names from email addresses, such that (for instance) `John Apple`'s email 
address of
    `[email protected]` would become `[email protected]`, if the first and 
last name
    replacements are `Jane`, `Doe` respectively.

2.  Additionally apply replacements to form control label attributes.

Test: TextExtractionTests.ReplacementStringsForEmailAddresses

* Source/WebKit/Shared/TextExtractionToStringConversion.cpp:
(WebKit::matchIsWordBounded):
(WebKit::TextExtractionAggregator::redactedText const):
(WebKit::TextExtractionAggregator::applyReplacements const):
(WebKit::TextExtractionAggregator::addNativeMenuItemsIfNeeded):
(WebKit::redactedAndEscaped):
(WebKit::redactedAndEscapedForHTML):
(WebKit::redactedAndEscapedForMarkdown):
(WebKit::setCommonJSONProperties):
(WebKit::populateJSONForItem):
(WebKit::partsForItem):
(WebKit::addPartsForItem):
(WebKit::TextExtractionAggregator::applyReplacements): Deleted.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm:
(TestWebKitAPI::TEST(TextExtractionTests, ReplacementStringsForEmailAddresses)):

Canonical link: https://commits.webkit.org/321141@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to