GeezerVison is showing github.com — crypto: remove select Web Crypto warnings · nodejs/node@113741a
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: lib/internal/crypto/util.js +12-11Lines changed: 12 additions & 11 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -539,26 +539,19 @@ const conditionalAlgorithms = { | 539 | 539 | 'X448': !process.features.openssl_is_boringssl, | 540 | 540 | }; | 541 | 541 |
| 542 | | -// Experimental algorithms | 543 | | -const experimentalAlgorithms = [ | | 542 | +// Experimental algorithms that emit warnings. | | 543 | +const experimentalAlgorithmsWithWarnings = [ | 544 | 544 | 'AES-OCB', | 545 | 545 | 'Argon2d', | 546 | 546 | 'Argon2i', | 547 | 547 | 'Argon2id', | 548 | | - 'ChaCha20-Poly1305', | 549 | 548 | 'cSHAKE128', | 550 | 549 | 'cSHAKE256', | 551 | 550 | 'Ed448', | 552 | 551 | 'KMAC128', | 553 | 552 | 'KMAC256', | 554 | | - 'ML-DSA-44', | 555 | | - 'ML-DSA-65', | 556 | | - 'ML-DSA-87', | 557 | 553 | 'ML-KEM-512', | 558 | | - 'ML-KEM-768', | 559 | | - 'ML-KEM-1024', | 560 | 554 | 'MLKEM768-P256', | 561 | | - 'MLKEM768-X25519', | 562 | 555 | 'MLKEM1024-P384', | 563 | 556 | 'SHA3-256', | 564 | 557 | 'SHA3-384', | @@ -568,6 +561,14 @@ const experimentalAlgorithms = [ | 568 | 561 | 'KT128', | 569 | 562 | 'KT256', | 570 | 563 | 'X448', | | 564 | + // Ships unflagged in Chromium >= 155 | | 565 | + // 'ChaCha20-Poly1305' | | 566 | + // 'ML-DSA-44' | | 567 | + // 'ML-DSA-65' | | 568 | + // 'ML-DSA-87' | | 569 | + // 'ML-KEM-768' | | 570 | + // 'ML-KEM-1024' | | 571 | + // 'MLKEM768-X25519' | 571 | 572 | ]; | 572 | 573 |
| 573 | 574 | // Transform the algorithm definitions into the operation-keyed structure | @@ -595,8 +596,8 @@ function createSupportedAlgorithms(algorithmDefs) { | 595 | 596 | nameMap[operation] ||= new SafeMap(); | 596 | 597 | nameMap[operation].set(StringPrototypeToUpperCase(algorithmName), algorithmName); | 597 | 598 |
| 598 | | - // Add experimental warnings for experimental algorithms | 599 | | - if (ArrayPrototypeIncludes(experimentalAlgorithms, algorithmName)) { | | 599 | + // Add warnings for select experimental algorithms | | 600 | + if (ArrayPrototypeIncludes(experimentalAlgorithmsWithWarnings, algorithmName)) { | 600 | 601 | ObjectDefineProperty(result[operation], algorithmName, { | 601 | 602 | get() { | 602 | 603 | emitExperimentalWarning(`The ${algorithmName} Web Crypto API algorithm`); | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/crypto/webcrypto.js -7Lines changed: 0 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -75,7 +75,6 @@ const { | 75 | 75 | } = require('internal/crypto/util'); | 76 | 76 |
| 77 | 77 | const { | 78 | | - emitExperimentalWarning, | 79 | 78 | kEnumerableProperty, | 80 | 79 | lazyDOMException, | 81 | 80 | setOwnProperty, | @@ -1470,7 +1469,6 @@ function getPublicKey(key, keyUsages) { | 1470 | 1469 | } | 1471 | 1470 |
| 1472 | 1471 | function getPublicKeyImpl(key, keyUsages) { | 1473 | | - emitExperimentalWarning('The getPublicKey Web Crypto API method'); | 1474 | 1472 | const prefix = prepareSubtleMethod(this, 'getPublicKey', arguments.length, 2); | 1475 | 1473 | let i = 0; | 1476 | 1474 | key = convertSubtleArgument(prefix, 'CryptoKey', key, i++); | @@ -1498,7 +1496,6 @@ function encapsulateBits(encapsulationAlgorithm, encapsulationKey) { | 1498 | 1496 | } | 1499 | 1497 |
| 1500 | 1498 | function encapsulateBitsImpl(encapsulationAlgorithm, encapsulationKey) { | 1501 | | - emitExperimentalWarning('The encapsulateBits Web Crypto API method'); | 1502 | 1499 | const prefix = prepareSubtleMethod( | 1503 | 1500 | this, 'encapsulateBits', arguments.length, 2); | 1504 | 1501 | let i = 0; | @@ -1560,7 +1557,6 @@ function encapsulateKeyImpl( | 1560 | 1557 | sharedKeyAlgorithm, | 1561 | 1558 | extractable, | 1562 | 1559 | keyUsages) { | 1563 | | - emitExperimentalWarning('The encapsulateKey Web Crypto API method'); | 1564 | 1560 | const prefix = prepareSubtleMethod( | 1565 | 1561 | this, 'encapsulateKey', arguments.length, 5); | 1566 | 1562 | let i = 0; | @@ -1639,7 +1635,6 @@ function decapsulateBits(decapsulationAlgorithm, decapsulationKey, ciphertext) { | 1639 | 1635 | } | 1640 | 1636 |
| 1641 | 1637 | function decapsulateBitsImpl(decapsulationAlgorithm, decapsulationKey, ciphertext) { | 1642 | | - emitExperimentalWarning('The decapsulateBits Web Crypto API method'); | 1643 | 1638 | const prefix = prepareSubtleMethod( | 1644 | 1639 | this, 'decapsulateBits', arguments.length, 3); | 1645 | 1640 | let i = 0; | @@ -1704,7 +1699,6 @@ function decapsulateKeyImpl( | 1704 | 1699 | sharedKeyAlgorithm, | 1705 | 1700 | extractable, | 1706 | 1701 | keyUsages) { | 1707 | | - emitExperimentalWarning('The decapsulateKey Web Crypto API method'); | 1708 | 1702 | const prefix = prepareSubtleMethod( | 1709 | 1703 | this, 'decapsulateKey', arguments.length, 6); | 1710 | 1704 | let i = 0; | @@ -1783,7 +1777,6 @@ class SubtleCrypto { | 1783 | 1777 | // Implements https://wicg.github.io/webcrypto-modern-algos/#SubtleCrypto-method-supports | 1784 | 1778 | // TODO(panva): Make supports() account for the active FIPS state. | 1785 | 1779 | static supports(operation, algorithm, lengthOrAdditionalAlgorithm = null) { | 1786 | | - emitExperimentalWarning('The supports Web Crypto API method'); | 1787 | 1780 | webidl ??= require('internal/crypto/webidl'); | 1788 | 1781 | const prefix = "Failed to execute 'supports' on 'SubtleCrypto'"; | 1789 | 1782 | webidl.requiredArguments(arguments.length, 2, { prefix }); | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-webcrypto-prototype-pollution.mjs +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -21,8 +21,8 @@ const TypedArrayPrototype = Object.getPrototypeOf(Uint8Array.prototype); | 21 | 21 | const data = new TextEncoder().encode('prototype pollution'); | 22 | 22 | const modulusLength = getFips() === 1 ? 2048 : 1024; | 23 | 23 |
| 24 | | -// Avoids SubtleCrypto.supports(), which warns and invokes the registry's | 25 | | -// experimental-algorithm getters. | | 24 | +// Avoids SubtleCrypto.supports(), which can invoke the registry's | | 25 | +// experimental-algorithm warning getters. | 26 | 26 | function supports(operation, name) { | 27 | 27 | return Object.hasOwn(kSupportedAlgorithms[operation] ?? {}, name); | 28 | 28 | } | |
|