Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WKWebsiteDataTypeHashSalt to allow fetching/removing DeviceIDHashSalt data #10884

Conversation

szewai
Copy link
Contributor

@szewai szewai commented Mar 1, 2023

2630f20

Add WKWebsiteDataTypeHashSalt to allow fetching/removing DeviceIDHashSalt data
https://bugs.webkit.org/show_bug.cgi?id=253174
rdar://106096684

Reviewed by Chris Dumez.

Otherwise the data type cannot be viewed by WebKit client.

* Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecord.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
(dataTypesToString):
* Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
(WebKit::toWebsiteDataType):
(WebKit::toWKWebsiteDataTypes):
* Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(+[WKWebsiteDataStore allWebsiteDataTypes]):

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

9ae8f5d

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ wpe-wk2
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ›  gtk
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk1 βœ… πŸ§ͺ gtk-wk2
βœ… πŸ›  tv βœ… πŸ§ͺ mac-wk2 βœ… πŸ§ͺ api-gtk
βœ… πŸ›  tv-sim βœ… πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  watch βœ… πŸ§ͺ mac-wk2-stress
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch-sim

@szewai szewai self-assigned this Mar 1, 2023
@szewai szewai added the New Bugs Unclassified bugs are placed in this component until the correct component can be determined. label Mar 1, 2023
@szewai szewai requested a review from youennf March 1, 2023 19:23
@szewai szewai marked this pull request as ready for review March 2, 2023 16:25
@szewai szewai requested a review from cdumez as a code owner March 2, 2023 16:25
@szewai szewai force-pushed the eng/Add-WKWebsiteDataTypeHashSalt-to-allow-fetchingremoving-DeviceIDHashSalt-data branch from c79c913 to fbbc05f Compare March 2, 2023 16:37
@@ -140,6 +140,7 @@ RegistrationDatabase::RegistrationDatabase(RegistrationStore& store, String&& da
, m_databaseDirectory(WTFMove(databaseDirectory))
, m_databaseFilePath(FileSystem::pathByAppendingComponent(m_databaseDirectory, databaseFilename()))
{
WTFLogAlways("sihuil:[%p]RegistrationDatabase::RegistrationDatabase m_databaseFilePath[%s]", this, m_databaseFilePath.utf8().data());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah will removed.

@@ -687,7 +687,7 @@ void WebsiteDataStore::removeData(OptionSet<WebsiteDataType> dataTypes, WallTime
}
}

if (dataTypes.contains(WebsiteDataType::DeviceIdHashSalt) || (dataTypes.contains(WebsiteDataType::Cookies)))
if (dataTypes.contains(WebsiteDataType::DeviceIdHashSalt))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure we should do this change.
Spec states: [User Agents](https://w3c.github.io/mediacapture-main/#dfn-user-agent) MUST rotate per-origin device identifiers when other persistent storage are cleared.

Copy link
Contributor Author

@szewai szewai Mar 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah so this suggests device id should have the same lifetime as cookies. In this case do we think HashSalt is cookies?
If it is:
Then we should return WKWebsiteDataTypeCookies for website data fetch when clients have DeviceIdHashSalt data, and remove both cookies and hash salt when clients remove WKWebsiteDataTypeCookies data.

If it is not:
Then we should return WKWebsiteDataTypeHashSalt for website data fetch, and let client remove data for WKWebsiteDataTypeHashSalt. (We may keep the existing behavior that removes WKWebsiteDataTypeHashSalt data when clients remove WKWebsiteDataTypeCookies)

Which one do you think it should be?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would do the latter, expose it but continue removing it when cookies are cleared.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, the patch is updated as suggested

@szewai szewai force-pushed the eng/Add-WKWebsiteDataTypeHashSalt-to-allow-fetchingremoving-DeviceIDHashSalt-data branch from fbbc05f to 9ae8f5d Compare March 2, 2023 17:14
@@ -68,6 +68,9 @@ WK_EXTERN NSString * const WKWebsiteDataTypeSearchFieldRecentSearches WK_API_AVA
/*! @constant WKWebsiteDataTypeMediaKeys MediaKeys storage */
WK_EXTERN NSString * const WKWebsiteDataTypeMediaKeys WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));

/*! @constant WKWebsiteDataTypeHashSalt Hash salt for deviceId */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, though after reading this comment I still have no idea what this clears.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@szewai szewai added the merge-queue Applied to send a pull request to merge-queue label Mar 3, 2023
…Salt data

https://bugs.webkit.org/show_bug.cgi?id=253174
rdar://106096684

Reviewed by Chris Dumez.

Otherwise the data type cannot be viewed by WebKit client.

* Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecord.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
(dataTypesToString):
* Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
(WebKit::toWebsiteDataType):
(WebKit::toWKWebsiteDataTypes):
* Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(+[WKWebsiteDataStore allWebsiteDataTypes]):

Canonical link: https://commits.webkit.org/261194@main
@webkit-early-warning-system webkit-early-warning-system force-pushed the eng/Add-WKWebsiteDataTypeHashSalt-to-allow-fetchingremoving-DeviceIDHashSalt-data branch from 9ae8f5d to 2630f20 Compare March 4, 2023 01:40
@webkit-commit-queue
Copy link
Collaborator

Committed 261194@main (2630f20): https://commits.webkit.org/261194@main

Reviewed commits have been landed. Closing PR #10884 and removing active labels.

@webkit-early-warning-system webkit-early-warning-system merged commit 2630f20 into WebKit:main Mar 4, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Mar 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Bugs Unclassified bugs are placed in this component until the correct component can be determined.
Projects
None yet
5 participants