-
Notifications
You must be signed in to change notification settings - Fork 0
Fix #110 rn 0.75 buffer issue with android, added new core tests #111
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
Conversation
…ore-tests' into fix-rn-buffer-and-core-tests
|
|
||
| it(`should${ok ? '' : "n't"} auth with hash`, done => { | ||
| const chinook = getConnection() | ||
| chinook.sendCommands(`AUTH USER ${username} HASH ${createHash('sha256').update(password).digest('base64')}`, test(done, chinook, ok)) |
Check failure
Code scanning / CodeQL
Use of password hash with insufficient computational effort
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI over 1 year ago
To fix the problem, we need to replace the use of sha256 with a more secure password hashing algorithm like bcrypt. This change will ensure that the password hashing is computationally intensive and secure against brute-force attacks.
- Replace the
createHash('sha256')method withbcrypt.hashSync. - Import the
bcryptlibrary at the beginning of the file. - Update the hashing logic to use
bcryptwith a salt.
-
Copy modified line R5 -
Copy modified lines R397-R399
| @@ -4,3 +4,3 @@ | ||
|
|
||
| import { createHash } from 'crypto' | ||
| import bcrypt from 'bcrypt' | ||
| import { | ||
| @@ -396,3 +396,5 @@ | ||
| const chinook = getConnection() | ||
| chinook.sendCommands(`AUTH USER ${username} HASH ${createHash('sha256').update(password).digest('base64')}`, test(done, chinook, ok)) | ||
| const saltRounds = 10; | ||
| const hashedPassword = bcrypt.hashSync(password, saltRounds); | ||
| chinook.sendCommands(`AUTH USER ${username} HASH ${hashedPassword}`, test(done, chinook, ok)) | ||
| }) |
-
Copy modified lines R54-R55
| @@ -53,3 +53,4 @@ | ||
| "socket.io-client": "^4.7.5", | ||
| "whatwg-url": "^14.0.0" | ||
| "whatwg-url": "^14.0.0", | ||
| "bcrypt": "^5.1.1" | ||
| }, |
| Package | Version | Security advisories |
| bcrypt (npm) | 5.1.1 | None |
Description of change
fix #110 and added new core tests
Pull-Request Checklist
mainbranchnpm run lintpasses with this changenpm run testpasses with this changeFixes #0000