Skip to content

Fix SHA2 size validation#2522

Open
marko1olo wants to merge 1 commit into
gchq:masterfrom
marko1olo:fix-sha2-empty-size
Open

Fix SHA2 size validation#2522
marko1olo wants to merge 1 commit into
gchq:masterfrom
marko1olo:fix-sha2-empty-size

Conversation

@marko1olo

Copy link
Copy Markdown

Summary

  • Validate the SHA2 size argument before requesting a hasher from crypto-api.
  • Convert invalid direct-link/API values such as SHA2('', 64, 13) into a controlled operation error instead of an uncaught backend TypeError.
  • Add operation regression coverage for the empty size case.

Fixes #2505

Checks

  • node --no-warnings --no-deprecation --openssl-legacy-provider tests/operations/index.mjs
  • npx eslint src/core/operations/SHA2.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(SHA2): can't access property "update", i is undefined when size have no value

3 participants