GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — crypto: make update(buf, enc) ignore encoding by bnoordhuis · Pull Request #31766 · nodejs/node

Conversation

@bnoordhuis

@bnoordhuis bnoordhuis commented Feb 13, 2020

Copy link
Copy Markdown
Member

Make the cipher/decipher/hash/hmac update() methods ignore the input
encoding when the input is a buffer.

This is the documented behavior but some inputs were rejected, notably
when the specified encoding is 'hex' and the buffer has an odd length
(because a string with an odd length is never a valid hex string.)

The sign/verify update() methods work okay because they use different
validation logic.

Fixes: #31751

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@bnoordhuis
crypto: make update(buf, enc) ignore encoding
badfa84
Make the cipher/decipher/hash/hmac update() methods ignore the input
encoding when the input is a buffer.

This is the documented behavior but some inputs were rejected, notably
when the specified encoding is 'hex' and the buffer has an odd length
(because a _string_ with an odd length is never a valid hex string.)

The sign/verify update() methods work okay because they use different
validation logic.

Fixes: nodejs#31751
@nodejs-github-bot nodejs-github-bot added the crypto Issues and PRs related to the crypto subsystem. label Feb 13, 2020
@bnoordhuis bnoordhuis mentioned this pull request Feb 13, 2020
crypto: optimize sign.update() and verify.update() #31767
Closed
@nodejs-github-bot

nodejs-github-bot commented Feb 13, 2020

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/29091/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnoordhuis bnoordhuis mentioned this pull request Feb 13, 2020
crypto.Decipher.update errors when inputEncoding is provided and data is a Buffer #31751
Closed
addaleax
addaleax approved these changes Feb 13, 2020
View reviewed changes
cjihrig
cjihrig approved these changes Feb 13, 2020
View reviewed changes
@addaleax addaleax added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Feb 13, 2020
jasnell
jasnell approved these changes Feb 13, 2020
View reviewed changes
richardlau
richardlau approved these changes Feb 13, 2020
View reviewed changes
lpinca
lpinca approved these changes Feb 13, 2020
View reviewed changes
tniessen
tniessen approved these changes Feb 20, 2020
View reviewed changes
@nodejs-github-bot

nodejs-github-bot commented Mar 5, 2020

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/29568/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tniessen

tniessen commented Mar 5, 2020

Copy link
Copy Markdown
Member

Landed in 9ec8781.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tniessen tniessen closed this Mar 5, 2020
tniessen pushed a commit that referenced this pull request Mar 5, 2020
@bnoordhuis @tniessen
crypto: make update(buf, enc) ignore encoding
9ec8781
Make the cipher/decipher/hash/hmac update() methods ignore the input
encoding when the input is a buffer.

This is the documented behavior but some inputs were rejected, notably
when the specified encoding is 'hex' and the buffer has an odd length
(because a _string_ with an odd length is never a valid hex string.)

The sign/verify update() methods work okay because they use different
validation logic.

Fixes: #31751

PR-URL: #31766
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
MylesBorins pushed a commit that referenced this pull request Mar 9, 2020
@bnoordhuis @MylesBorins
crypto: make update(buf, enc) ignore encoding
a727b13
Make the cipher/decipher/hash/hmac update() methods ignore the input
encoding when the input is a buffer.

This is the documented behavior but some inputs were rejected, notably
when the specified encoding is 'hex' and the buffer has an odd length
(because a _string_ with an odd length is never a valid hex string.)

The sign/verify update() methods work okay because they use different
validation logic.

Fixes: #31751

PR-URL: #31766
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Mar 10, 2020
v13.11.0 proposal #32185
Merged
@targos targos added dont-land-on-v10.x labels Apr 20, 2020
@panva panva mentioned this pull request Jan 7, 2023
crypto Cipher/Decipher validation issues #45189
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jasnell jasnell jasnell approved these changes
@addaleax addaleax addaleax approved these changes
@lpinca lpinca lpinca approved these changes
@cjihrig cjihrig cjihrig approved these changes
@tniessen tniessen tniessen approved these changes
@richardlau richardlau richardlau approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. crypto Issues and PRs related to the crypto subsystem.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

crypto.Decipher.update errors when inputEncoding is provided and data is a Buffer

Uh oh!

There was an error while loading. Please reload this page.

9 participants

@bnoordhuis @nodejs-github-bot @tniessen @jasnell @addaleax @lpinca @cjihrig @richardlau @targos
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.