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

Fixing codeQL bugs :Updating hash algorithm #3318

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from
Open

Fixing codeQL bugs :Updating hash algorithm #3318

wants to merge 1 commit into from

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");
Copy link
Member Author

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.

Copy link
Member

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?

Copy link
Member

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.

@navya9singh navya9singh added the deploy-preview Enables automatic deployments to preview environments on a PR label Jan 30, 2025
Copy link
Contributor

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"),
Copy link
Member

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");
Copy link
Member

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");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return crypto.createHash("sha512").update(email).digest("hex");
return crypto.createHash("sha256").update(email).digest("hex");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy-preview Enables automatic deployments to preview environments on a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants