[webkit-changes] [WebKit/WebKit] 22614e: Make WebPageProxy::wrapCryptoKey take CryptoKey in...

Sihui noreply at github.com
Mon Dec 16 22:09:31 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 22614e8356bdb8a3270eda1f4fd34186dc9b8c9e
      https://github.com/WebKit/WebKit/commit/22614e8356bdb8a3270eda1f4fd34186dc9b8c9e
  Author: Sihui Liu <sihui_liu at apple.com>
  Date:   2024-12-16 (Mon, 16 Dec 2024)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/bindings/js/SerializedScriptValue.cpp
    M Source/WebCore/bindings/js/SerializedScriptValue.h
    M Source/WebCore/crypto/CryptoKey.cpp
    M Source/WebCore/crypto/CryptoKey.h
    A Source/WebCore/crypto/CryptoKeyData.h
    M Source/WebCore/crypto/JsonWebKey.h
    M Source/WebCore/crypto/RsaOtherPrimesInfo.h
    M Source/WebCore/crypto/keys/CryptoKeyAES.cpp
    M Source/WebCore/crypto/keys/CryptoKeyAES.h
    M Source/WebCore/crypto/keys/CryptoKeyEC.cpp
    M Source/WebCore/crypto/keys/CryptoKeyEC.h
    M Source/WebCore/crypto/keys/CryptoKeyHMAC.cpp
    M Source/WebCore/crypto/keys/CryptoKeyHMAC.h
    M Source/WebCore/crypto/keys/CryptoKeyOKP.cpp
    M Source/WebCore/crypto/keys/CryptoKeyOKP.h
    M Source/WebCore/crypto/keys/CryptoKeyRSA.cpp
    M Source/WebCore/crypto/keys/CryptoKeyRSA.h
    M Source/WebCore/crypto/keys/CryptoKeyRaw.cpp
    M Source/WebCore/crypto/keys/CryptoKeyRaw.h
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.h
    M Source/WebCore/dom/EmptyScriptExecutionContext.h
    M Source/WebCore/dom/ScriptExecutionContext.h
    M Source/WebCore/page/CryptoClient.h
    M Source/WebCore/workers/WorkerGlobalScope.cpp
    M Source/WebCore/workers/WorkerGlobalScope.h
    M Source/WebCore/worklets/WorkletGlobalScope.h
    M Source/WebKit/Scripts/webkit/messages.py
    M Source/WebKit/Shared/API/APISerializedScriptValue.cpp
    M Source/WebKit/Shared/API/APISerializedScriptValue.h
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/WebPageProxy.messages.in
    M Source/WebKit/UIProcess/WebProcessProxy.cpp
    M Source/WebKit/UIProcess/WebProcessProxy.h
    M Source/WebKit/UIProcess/WebProcessProxy.messages.in
    M Source/WebKit/WebProcess/WebCoreSupport/WebCryptoClient.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebCryptoClient.h
    M Source/WebKitLegacy/WebCoreSupport/WebCryptoClient.h
    M Source/WebKitLegacy/WebCoreSupport/WebCryptoClient.mm

  Log Message:
  -----------
  Make WebPageProxy::wrapCryptoKey take CryptoKey instead of serialized key data
https://bugs.webkit.org/show_bug.cgi?id=284444
rdar://141265745

Reviewed by Pascoe and Matthew Finkel.

In current implementation of wrapping crypto key, web process serializes key into bytes and sends the bytes to UI
process for encryption. On receiving the bytes, UI process is not able to validate that the bytes actually represent
crypto key, as it does not know the serialization format. To ensure UI process can do validation, now we make web
process send structured crypto key data to UI process, by introducing WebCore::CryptoKeyData and adding IPC
serialization for it. If UI process cannot recreate crypto key from the data, it will reject the request; otherwise it
will do both serialization and encryption.

There should be no user-visible behavior change after this patch.

