-
Notifications
You must be signed in to change notification settings - Fork 17
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
feat: evaluation logic in typescript for nodejs sdk #1258
base: main
Are you sure you want to change the base?
Conversation
|
||
private hash(userID: string, featureID: string, samplingSeed: string): string { | ||
const concat = `${featureID}-${userID}${samplingSeed}`; | ||
return crypto.createHash('md5').update(concat).digest('hex'); |
Check failure
Code scanning / CodeQL
Use of a broken or weak cryptographic algorithm High
A broken or weak cryptographic algorithm
sensitive data from an access to userID
A broken or weak cryptographic algorithm
sensitive data from an access to userID
A broken or weak cryptographic algorithm
sensitive data from an access to userID
A broken or weak cryptographic algorithm
sensitive data from an access to userID
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 1 month ago
To fix the problem, we need to replace the weak MD5 hashing algorithm with a stronger one, such as SHA-256. This change will ensure that the hash function used is secure and resistant to collision attacks.
- Replace the
crypto.createHash('md5')
call withcrypto.createHash('sha256')
. - Ensure that the rest of the code remains unchanged to maintain existing functionality.
-
Copy modified line R63
@@ -62,3 +62,3 @@ | ||
const concat = `${featureID}-${userID}${samplingSeed}`; | ||
return crypto.createHash('md5').update(concat).digest('hex'); | ||
return crypto.createHash('sha256').update(concat).digest('hex'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the same cryptographic algorithm as the Golang package, so it's okay.
@duyhungtnn Thanks for creating PR! Please make this ready to review when it is 👍 |
hi @kentakozuka , it's ready. Please help me to review it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing! LGTM 👍
Part of #1260
Local setup
cd evaluation/typescript
export NPM_TOKEN=""
make init
make gen_proto