GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — crypto: reject inherited key type names · nodejs/node@eeae754

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/crypto
    • keygen.js
  • test/parallel
    • test-crypto-keygen.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/crypto/keygen.js‎

Copy file name to clipboardExpand all lines: lib/internal/crypto/keygen.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ function parseKeyEncoding(keyType, options = kEmptyObject) {
181181
}
182182

183183
const nidOnlyKeyPairs = {
184+
'__proto__': null,
184185
'ed25519': EVP_PKEY_ED25519,
185186
'ed448': EVP_PKEY_ED448,
186187
'x25519': EVP_PKEY_X25519,
Collapse file

‎test/parallel/test-crypto-keygen.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-crypto-keygen.js
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,20 @@ const { hasOpenSSL3 } = require('../common/crypto');
5555
code: 'ERR_INVALID_ARG_VALUE',
5656
message: "The argument 'type' must be a supported key type. Received 'rsa2'"
5757
});
58+
59+
for (const type of ['toString', 'constructor']) {
60+
assert.throws(() => generateKeyPairSync(type, {}), {
61+
name: 'TypeError',
62+
code: 'ERR_INVALID_ARG_VALUE',
63+
message: `The argument 'type' must be a supported key type. Received '${type}'`
64+
});
65+
66+
assert.throws(() => generateKeyPair(type, {}, common.mustNotCall()), {
67+
name: 'TypeError',
68+
code: 'ERR_INVALID_ARG_VALUE',
69+
message: `The argument 'type' must be a supported key type. Received '${type}'`
70+
});
71+
}
5872
}
5973

6074
{

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.