Uh oh!
There was an error while loading. Please reload this page.
crypto: throw in setAuthTag on invalid length - #20040
Conversation
tniessen
commented
Apr 15, 2018
mscdex
commented
Apr 15, 2018
/cc @nodejs/crypto |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
+1 for throwing an exception. and yes, old implementation truncate the authtag...... |
BridgeAR
commented
Apr 22, 2018
Is this ready to land? |
tniessen
commented
Apr 22, 2018
4dad3dc to
18611c6CompareThe current implementation performs limited checks only and silently ignores superfluous bytes of the authentication tag. This change makes setAuthTag throw when - the user-specified authTagLength does not match the actual tag length, especially when the authentication tag is longer than 16 bytes, and when - the mode is GCM, no authTagLength option has been specified and the tag length is not a valid GCM tag length. This change makes the conditional assignment in SetAuthTag unnecessary, which is replaced with a CHECK. Refs: nodejs#17825
18611c6 to
00cf4aaCompareThis patch turned out completely different than I had originally planned, but it still goes into the correct direction in my opinion. Please take another look. As this change is now semver-major anyway, I also unified related error messages. I also took the liberty of marking the discussion of the old change as "Outdated", I can't find the issue about when to use that feature. Feel free to unhide the discussion if this was incorrect. |
tniessen
commented
May 30, 2018
New CI: https://ci.nodejs.org/job/node-test-pull-request/15168/ I know that most of the TSC is probably travelling right now, but still pinging @nodejs/tsc as this is a semver-major change now. Also @richardlau due to his blocking review. |
tniessen
commented
May 30, 2018
Only failure seems to be infra-related: Here's CitGM: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/1446/ |
Trott
commented
May 31, 2018
Re-running node-test-commit-osx: https://ci.nodejs.org/job/node-test-commit-osx/18957/ |
The current implementation performs limited checks only and silently ignores superfluous bytes of the authentication tag. This change makes setAuthTag throw when - the user-specified authTagLength does not match the actual tag length, especially when the authentication tag is longer than 16 bytes, and when - the mode is GCM, no authTagLength option has been specified and the tag length is not a valid GCM tag length. This change makes the conditional assignment in SetAuthTag unnecessary, which is replaced with a CHECK. Refs: #17825 PR-URL: #20040 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Yihong Wang <yh.wang@ibm.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
tniessen
commented
Jun 1, 2018
CitGM looks good as far as I can tell. Landed in faf449c. |
The current implementation performs limited checks only and silently ignores superfluous bytes of the authentication tag. This change makes
setAuthTagthrow whenauthTagLengthdoes not match the actual tag length, especially when the authentication tag is longer than 16 bytes, and whenauthTagLengthoption has been specified and the tag length is not a valid GCM tag length.This change makes the conditional assignment in SetAuthTag unnecessary,
which is replaced with a CHECK.
Refs: #17825
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes