-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fixing codeQL bugs :Updating hash algorithm #3318
base: v2
Are you sure you want to change the base?
Conversation
@@ -39,7 +39,7 @@ const gravatarURLForAuthor = (email) => { | |||
return "https://avatars.githubusercontent.com/u/49038?s=100&u=0b9ac5bf42a8ea2543a05191e150e0213456744e&v=4"; | |||
|
|||
default: | |||
return crypto.createHash("md5").update(email).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.
I'm not a 100% sure if anything else is needed to make them work. It seems like this should be enough according to the createHash
function description in the crypto
package.
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.
The question is whether or not this breaks anything, but maybe it doesn't; I can't imagine a md5 hash of an email address ever worked as a URL?
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.
Yeah, so this actually can be sha256:
That should pass testing and also actually work.
Azure Static Web Apps: Your stage site is ready! Visit it here: https://victorious-plant-05c166c10-3318.centralus.5.azurestaticapps.net |
@@ -96,7 +96,7 @@ langs.forEach(lang => { | |||
.replace(/\+/g, "-"), | |||
|
|||
sortIndex: index, | |||
hash: crypto.createHash("md5").update(contents).digest("hex"), | |||
hash: crypto.createHash("sha512").update(contents).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.
Checking this, the website still works fine here. It's put into data-hash
in ShowExamples
and that's just used to cache loading them.
@@ -39,7 +39,7 @@ const gravatarURLForAuthor = (email) => { | |||
return "https://avatars.githubusercontent.com/u/49038?s=100&u=0b9ac5bf42a8ea2543a05191e150e0213456744e&v=4"; | |||
|
|||
default: | |||
return crypto.createHash("md5").update(email).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.
Yeah, so this actually can be sha256:
That should pass testing and also actually work.
@@ -39,7 +39,7 @@ const gravatarURLForAuthor = (email) => { | |||
return "https://avatars.githubusercontent.com/u/49038?s=100&u=0b9ac5bf42a8ea2543a05191e150e0213456744e&v=4"; | |||
|
|||
default: | |||
return crypto.createHash("md5").update(email).digest("hex"); | |||
return crypto.createHash("sha512").update(email).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.
return crypto.createHash("sha512").update(email).digest("hex"); | |
return crypto.createHash("sha256").update(email).digest("hex"); |
This pr fixes https://liquid.microsoft.com/codeql/issues/554838ed-6abd-48f1-bfa9-03546781e3c1?copilot_promptid=E91B0CE9-0C1B-4AC2-8A46-33F49B67E058 and https://liquid.microsoft.com/codeql/issues/df74a67a-14d7-41b4-9ed2-b8e9c2a184cb?copilot_promptid=E91B0CE9-0C1B-4AC2-8A46-33F49B67E058
Reference: https://liquid.microsoft.com/Web/Object/Read/MS.Security/Requirements/Microsoft.Security.Cryptography.10021#Zguidance