Skip to content

Commit

Permalink
fix: Zero length frames in old version of Node
Browse files Browse the repository at this point in the history
resolves aws#199

In Node.js versions 10.9 and older will fail to decrypt if decipher.update is not called.
nodejs/node#22538 fixes this.

If the content is empty, push an empty buffer.
  • Loading branch information
seebees committed Aug 28, 2019
1 parent f642b29 commit b80ac4e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/decrypt-node/src/decipher_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ export function getDecipherStream () {
decipherState = {} as any

decipher.setAuthTag(authTag)
/* In Node.js versions 10.9 and older will fail to decrypt if decipher.update is not called.
* https://github.com/nodejs/node/pull/22538 fixes this.
*/
if (!content.length) decipher.update(Buffer.alloc(0))

const clear: Buffer[] = []
for (const cipherChunk of content) {
Expand Down

0 comments on commit b80ac4e

Please sign in to comment.