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: add cipher update/final methods encoding validation #45990

Merged

Conversation

vitpavlenko
Copy link
Contributor

@vitpavlenko vitpavlenko commented Dec 27, 2022

Adds encoding validation to update and final cipher methods.

Refs: #45189

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/crypto

@nodejs-github-bot nodejs-github-bot added crypto Issues and PRs related to the crypto subsystem. doc Issues and PRs related to the documentations. errors Issues and PRs related to JavaScript errors originated in Node.js core. needs-ci PRs that need a full CI run. labels Dec 27, 2022
README.md Outdated Show resolved Hide resolved
lib/internal/crypto/cipher.js Outdated Show resolved Hide resolved
lib/internal/validators.js Outdated Show resolved Hide resolved
@vitpavlenko vitpavlenko force-pushed the bugfix/45189-encoding-validation branch from eba9755 to 9bbecff Compare December 28, 2022 12:16
@VoltrexKeyva VoltrexKeyva dismissed their stale review December 28, 2022 14:40

Changes addressed

@vitpavlenko vitpavlenko force-pushed the bugfix/45189-encoding-validation branch from 9bbecff to 449cc81 Compare December 28, 2022 16:34
@vitpavlenko
Copy link
Contributor Author

vitpavlenko commented Dec 28, 2022

Sorry, some-how missed js lint error in test. Fixed it, also updated first commit message. Please approve run @VoltrexKeyva

@vitpavlenko
Copy link
Contributor Author

@VoltrexKeyva any chance to approve?)

@panva panva added the request-ci Add this label to start a Jenkins CI on a PR. label Jan 1, 2023
@panva panva removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 1, 2023
@panva panva requested a review from targos January 1, 2023 16:43
@panva panva changed the title cipher: add cipher update/final methods encoding validation crypto: add cipher update/final methods encoding validation Jan 1, 2023
@panva panva added the commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. label Jan 1, 2023
@vitpavlenko vitpavlenko force-pushed the bugfix/45189-encoding-validation branch from 449cc81 to 1853424 Compare January 1, 2023 17:20
@panva panva added the request-ci Add this label to start a Jenkins CI on a PR. label Jan 1, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 1, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

panva
panva previously requested changes Jan 6, 2023
Copy link
Member

@panva panva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can do perfectly fine without a new error. Here's a combined diff of my suggested changes.

@panva panva force-pushed the bugfix/45189-encoding-validation branch from 1853424 to 47f8bc3 Compare January 12, 2023 17:54
@panva panva removed the commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. label Jan 12, 2023
@panva panva dismissed their stale review January 12, 2023 17:55

feedback applied

@panva panva force-pushed the bugfix/45189-encoding-validation branch from 47f8bc3 to ca20150 Compare January 12, 2023 20:32
@panva panva added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. and removed doc Issues and PRs related to the documentations. labels Jan 13, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 13, 2023
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot
Copy link
Collaborator

if (normalizedEncoding === undefined) {
throw new ERR_UNKNOWN_ENCODING(encoding);
}
assert(false, 'Cannot change encoding');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why throw error by assert? it will be some internal error, no?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can replace the assert with a coded error in a follow up semver-major PRs that contain breaking changes and should be released in the next major version. PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to have a coded error, can I make the change? @panva

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, best wait until this change lands.

@panva panva added the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 17, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 17, 2023
@nodejs-github-bot nodejs-github-bot merged commit 5a7d4a7 into nodejs:main Jan 17, 2023
@nodejs-github-bot
Copy link
Collaborator

Landed in 5a7d4a7

RafaelGSS pushed a commit that referenced this pull request Jan 20, 2023
Refs #45189

PR-URL: #45990
Refs: #45189
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
@RafaelGSS RafaelGSS mentioned this pull request Jan 20, 2023
juanarbol pushed a commit that referenced this pull request Jan 26, 2023
Refs #45189

PR-URL: #45990
Refs: #45189
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
@juanarbol juanarbol mentioned this pull request Jan 28, 2023
juanarbol pushed a commit that referenced this pull request Jan 31, 2023
Refs #45189

PR-URL: #45990
Refs: #45189
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
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. review wanted PRs that need reviews.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants