You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
generateKeyPair with blank passphrase prompts "Enter PEM pass phrase" in Node 15 #35898
In NodeJS 14 and below, the above generates an output without any prompts.
What do you see instead?
Since NodeJS 15, the above issues a prompt on the terminal:
Enter PEM pass phrase:
Which hangs until the user provides input (i.e. forever on a CI server).
Additional information
It seems reasonable for a blank string to be rejected as an input here if a cipher is being used, but it should either work or throw an exception. Triggering a command-line prompt is not a good user experience, and makes this relatively difficult to track-down.
In my particular case, I allow users of my project to configure a blank passphrase to mean "don't bother encrypting this", which I can achieve myself by detecting a blank passphrase and passing undefined for both cipher and passphrase in Node 15, which is fine. My personal preference would be for this to throw if given a blank passphrase, but that would still be a breaking change from 14, so maybe the way to go is to allow blank passphrases as before.
Adding the security label as a precaution due to the DoS potential resulting from this. This does not crash the process, but can cause it to become unresponsive.
Activity
Trott commentedon Nov 1, 2020
@nodejs/crypto @jasnell
tniessen commentedon Nov 1, 2020
Fix in #35914
tniessen commentedon Nov 2, 2020
Adding the security label as a precaution due to the DoS potential resulting from this. This does not crash the process, but can cause it to become unresponsive.
tniessen commentedon Nov 4, 2020
Thank you for the report @davidje13, this is really good to know! The fix will likely be included in the next release of Node.js 15.
crypto: pass empty passphrases to OpenSSL properly
crypto: pass empty passphrases to OpenSSL properly
fix(node:crypto): dsa/dh/rsa-pss keygen, empty-vs-absent passphrase —…