[webkit-reviews] review granted: [Bug 228879] Add console logging to encourage the use of authenticated encryption in WebCrypto : [Attachment 435096] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Aug 6 16:09:22 PDT 2021


Brent Fulgham <bfulgham at webkit.org> has granted Kate Cheney
<katherine_cheney at apple.com>'s request for review:
Bug 228879: Add console logging to encourage the use of authenticated
encryption in WebCrypto
https://bugs.webkit.org/show_bug.cgi?id=228879

Attachment 435096: Patch

https://bugs.webkit.org/attachment.cgi?id=435096&action=review




--- Comment #3 from Brent Fulgham <bfulgham at webkit.org> ---
Comment on attachment 435096
  --> https://bugs.webkit.org/attachment.cgi?id=435096
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=435096&action=review

r=me

> Source/WebCore/crypto/SubtleCrypto.cpp:538
> +	   scriptExecutionContext()->addConsoleMessage(MessageSource::Security,
MessageLevel::Warning, "AES-CBC and AES-CTR do not provide authentication by
default, and implementing it manually can result in minor, but serious
mistakes. We recommended using authenticated encryption like GCM to protect
against chosen-ciphertext attacks.");

This might be better as a separate function:

void SubtleCrypto::addAuthenticatedEncryptionWarningIfNecessary()
{
    if (key.algorithmIdentifier() == CryptoAlgorithmIdentifier::AES_CBC ||
key.algorithmIdentifier() == CryptoAlgorithmIdentifier::AES_CTR)
	scriptExecutionContext()->addConsoleMessage(MessageSource::Security,
MessageLevel::Warning, "AES-CBC and AES-CTR do not provide authentication by
default, and implementing it manually can result in minor, but serious
mistakes. We recommended using authenticated encryption like GCM to protect
against chosen-ciphertext attacks.");
}

Then the two implementations would always be consistent in language and format,
and if we want to warn about more things we could just add them in one place.

> Source/WebCore/crypto/SubtleCrypto.cpp:579
> +	   scriptExecutionContext()->addConsoleMessage(MessageSource::Security,
MessageLevel::Warning, "AES-CBC and AES-CTR do not provide authentication by
default, and implementing it manually can result in minor, but serious
mistakes. We recommended using authenticated encryption like GCM to protect
against chosen-ciphertext attacks.");

... and this could just be replaced with:

addAuthenticatedEncryptionWarningIfNecessary();


More information about the webkit-reviews mailing list