Skip to content

Only use WKKeyedCoder for encoding when secure coding class is not specified#33412

Merged
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
szewai:eng/Use-WKKeyedCoder-for-serialization-when-class-is-annotated-with-SupportWKKeyedCoder
Sep 12, 2024
Merged

Only use WKKeyedCoder for encoding when secure coding class is not specified#33412
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
szewai:eng/Use-WKKeyedCoder-for-serialization-when-class-is-annotated-with-SupportWKKeyedCoder

Conversation

@szewai
Copy link
Contributor

@szewai szewai commented Sep 10, 2024

8b48849

Only use WKKeyedCoder for encoding when secure coding class is not specified
https://bugs.webkit.org/show_bug.cgi?id=279457
rdar://135631932

Reviewed by Alex Christensen.

The existing implementation expects _webKitPropertyListData to return a dictionary that matches the declaration in
existing CoreIPC*.serialization.in file, when _webKitPropertyListData selector exists. However, a class could add
support for _webKitPropertyListData independently, and the result may not match the existing declaration, which could
lead to breakage in existing WebKit clients. To avoid such issue, now we only allow to use WKKeyedCoder for types that
have WKKeyedCoder support and do not specify secure coding class. When a class adds implementation for
_webKitPropertyListData, the WKKeyedCoder coding will still be in use, and we could explicitly enable the new encoding
format by updating CoreIPC*.serialization.in file and specifying secure encoding class later.

Also, update tests with new auto-generated files.

* Source/WebKit/Scripts/generate-serializers.py:
(generate_webkit_secure_coding_impl):
(generate_webkit_secure_coding_impl.is):
* Source/WebKit/Scripts/webkit/messages_unittest.py:
* Source/WebKit/Scripts/webkit/tests/GeneratedSerializers.h:
* Source/WebKit/Scripts/webkit/tests/GeneratedWebKitSecureCoding.cpp:
(WebKit::dictionaryForWebKitSecureCodingTypeFromWKKeyedCoder):
(WebKit::dictionaryForWebKitSecureCodingType):
(WebKit::CoreIPCAVOutputContext::toID const):
(WebKit::CoreIPCNSSomeFoundationType::toID const):
(WebKit::NSSomeOtherFoundationType):
(WebKit::NSSomeOtherFoundationType::toID const):
(WebKit::CoreIPCDDScannerResult::toID const):
* Source/WebKit/Scripts/webkit/tests/GeneratedWebKitSecureCoding.h:
* Source/WebKit/Scripts/webkit/tests/MessageArgumentDescriptions.cpp:
(IPC::jsValueForArguments):
(IPC::messageArgumentDescriptions):
* Source/WebKit/Scripts/webkit/tests/MessageNames.cpp:
* Source/WebKit/Scripts/webkit/tests/MessageNames.h:
* Source/WebKit/Scripts/webkit/tests/SerializedTypeInfo.cpp:
(WebKit::allSerializedTypes):
* Source/WebKit/Scripts/webkit/tests/TestSerializedType.serialization.in:
* Source/WebKit/Scripts/webkit/tests/WebKitPlatformGeneratedSerializers.cpp:
(IPC::NSSomeOtherFoundationType>::encode):
(IPC::NSSomeOtherFoundationType>::decode):

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

a1e6415

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 wincairo
✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ✅ 🧪 wincairo-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 webkitpy ✅ 🧪 ios-wk2-wpt ✅ 🛠 wpe-cairo
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ❌ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2
✅ 🛠 tv
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@szewai szewai self-assigned this Sep 10, 2024
@szewai szewai added the New Bugs Unclassified bugs are placed in this component until the correct component can be determined. label Sep 10, 2024
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Sep 10, 2024
@szewai szewai removed the merging-blocked Applied to prevent a change from being merged label Sep 10, 2024
@szewai szewai changed the title Use WKKeyedCoder for serialization when class is annotated with SupportWKKeyedCoder Avoing using new secure encoding when encoding class is not specified Sep 10, 2024
@szewai szewai force-pushed the eng/Use-WKKeyedCoder-for-serialization-when-class-is-annotated-with-SupportWKKeyedCoder branch from 5ef63a5 to efff52a Compare September 10, 2024 23:09
@szewai szewai force-pushed the eng/Use-WKKeyedCoder-for-serialization-when-class-is-annotated-with-SupportWKKeyedCoder branch from efff52a to 6d969a9 Compare September 10, 2024 23:56
@szewai szewai force-pushed the eng/Use-WKKeyedCoder-for-serialization-when-class-is-annotated-with-SupportWKKeyedCoder branch from 6d969a9 to 5ed8818 Compare September 11, 2024 00:08
@sheeparegreat
Copy link
Contributor

Typo: Avoing -> Avoid

