Skip to content

Fix HMAC empty hash function validation#2516

Open
marko1olo wants to merge 1 commit into
gchq:masterfrom
marko1olo:fix-hmac-empty-hash-function
Open

Fix HMAC empty hash function validation#2516
marko1olo wants to merge 1 commit into
gchq:masterfrom
marko1olo:fix-hmac-empty-hash-function

Conversation

@marko1olo

Copy link
Copy Markdown

Fixes #2513.

Summary

  • validate the selected HMAC hashing function before calling toLowerCase()
  • return a controlled OperationError for empty hash function values instead of an uncaught TypeError
  • add a Node API regression test for chef.HMAC(..., { hashingFunction: "" })

Checks

  • node --no-warnings --no-deprecation --openssl-legacy-provider tests/node/index.mjs -> 246 passing
  • node --no-warnings --no-deprecation --openssl-legacy-provider tests/operations/index.mjs -> 1960 passing
  • npx eslint src/core/operations/HMAC.mjs tests/node/tests/operations.mjs tests/operations/tests/Hash.mjs
  • npx grunt configTests
  • git diff --check

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(HMAC): when hashing function is empty it throws an uncaught TypeError

3 participants