WebKit Bugzilla
Attachment 346186 Details for
Bug 188203
: Hardcode some system colors to avoid fingerprinting exposure
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188203-20180731120744.patch (text/plain), 8.81 KB, created by
Timothy Hatcher
on 2018-07-31 12:07:45 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Timothy Hatcher
Created:
2018-07-31 12:07:45 PDT
Size:
8.81 KB
patch
obsolete
>Subversion Revision: 234428 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index b2be80101e53bbfe715badaa232ed109adfbbdac..5e205fd3f76aa3593948038ed9b22d46d29775f6 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,17 @@ >+2018-07-31 Timothy Hatcher <timothy@apple.com> >+ >+ Hardcode some system colors to avoid fingerprinting exposure. >+ https://bugs.webkit.org/show_bug.cgi?id=188203 >+ rdar://problem/42781630 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Passes existing tests with the hardcoded blue system appearance. >+ >+ * rendering/RenderTheme.h: >+ * rendering/RenderThemeMac.mm: >+ (WebCore::RenderThemeMac::systemColor const): >+ > 2018-07-31 Yusuke Suzuki <utatane.tea@gmail.com> > > Use static const global variable for TransformationMatrix instead of NeverDestroyed >diff --git a/Source/WebCore/rendering/RenderTheme.h b/Source/WebCore/rendering/RenderTheme.h >index 84d282da56f0772d34d922198c5cb340cf3534dc..5ef5bfc18671fa6dc96416a092eb326975de52b4 100644 >--- a/Source/WebCore/rendering/RenderTheme.h >+++ b/Source/WebCore/rendering/RenderTheme.h >@@ -413,6 +413,10 @@ protected: > Color systemLinkColor; > Color systemActiveLinkColor; > Color systemVisitedLinkColor; >+ Color systemFocusRingColor; >+ Color systemControlAccentColor; >+ Color systemSelectedTextBackgroundColor; >+ Color systemSelectedContentBackgroundColor; > > Color activeSelectionBackgroundColor; > Color inactiveSelectionBackgroundColor; >diff --git a/Source/WebCore/rendering/RenderThemeMac.mm b/Source/WebCore/rendering/RenderThemeMac.mm >index 37665fd32d24762371bdc8209ce6c2e740e2f0aa..90c692a9ad4e378adf3888db046ae3c007c988d7 100644 >--- a/Source/WebCore/rendering/RenderThemeMac.mm >+++ b/Source/WebCore/rendering/RenderThemeMac.mm >@@ -550,7 +550,7 @@ Color RenderThemeMac::systemColor(CSSValueID cssValueID, OptionSet<StyleColor::O > auto& cache = colorCache(options); > > if (useSystemAppearance) { >- // Only use NSColor for links when the system appearance is desired. >+ // Special handling for links and other system colors when the system appearance is desired. > auto systemAppearanceColor = [] (Color& color, SEL selector) -> Color { > if (!color.isValid()) { > auto systemColor = wtfObjcMsgSend<NSColor *>([NSColor class], selector); >@@ -561,15 +561,42 @@ Color RenderThemeMac::systemColor(CSSValueID cssValueID, OptionSet<StyleColor::O > }; > > switch (cssValueID) { >+ // Web views that want system appearance get the system version of link colors, which differ from the HTML spec. > case CSSValueWebkitLink: > if (forVisitedLink) > return systemAppearanceColor(cache.systemVisitedLinkColor, @selector(systemPurpleColor)); > return systemAppearanceColor(cache.systemLinkColor, @selector(linkColor)); >+ > case CSSValueWebkitActivelink: > // FIXME: Use a semantic system color for this, instead of systemRedColor. <rdar://problem/39256684> > return systemAppearanceColor(cache.systemActiveLinkColor, @selector(systemRedColor)); >+ >+ // The following colors would expose user appearance preferences to the web, and could be used for fingerprinting. >+ // These should only be available when the web view is wanting the system appearance. >+ case CSSValueWebkitFocusRingColor: >+ case CSSValueActiveborder: >+ return systemAppearanceColor(cache.systemFocusRingColor, @selector(keyboardFocusIndicatorColor)); >+ >+ case CSSValueAppleSystemControlAccent: >+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 >+ return systemAppearanceColor(cache.systemControlAccentColor, @selector(controlAccentColor)); >+#else >+ return systemAppearanceColor(cache.systemControlAccentColor, @selector(alternateSelectedControlColor)); >+#endif >+ >+ case CSSValueAppleSystemSelectedContentBackground: >+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 >+ return systemAppearanceColor(cache.systemSelectedContentBackgroundColor, @selector(selectedContentBackgroundColor)); >+#else >+ return systemAppearanceColor(cache.systemSelectedContentBackgroundColor, @selector(alternateSelectedControlColor)); >+#endif >+ >+ case CSSValueAppleSystemSelectedTextBackground: >+ case CSSValueHighlight: >+ return systemAppearanceColor(cache.systemSelectedTextBackgroundColor, @selector(selectedTextBackgroundColor)); >+ > default: >- // Handle non-link colors below, with the regular cache. >+ // Handle other system colors below, that don't need special system appearance handling. > break; > } > } else if (forVisitedLink && cssValueID == CSSValueWebkitLink) { >@@ -583,8 +610,6 @@ Color RenderThemeMac::systemColor(CSSValueID cssValueID, OptionSet<StyleColor::O > return cache.systemStyleColors.ensure(cssValueID, [this, cssValueID, options] () -> Color { > auto selectCocoaColor = [cssValueID] () -> SEL { > switch (cssValueID) { >- case CSSValueActiveborder: >- return @selector(keyboardFocusIndicatorColor); > case CSSValueActivecaption: > return @selector(windowFrameTextColor); > case CSSValueAppworkspace: >@@ -599,8 +624,6 @@ Color RenderThemeMac::systemColor(CSSValueID cssValueID, OptionSet<StyleColor::O > return @selector(textColor); > case CSSValueGraytext: > return @selector(disabledControlTextColor); >- case CSSValueHighlight: >- return @selector(selectedTextBackgroundColor); > case CSSValueHighlighttext: > return @selector(selectedTextColor); > case CSSValueInactiveborder: >@@ -625,8 +648,6 @@ Color RenderThemeMac::systemColor(CSSValueID cssValueID, OptionSet<StyleColor::O > return @selector(highlightColor); > case CSSValueThreedlightshadow: > return @selector(controlLightHighlightColor); >- case CSSValueWebkitFocusRingColor: >- return @selector(keyboardFocusIndicatorColor); > case CSSValueWindow: > return @selector(windowBackgroundColor); > case CSSValueWindowframe: >@@ -641,18 +662,6 @@ Color RenderThemeMac::systemColor(CSSValueID cssValueID, OptionSet<StyleColor::O > return @selector(controlBackgroundColor); > case CSSValueAppleSystemAlternateSelectedText: > return @selector(alternateSelectedControlTextColor); >- case CSSValueAppleSystemControlAccent: >-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 >- return @selector(controlAccentColor); >-#else >- return @selector(alternateSelectedControlColor); >-#endif >- case CSSValueAppleSystemSelectedContentBackground: >-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 >- return @selector(selectedContentBackgroundColor); >-#else >- return @selector(alternateSelectedControlColor); >-#endif > case CSSValueAppleSystemUnemphasizedSelectedContentBackground: > #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 > return @selector(unemphasizedSelectedContentBackgroundColor); >@@ -667,8 +676,6 @@ Color RenderThemeMac::systemColor(CSSValueID cssValueID, OptionSet<StyleColor::O > #else > return @selector(textColor); > #endif >- case CSSValueAppleSystemSelectedTextBackground: >- return @selector(selectedTextBackgroundColor); > case CSSValueAppleSystemUnemphasizedSelectedTextBackground: > #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 > return @selector(unemphasizedSelectedTextBackgroundColor); >@@ -748,6 +755,24 @@ Color RenderThemeMac::systemColor(CSSValueID cssValueID, OptionSet<StyleColor::O > case CSSValueMenu: > return menuBackgroundColor(); > >+ case CSSValueWebkitFocusRingColor: >+ case CSSValueActiveborder: >+ // Hardcoded to avoid exposing a user appearance preference to the web for fingerprinting. >+ return 0xFF7DADD9; >+ >+ case CSSValueAppleSystemControlAccent: >+ // Hardcoded to avoid exposing a user appearance preference to the web for fingerprinting. >+ return 0xFF007AFF; >+ >+ case CSSValueAppleSystemSelectedContentBackground: >+ // Hardcoded to avoid exposing a user appearance preference to the web for fingerprinting. >+ return 0xFF0063E1; >+ >+ case CSSValueHighlight: >+ case CSSValueAppleSystemSelectedTextBackground: >+ // Hardcoded to avoid exposing a user appearance preference to the web for fingerprinting. >+ return 0xFFB3D7FF; >+ > #if __MAC_OS_X_VERSION_MIN_REQUIRED < 101300 > case CSSValueAppleSystemFindHighlightBackground: > return platformActiveTextSearchHighlightColor(options);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188203
:
346186
|
346194
|
346196
|
346209
|
346210
|
346218
|
346219
|
346221
|
346254