Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crypto: remove ERR_CRYPTO_SCRYPT_INVALID_PARAMETER #53305

Merged
merged 1 commit into from
Jul 10, 2024

Conversation

tniessen
Copy link
Member

@tniessen tniessen commented Jun 3, 2024

It is confusing to have both ERR_CRYPTO_SCRYPT_INVALID_PARAMETER and ERR_CRYPTO_INVALID_SCRYPT_PARAMS. The former was the original error code, added in 371103d, but parameter validation gradually changed and now produces ERR_CRYPTO_INVALID_SCRYPT_PARAMS for all parameter validation errors coming from OpenSSL, as well as different error codes for validation errors coming from JavaScript.

The only remaining use of ERR_CRYPTO_SCRYPT_INVALID_PARAMETER is in the validation logic that ensures that no two synonymous options were passed. We already have an error code for that particular case, ERR_INCOMPATIBLE_OPTION_PAIR, so replace these last instances of ERR_CRYPTO_SCRYPT_INVALID_PARAMETER with that error code and remove ERR_CRYPTO_SCRYPT_INVALID_PARAMETER. If there ever is need again for such an error code, we can just use ERR_CRYPTO_INVALID_SCRYPT_PARAMS.

This also improves the error messages where Node.js would previously throw ERR_CRYPTO_SCRYPT_INVALID_PARAMETER.

Refs: #35093
Refs: #21525
Refs: #20816

It is confusing to have both ERR_CRYPTO_SCRYPT_INVALID_PARAMETER and
ERR_CRYPTO_INVALID_SCRYPT_PARAMS. The former was the original error
code, added in 371103d, but parameter
validation gradually changed and now produces
ERR_CRYPTO_INVALID_SCRYPT_PARAMS for all parameter validation errors
coming from OpenSSL, as well as different error codes for validation
errors coming from JavaScript. The only remaining use of
ERR_CRYPTO_SCRYPT_INVALID_PARAMETER is in the validation logic that
ensures that no two synonymous options were passed. We already have an
error code for that particular case, ERR_INCOMPATIBLE_OPTION_PAIR, so
replace these last instances of ERR_CRYPTO_SCRYPT_INVALID_PARAMETER with
that error code and remove ERR_CRYPTO_SCRYPT_INVALID_PARAMETER. If there
ever is need again for such an error code, we can just use
ERR_CRYPTO_INVALID_SCRYPT_PARAMS.

Refs: nodejs#35093
Refs: nodejs#21525
Refs: nodejs#20816
@tniessen tniessen added crypto Issues and PRs related to the crypto subsystem. semver-major PRs that contain breaking changes and should be released in the next major version. labels Jun 3, 2024
@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Jun 3, 2024

Review requested:

  • @nodejs/crypto
  • @nodejs/tsc
@nodejs-github-bot nodejs-github-bot added errors Issues and PRs related to JavaScript errors originated in Node.js core. needs-ci PRs that need a full CI run. labels Jun 3, 2024
@tniessen tniessen added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 3, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 3, 2024
@nodejs-github-bot

This comment was marked as outdated.

@panva panva added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jun 4, 2024
@tniessen
Copy link
Member Author

tniessen commented Jun 7, 2024

cc @nodejs/tsc since this is semver-major, strictly speaking.

@tniessen tniessen added the review wanted PRs that need reviews. label Jul 2, 2024
@tniessen
Copy link
Member Author

This PR has been waiting for a second approval from @nodejs/tsc for more than a month.

CitGM: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/3452/

@tniessen tniessen removed the review wanted PRs that need reviews. label Jul 10, 2024
@tniessen tniessen added the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 10, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 10, 2024
@nodejs-github-bot nodejs-github-bot merged commit 33a6d1f into nodejs:main Jul 10, 2024
75 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 33a6d1f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. crypto Issues and PRs related to the crypto subsystem. errors Issues and PRs related to JavaScript errors originated in Node.js core. needs-ci PRs that need a full CI run. semver-major PRs that contain breaking changes and should be released in the next major version.
7 participants