Commit e60132f0413 for nodejs
commit e60132f041394c92afdafa6c49bee05fdbe37379
Author: Node.js GitHub Bot <github-bot@iojs.org>
Date: Mon Nov 9 19:35:28 2026 -0500
test: update WPT for WebCryptoAPI to e87deca336
PR-URL: https://github.com/nodejs/node/pull/67330
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jason Zhang <xzha4350@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
diff --git a/test/fixtures/wpt/WebCryptoAPI/encrypt_decrypt/aes_cbc_invalid_length.https.any.js b/test/fixtures/wpt/WebCryptoAPI/encrypt_decrypt/aes_cbc_invalid_length.https.any.js
new file mode 100644
index 00000000000..6f3daa4cb36
--- /dev/null
+++ b/test/fixtures/wpt/WebCryptoAPI/encrypt_decrypt/aes_cbc_invalid_length.https.any.js
@@ -0,0 +1,47 @@
+// META: title=WebCryptoAPI: AES-CBC decryption ciphertext lengths
+// META: global=window,dedicatedworker
+
+/*
+ * Copyright (C) 2026 Jonathan Powers. 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 THE COPYRIGHT HOLDER 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 THE COPYRIGHT HOLDER 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.
+ */
+
+// https://w3c.github.io/webcrypto/#aes-cbc-operations
+// Decryption requires a nonempty ciphertext whose length is a multiple of 16 bytes.
+for (const keyLength of [128, 192, 256]) {
+ for (const cipherTextLength of [0, 1, 15, 17, 31, 33]) {
+ promise_test(async t => {
+ const key = await crypto.subtle.importKey("raw", new Uint8Array(keyLength / 8), "AES-CBC", false, ["decrypt"]);
+ const parameters = { name: "AES-CBC", iv: new Uint8Array(16) };
+ await promise_rejects_dom(t, "OperationError", crypto.subtle.decrypt(parameters, key, new Uint8Array(cipherTextLength)));
+ }, `AES-CBC with a ${keyLength}-bit key rejects ${cipherTextLength}-byte ciphertext with OperationError`);
+ }
+
+ promise_test(async () => {
+ const key = await crypto.subtle.importKey("raw", new Uint8Array(keyLength / 8), "AES-CBC", false, ["encrypt", "decrypt"]);
+ const parameters = { name: "AES-CBC", iv: new Uint8Array(16) };
+ const cipherText = await crypto.subtle.encrypt(parameters, key, new Uint8Array(0));
+ assert_equals(cipherText.byteLength, 16, "Encrypting empty plaintext produces a full padding block");
+ const plainText = await crypto.subtle.decrypt(parameters, key, cipherText);
+ assert_equals(plainText.byteLength, 0, "Decrypting a full padding block produces empty plaintext");
+ }, `AES-CBC with a ${keyLength}-bit key decrypts a padded empty message`);
+}
diff --git a/test/fixtures/wpt/WebCryptoAPI/encrypt_decrypt/aes_cbc_vectors.js b/test/fixtures/wpt/WebCryptoAPI/encrypt_decrypt/aes_cbc_vectors.js
index 28ef75fece6..6bc7b3bf4b7 100644
--- a/test/fixtures/wpt/WebCryptoAPI/encrypt_decrypt/aes_cbc_vectors.js
+++ b/test/fixtures/wpt/WebCryptoAPI/encrypt_decrypt/aes_cbc_vectors.js
@@ -194,7 +194,7 @@ function getTestVectors() {
["zeroPadChar", "bigPadChar", "inconsistentPadChars"].forEach(function(paddingProblem) {
var badCiphertext = new Uint8Array(ciphertext[keyLength].byteLength);
badCiphertext.set(ciphertext[keyLength].slice(0, ciphertext[keyLength].byteLength - 16));
- badCiphertext.set(badPadding[keyLength][paddingProblem]);
+ badCiphertext.set(badPadding[keyLength][paddingProblem], ciphertext[keyLength].byteLength - 16);
decryptionFailing.push({
name: "AES-CBC " + keyLength.toString() + "-bit key, " + paddingProblem,
diff --git a/test/fixtures/wpt/versions.json b/test/fixtures/wpt/versions.json
index 743a05f94f8..e87b7ac4b73 100644
--- a/test/fixtures/wpt/versions.json
+++ b/test/fixtures/wpt/versions.json
@@ -100,7 +100,7 @@
"path": "web-locks"
},
"WebCryptoAPI": {
- "commit": "e15690d276ae50728b9d557f4e04f894588d34a0",
+ "commit": "e87deca3369c630ca2ade57734c5a42adbbc7e48",
"path": "WebCryptoAPI"
},
"webidl": {