deno
7aadfe88 - fix(ext/node): accept array forms of cert/key/pfx in createSecureContext (#34379)

Commit
77 days ago
fix(ext/node): accept array forms of cert/key/pfx in createSecureContext (#34379) `tls.createSecureContext` did not honor the documented array forms of `cert`, `key` and `pfx` (see https://nodejs.org/api/tls.html#tlscreatesecurecontextoptions). Array `cert` / `key` values were silently coerced via `String(...)` to unusable strings (`[object Object]` or a comma-joined byte sequence), so rustls saw no client certificate and TLS proceeded as anonymous. An empty `pfx: []` (as emitted by playwright's `convertClientCertificatesToTLSOptions` when only PEM cert/key are configured) fell into the PFX validator with an empty buffer and threw "not enough data". The polyfill now flattens cert/key arrays into a single PEM string, unwraps the `{ pem, passphrase }` shape, and decrypts passphrase-protected keys via `createPrivateKey` so the result is parseable by `rustls_pemfile`. The PFX validation loop iterates arrays (and `{ buf, passphrase }` entries) and treats empty arrays as a no-op, matching Node. Fixes #34367 Fixes #34371
Author
Parents
Loading