@szewai szewai changed the title Avoing using new secure encoding when encoding class is not specified Only use WKKeyedCoder for encoding when secure coding class is not specified Sep 11, 2024
@szewai szewai force-pushed the eng/Use-WKKeyedCoder-for-serialization-when-class-is-annotated-with-SupportWKKeyedCoder branch from 5ed8818 to 6f69d02 Compare September 11, 2024 22:03
@szewai
Copy link
Contributor Author

szewai commented Sep 11, 2024

Typo: Avoing -> Avoid

Fixed!

@szewai szewai force-pushed the eng/Use-WKKeyedCoder-for-serialization-when-class-is-annotated-with-SupportWKKeyedCoder branch from 6f69d02 to cd8e960 Compare September 11, 2024 22:09
@szewai szewai force-pushed the eng/Use-WKKeyedCoder-for-serialization-when-class-is-annotated-with-SupportWKKeyedCoder branch from fe8d3cc to a1e6415 Compare September 11, 2024 22:36
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Sep 12, 2024
@szewai szewai added merge-queue Applied to send a pull request to merge-queue and removed merging-blocked Applied to prevent a change from being merged labels Sep 12, 2024
@szewai szewai marked this pull request as ready for review September 12, 2024 16:55
@szewai szewai added merge-queue Applied to send a pull request to merge-queue and removed merge-queue Applied to send a pull request to merge-queue labels Sep 12, 2024
…ecified

https://bugs.webkit.org/show_bug.cgi?id=279457
rdar://135631932

Reviewed by Alex Christensen.

The existing implementation expects _webKitPropertyListData to return a dictionary that matches the declaration in
existing CoreIPC*.serialization.in file, when _webKitPropertyListData selector exists. However, a class could add
support for _webKitPropertyListData independently, and the result may not match the existing declaration, which could
lead to breakage in existing WebKit clients. To avoid such issue, now we only allow to use WKKeyedCoder for types that
have WKKeyedCoder support and do not specify secure coding class. When a class adds implementation for
_webKitPropertyListData, the WKKeyedCoder coding will still be in use, and we could explicitly enable the new encoding
format by updating CoreIPC*.serialization.in file and specifying secure encoding class later.

Also, update tests with new auto-generated files.

* Source/WebKit/Scripts/generate-serializers.py:
(generate_webkit_secure_coding_impl):
(generate_webkit_secure_coding_impl.is):
* Source/WebKit/Scripts/webkit/messages_unittest.py:
* Source/WebKit/Scripts/webkit/tests/GeneratedSerializers.h:
* Source/WebKit/Scripts/webkit/tests/GeneratedWebKitSecureCoding.cpp:
(WebKit::dictionaryForWebKitSecureCodingTypeFromWKKeyedCoder):
(WebKit::dictionaryForWebKitSecureCodingType):
(WebKit::CoreIPCAVOutputContext::toID const):
(WebKit::CoreIPCNSSomeFoundationType::toID const):
(WebKit::NSSomeOtherFoundationType):
(WebKit::NSSomeOtherFoundationType::toID const):
(WebKit::CoreIPCDDScannerResult::toID const):
* Source/WebKit/Scripts/webkit/tests/GeneratedWebKitSecureCoding.h:
* Source/WebKit/Scripts/webkit/tests/MessageArgumentDescriptions.cpp:
(IPC::jsValueForArguments):
(IPC::messageArgumentDescriptions):
* Source/WebKit/Scripts/webkit/tests/MessageNames.cpp:
* Source/WebKit/Scripts/webkit/tests/MessageNames.h:
* Source/WebKit/Scripts/webkit/tests/SerializedTypeInfo.cpp:
(WebKit::allSerializedTypes):
* Source/WebKit/Scripts/webkit/tests/TestSerializedType.serialization.in:
* Source/WebKit/Scripts/webkit/tests/WebKitPlatformGeneratedSerializers.cpp:
(IPC::NSSomeOtherFoundationType>::encode):
(IPC::NSSomeOtherFoundationType>::decode):

Canonical link: https://commits.webkit.org/283566@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/Use-WKKeyedCoder-for-serialization-when-class-is-annotated-with-SupportWKKeyedCoder branch from a1e6415 to 8b48849 Compare September 12, 2024 17:15
@webkit-commit-queue
Copy link
Collaborator

Committed 283566@main (8b48849): https://commits.webkit.org/283566@main

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

@webkit-commit-queue webkit-commit-queue merged commit 8b48849 into WebKit:main Sep 12, 2024
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Sep 12, 2024
@szewai szewai deleted the eng/Use-WKKeyedCoder-for-serialization-when-class-is-annotated-with-SupportWKKeyedCoder branch January 2, 2026 18:21
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

Development

Successfully merging this pull request may close these issues.

6 participants