* Source/WebCore/Headers.cmake:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/bindings/js/SerializedScriptValue.cpp:
(WebCore::serializeAndWrapCryptoKey):
(WebCore::CloneSerializer::serializeCryptoKey):
(WebCore::CloneSerializer::dumpIfTerminal):
(WebCore::SerializedScriptValue::serializeCryptoKey):
(WebCore::wrapCryptoKey): Deleted.
* Source/WebCore/bindings/js/SerializedScriptValue.h:
* Source/WebCore/crypto/CryptoKey.cpp:
(WebCore::CryptoKey::create):
* Source/WebCore/crypto/CryptoKey.h:
(WebCore::CryptoKey::isValid const):
* Source/WebCore/crypto/CryptoKeyData.h: Added.
(WebCore::CryptoKeyData::CryptoKeyData):
(WebCore::CryptoKeyData::isolatedCopy):
* Source/WebCore/crypto/JsonWebKey.h:
(WebCore::JsonWebKey::isolatedCopy):
* Source/WebCore/crypto/RsaOtherPrimesInfo.h:
(WebCore::RsaOtherPrimesInfo::isolatedCopy):
* Source/WebCore/crypto/keys/CryptoKeyAES.cpp:
(WebCore::CryptoKeyAES::exportJwk const):
(WebCore::CryptoKeyAES::data const):
* Source/WebCore/crypto/keys/CryptoKeyAES.h:
* Source/WebCore/crypto/keys/CryptoKeyEC.cpp:
(WebCore::CryptoKeyEC::exportJwk const):
(WebCore::CryptoKeyEC::data const):
* Source/WebCore/crypto/keys/CryptoKeyEC.h:
* Source/WebCore/crypto/keys/CryptoKeyHMAC.cpp:
(WebCore::CryptoKeyHMAC::exportJwk const):
(WebCore::CryptoKeyHMAC::data const):
* Source/WebCore/crypto/keys/CryptoKeyHMAC.h:
* Source/WebCore/crypto/keys/CryptoKeyOKP.cpp:
(WebCore::CryptoKeyOKP::exportJwk const):
(WebCore::CryptoKeyOKP::namedCurveFromString):
(WebCore::CryptoKeyOKP::data const):
* Source/WebCore/crypto/keys/CryptoKeyOKP.h:
* Source/WebCore/crypto/keys/CryptoKeyRSA.cpp:
(WebCore::CryptoKeyRSA::exportJwk const):
(WebCore::CryptoKeyRSA::data const):
* Source/WebCore/crypto/keys/CryptoKeyRSA.h:
* Source/WebCore/crypto/keys/CryptoKeyRaw.cpp:
(WebCore::CryptoKeyRaw::data const):
* Source/WebCore/crypto/keys/CryptoKeyRaw.h:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::serializeAndWrapCryptoKey):
* Source/WebCore/dom/Document.h:
* Source/WebCore/dom/EmptyScriptExecutionContext.h:
* Source/WebCore/dom/ScriptExecutionContext.h:
* Source/WebCore/page/CryptoClient.h:
(WebCore::CryptoClient::serializeAndWrapCryptoKey const):
* Source/WebCore/workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::serializeAndWrapCryptoKey):
* Source/WebCore/workers/WorkerGlobalScope.h:
* Source/WebCore/worklets/WorkletGlobalScope.h:
* Source/WebKit/Scripts/webkit/messages.py:
(headers_for_type):
* Source/WebKit/Shared/API/APISerializedScriptValue.cpp:
(API::SerializedScriptValue::serializeCryptoKey):
* Source/WebKit/Shared/API/APISerializedScriptValue.h:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::serializeAndWrapCryptoKey):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::serializeAndWrapCryptoKey):
* Source/WebKit/UIProcess/WebProcessProxy.h:
* Source/WebKit/UIProcess/WebProcessProxy.messages.in:
* Source/WebKit/WebProcess/WebCoreSupport/WebCryptoClient.cpp:
(WebKit::WebCryptoClient::serializeAndWrapCryptoKey const):
* Source/WebKit/WebProcess/WebCoreSupport/WebCryptoClient.h:
* Source/WebKitLegacy/WebCoreSupport/WebCryptoClient.h:
* Source/WebKitLegacy/WebCoreSupport/WebCryptoClient.mm:
(WebCryptoClient::serializeAndWrapCryptoKey const):

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



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


More information about the webkit-changes mailing list