Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upcrypto: fail early if passphrase is too long #27010
Conversation
This comment has been minimized.
This comment has been minimized.
nodejs-github-bot
added
C++
crypto
labels
Mar 30, 2019
This comment has been minimized.
This comment has been minimized.
|
This was @sam-github's idea in #25208 (comment), thanks Sam! :) |
bnoordhuis
reviewed
Mar 31, 2019
doc/api/crypto.md Outdated
src/node_crypto.cc Outdated
BridgeAR
approved these changes
Mar 31, 2019
This comment has been minimized.
This comment has been minimized.
|
I think this is technically semver-major? So cc @nodejs/tsc |
tniessen
added
the
semver-major
label
Mar 31, 2019
This comment has been minimized.
This comment has been minimized.
|
Oooo, tricky. Where does this fail without this fix and what does that failure look like? It's not from the |
This comment has been minimized.
This comment has been minimized.
|
@rvagg It is indeed tricky! The failure without this patch is unpredictable. Note that this should also be an extremely rare case, supplying such a long passphrase does not make sense since the entropy of the passphrase would far exceed the entropy of the derived decryption key. |
This comment has been minimized.
This comment has been minimized.
|
OK, so I'm going to go out on a limb and suggest that those failure modes mean we have bugs in our interface and therefore this should be semver-patch. Anyone else have an opinion? @tniessen what's your position? |
This comment has been minimized.
This comment has been minimized.
|
I'm usually leaning towards semver-patch too easily
From that perspective, this certainly is a bugfix, we should not have accepted passphrases that do not fit into the buffer in the first place. |
sam-github
approved these changes
Apr 2, 2019
This comment has been minimized.
This comment has been minimized.
|
We've been more lax about semver-major's recently. In this case, someone would have to be relying on passing a passphrase that is too large, and it getting truncated... which is pretty obscure. I'd be OK with semver-patch, mostly because I don't want this to float until the fall for 13.x, continually causing backport conflict. |
tniessen
removed
the
semver-major
label
Apr 2, 2019
This comment has been minimized.
This comment has been minimized.
|
I removed the semver-major label, feel free to chime in @nodejs/tsc. |
This comment has been minimized.
This comment has been minimized.
BridgeAR
added
the
author ready
label
Apr 3, 2019
This comment has been minimized.
This comment has been minimized.
|
Re-build of failing node-test-commit-linux ( |
BridgeAR
added a commit
to BridgeAR/node
that referenced
this pull request
Apr 4, 2019
This comment has been minimized.
This comment has been minimized.
|
Landed in 73bca57 |
tniessen commentedMar 30, 2019
This causes OpenSSL to fail early if the decryption passphrase is too long, and produces a somewhat helpful error message. OpenSSL gives us a buffer of limited size (currently 1024 bytes), so there is no way to pass longer passphrases.
Refs: #25208
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes