fix(bcrypt): handle invalid rounds by throwing OperationError#2560
Open
anushkagupta200615-jpg wants to merge 1 commit into
Open
fix(bcrypt): handle invalid rounds by throwing OperationError#2560anushkagupta200615-jpg wants to merge 1 commit into
anushkagupta200615-jpg wants to merge 1 commit into
Conversation
|
no need that, now fixed, however thank's for the beautifil contribution |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Provide a description of the pull request and the changes that it makes.
Existing Issue
If this pull request relates to an existing issue in the repository, please link it here.
Screenshots
If the pull request changes any visual aspects of CyberChef, please include screenshots.
AI disclosure
If you have used any AI tools while creating this code, you must declare your usage along with the name of the tools that you used.
Regardless of AI tool usage, you are responsible for any code that you submit, and we expect you to have checked the code and have enough of an understanding of it to answer any questions we might have.
Test Coverage
Please ensure you have added test coverage for your changes.
Fixes #2534
Description
This PR fixes an issue where attempting to hash or compare with an invalid number of bcrypt rounds (e.g.
<4or>31) would result in an uncaught exception from thebcryptjsdependency, completely breaking the operation execution instead of bubbling the error to the user interface.Changes Made
bcrypt.compare,bcrypt.genSalt, andbcrypt.hash) inBcrypt.mjsandBcryptCompare.mjswithtry/catchblocks.OperationError, which matches the established architectural pattern in CyberChef (and aligns withBcryptParse.mjs). This allows the error message (e.g.,Illegal number of rounds (4-31)) to safely display in the output panel.Hash.mjs(Bcrypt compare: invalid rounds) to verify that the out-of-bounds error is properly caught. Verified that the test runner correctly passes this using the expected string output.