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

[release/10.0.1xx-preview1] Fix array length Fixes #45632 #46654

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Feb 7, 2025

Fixes #45632

Description and impact
#42775 changed the hash function we used from one that generates a 64-byte hash to one that generates an 8-byte hash. We were only actually using 16 bytes of the hash, but 16 bytes of an 8-byte hash is a source array not long enough error. This upgrades to a 16-byte hash from the same hash family.

This hash function doesn't need to be cryptographically secure since it's just used for a named pipe we use for elevation. Without this change, a user with an MSI-based SDK installation who creates a non-admin command prompt then tries to run (almost) any workload command will be prompted to elevate as expected, but regardless of what they respond, it will then fail. The only workaround is to create an admin prompt or use a file-based installation.

Regression
Yes - changing a hash function to a more secure one (even though we don't use it for security) caused this.

Risk
Low – This changes which hash function we use, but we use one from the same family.

Testing
I was able to reproduce the bug first as described then using my custom-built SDK. I made this change then tried to reproduce it again and failed. Here's the side-by-side version of failure then success:
image

I have pushed this change to our internal repo and started a build. When that finishes, I will install it just to verify again that this problem is properly resolved.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Infrastructure untriaged Request triage from a team member labels Feb 7, 2025
@Forgind Forgind added Servicing-consider and removed untriaged Request triage from a team member labels Feb 7, 2025
@Forgind Forgind added this to the 10.0.1xx milestone Feb 7, 2025
@@ -27,7 +27,7 @@ public static Guid Create(string name)
Array.Copy(namespaceBytes, streamToHash, namespaceBytes.Length);
Array.Copy(nameBytes, 0, streamToHash, namespaceBytes.Length, nameBytes.Length);

var hashResult = XxHash3.Hash(streamToHash); // This is just used for generating a named pipe so we don't need a cryptographic hash
Copy link
Member

Choose a reason for hiding this comment

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

nit: Debug.Assert(hashResult.Length >= 16);

Copy link
Member

Choose a reason for hiding this comment

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

I don't dislike this, but I'd rather keep this small. Maybe add this to the main-targeted PR?

@dsplaisted dsplaisted enabled auto-merge February 7, 2025 23:45
@dsplaisted dsplaisted merged commit fe2f389 into release/10.0.1xx-preview1 Feb 8, 2025
31 checks passed
@dsplaisted dsplaisted deleted the backport/pr-46653-to-release/10.0.1xx-preview1 branch February 8, 2025 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants