Skip to content

Commit

Permalink
Fix authentication with JFrog artifactories
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Mar 21, 2024
1 parent 2375008 commit 4e05ed8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/uv-auth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ task-local-extensions = { workspace = true }
thiserror = { workspace = true }
tracing = { workspace = true }
url = { workspace = true }
urlencoding = { workspace = true }
once_cell = { workspace = true }

[dev-dependencies]
Expand Down
8 changes: 7 additions & 1 deletion crates/uv-auth/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,13 @@ impl AuthenticationStore {
return;
}
let auth = UrlAuthData {
username: url.username().to_string(),
// Using the encoded username can break authentication when `@` is converted to `%40`
// so we decode it for storage; RFC7617 does not explicitly say that authentication should
// not be percent-encoded, but the omission of percent-encoding from all encoding discussion
// indicates that it probably should not be done.
username: urlencoding::decode(url.username())
.expect("An encoded username should always decode")
.into_owned(),
password: url.password().map(str::to_string),
};
credentials.insert(netloc, Some(Credential::UrlEncoded(auth)));
Expand Down

0 comments on commit 4e05ed8

Please sign in to comment.