Skip to content

Conversation

@AdmiringWorm
Copy link
Member

Description Of Changes

Add a method to convert passwords to NetworkCredential using codepage 1252 encoding to support non-ASCII characters in credentials. This addresses issues with encoding mismatches in .NET 4.8.1 that cause incorrect password handling.

Update credential retrieval to use this conversion method, falling back to the original password on retry attempts to maintain compatibility.

Add tests verifying correct username and legacy-encoded password handling for non-ASCII characters in explicit and implicit credential scenarios.

Motivation and Context

Even when a user is using a password with non-ascii characters, we would still want the user to be able to connect to a remote source, even when

Testing

  1. Update the credentials used for one of your sources to include non-ascii characters (ie, øæåéèàù)
  2. Attempt to search for a package using the updated source with the new credentials.
  3. Verify the expected results are shown.

Operating Systems Testing

  • Windows 11

Change Types Made

  • Bug fix (non-breaking change).
  • Feature / Enhancement (non-breaking change).
  • Breaking change (fix or feature that could cause existing functionality to change).
  • Documentation changes.
  • PowerShell code changes.

Change Checklist

  • Requires a change to the documentation.
  • Documentation has been updated.
  • Tests to cover my changes, have been added.
  • All new and existing tests passed?
  • PowerShell code changes: PowerShell v3 compatibility checked?

Related Issue

Fixes #3600

@AdmiringWorm AdmiringWorm self-assigned this Jul 21, 2025
@gep13 gep13 self-requested a review August 7, 2025 07:45
@AdmiringWorm AdmiringWorm force-pushed the handle-non-ascii-passwords-encoding branch from 0230a47 to cfd7632 Compare October 3, 2025 10:04
@AdmiringWorm AdmiringWorm force-pushed the handle-non-ascii-passwords-encoding branch from cfd7632 to b6341cd Compare November 19, 2025 09:49
…lback

Add a method to convert passwords to NetworkCredential using codepage 1252
encoding to support non-ASCII characters in credentials. This addresses issues
with encoding mismatches in .NET 4.8.1 that cause incorrect password handling.

Update credential retrieval to use this conversion method, falling back to the
original password on retry attempts to maintain compatibility.

Add tests verifying correct username and legacy-encoded password handling for
non-ASCII characters in explicit and implicit credential scenarios.
@gep13 gep13 force-pushed the handle-non-ascii-passwords-encoding branch from b6341cd to ba25453 Compare November 26, 2025 13:56
Copy link
Member

@gep13 gep13 left a comment

Choose a reason for hiding this comment

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

LGTM!

@gep13
Copy link
Member

gep13 commented Nov 27, 2025

@AdmiringWorm thank you for getting this fixed up! And thank you to @pfremy for highlighting the need for this change!

@gep13 gep13 merged commit c2919a6 into chocolatey:develop Nov 27, 2025
5 checks passed
@AdmiringWorm AdmiringWorm deleted the handle-non-ascii-passwords-encoding branch November 27, 2025 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chocolatey does not handle passwords with non ASCII characters when interacting with authenticating sources

2 participants