haikuwebkit/Source/WebCore/Modules/webauthn/AttestationConveyancePrefer...

33 lines
1.4 KiB
Plaintext
Raw Permalink Normal View History

[WebAuthN] Support Attestation Conveyance Preference https://bugs.webkit.org/show_bug.cgi?id=192722 <rdar://problem/49939647> Reviewed by Brent Fulgham. Source/WebCore: This patch implements https://www.w3.org/TR/webauthn/#enumdef-attestationconveyancepreference, together with Step 20 with regard to AttestationConveyancePreference of https://www.w3.org/TR/webauthn/#createCredential. Few notes with regard to Step 20: 1) We treat indirect attestation as direct attestation as we don't MITM the attestation process; 2) We won't distinguish self attestation and return it to keep consistency between the response and the request. If callers want none attestation, they will very likely ignore fmt and attStmt of the attestation object, and therefore it is meaningless to return self attestation. Covered by new tests within existing files. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Headers.cmake: * Modules/webauthn/AttestationConveyancePreference.h: Copied from Source/WebCore/Modules/webauthn/WebAuthenticationUtils.h. * Modules/webauthn/AttestationConveyancePreference.idl: Copied from Source/WebCore/Modules/webauthn/WebAuthenticationUtils.h. * Modules/webauthn/PublicKeyCredentialCreationOptions.h: (WebCore::PublicKeyCredentialCreationOptions::encode const): (WebCore::PublicKeyCredentialCreationOptions::decode): * Modules/webauthn/PublicKeyCredentialCreationOptions.idl: * Modules/webauthn/WebAuthenticationConstants.h: * Modules/webauthn/WebAuthenticationUtils.cpp: (WebCore::buildAttestationObject): * Modules/webauthn/WebAuthenticationUtils.h: * Modules/webauthn/fido/DeviceResponseConverter.cpp: (fido::readCTAPMakeCredentialResponse): * Modules/webauthn/fido/DeviceResponseConverter.h: * Modules/webauthn/fido/FidoConstants.h: noneAttestationValue is moved to WebAuthenticationConstants.h. * Modules/webauthn/fido/U2fResponseConverter.cpp: (fido::readU2fRegisterResponse): * Modules/webauthn/fido/U2fResponseConverter.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: Source/WebKit: * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested): * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp: (WebKit::CtapHidAuthenticator::continueMakeCredentialAfterResponseReceived const): * UIProcess/WebAuthentication/fido/U2fHidAuthenticator.cpp: (WebKit::U2fHidAuthenticator::continueRegisterCommandAfterResponseReceived): Tools: * TestWebKitAPI/Tests/WebCore/CtapRequestTest.cpp: (TestWebKitAPI::TEST): Updates the test with AttestationConveyancePreference. LayoutTests: * http/wpt/webauthn/public-key-credential-create-success-hid.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-success-hid.https.html: * http/wpt/webauthn/public-key-credential-create-success-local.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-success-local.https.html: * http/wpt/webauthn/public-key-credential-create-success-u2f.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-success-u2f.https.html: Canonical link: https://commits.webkit.org/212199@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245638 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-22 19:27:49 +00:00
/*
* Copyright (C) 2019 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
[
Conditional=WEB_AUTHN,
] enum AttestationConveyancePreference {
"none",
"indirect",
"direct"
};