generateKeyPair with blank passphrase prompts "Enter PEM pass phrase" in Node 15 #35898
Labels
confirmed-bug
Issues with confirmed bugs.
crypto
Issues and PRs related to the crypto subsystem.
security
Issues and PRs related to security.
What steps will reproduce the bug?
What is the expected behaviour?
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:
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 bothcipher
andpassphrase
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.The text was updated successfully, but these errors were encountered: