Skip to content

Rewrite the native authentication storage scheme - #18907

Draft
zanieb wants to merge 19 commits into
mainfrom
zb/native-auth-as-json
Draft

zanieb wants to merge 19 commits into
mainfrom
zb/native-auth-as-json

Conversation

@zanieb

@zanieb zanieb commented Apr 7, 2026 •

Copy link
Copy Markdown
Member

Native authentication currently requires a username for credential lookup and cannot match stored service paths consistently with the plaintext store. Store structured credentials per realm, with separate entries on Windows, and share credential matching across backends. Use shared user-state locks for updates and best-effort migration of legacy entries, including entries that overlap the collection key.

oshadha-dev

This comment was marked as low quality.

@nooscraft

Copy link
Copy Markdown
Contributor

Sorry for the confusion - I'm @oshadha-dev and was using an assistant to help review the code. The approval was submitted in error. I was analyzing the PR but the formal approval should not have been submitted. Please disregard it!

@nooscraft

Copy link
Copy Markdown
Contributor

Hey @zanieb - the implementation looks good and should fix the artifactory issue.

(Apologies for the accidental approval earlier - that was submitted in error)

@codspeed

codspeed Bot commented Jun 10, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 6 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 52 untouched benchmarks
⏩ 47 skipped benchmarks1


Comparing zb/native-auth-as-json (2de331f) with main (7d998b7)

Open in CodSpeed

Footnotes

  1. 47 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@zanieb
zanieb force-pushed the zb/native-auth-as-json branch 3 times, most recently from c5205f0 to 1c0a9b3 Compare June 10, 2026 16:01
@astral-sh-bot

astral-sh-bot Bot commented Jun 10, 2026 •

Copy link
Copy Markdown

uv test inventory changes

This PR changes the tests when compared with the main base revision.

  • Added tests: 34
  • Removed tests: 8
  • Changed suites: 5
uv-auth: +21 / -8

Added:

  • uv-auth::keyring::native::collection::tests::http_scheme_host_persisted_entry_is_not_treated_as_legacy
  • uv-auth::keyring::native::collection::tests::legacy_passwords_are_retained_when_the_collection_schema_does_not_match
  • uv-auth::keyring::native::collection::tests::remove_deletes_only_the_exact_service_and_username
  • uv-auth::keyring::native::collection::tests::upsert_replaces_only_the_exact_service_and_username
  • uv-auth::keyring::native::tests::legacy_migration_preserves_service_scope
  • uv-auth::keyring::native::tests::legacy_removal_does_not_cross_schemes
  • uv-auth::keyring::native::tests::legacy_service_names_preserve_lookup_order
  • uv-auth::keyring::native::tests::lock_path_is_pure
  • uv-auth::keyring::native::windows::tests::target_identity_distinguishes_case_collisions_and_signed_urls
  • uv-auth::keyring::native::windows::tests::target_validation_rejects_corrupt_and_misplaced_credentials
  • uv-auth::keyring::tests::fetch_http_scheme_host_does_not_cross_schemes
  • uv-auth::matching::tests::match_specificity_rejects_sibling_paths
  • uv-auth::matching::tests::select_credential_ignores_less_specific_ambiguity
  • uv-auth::matching::tests::select_credential_prefers_an_exact_query_match
  • uv-auth::matching::tests::select_credential_prefers_the_most_specific_path
  • uv-auth::matching::tests::select_credential_rejects_equally_specific_users
  • uv-auth::middleware::tests::test_keyring_credentials_do_not_mask_a_more_specific_text_credential
  • uv-auth::middleware::tests::test_text_store_credentials_do_not_mask_more_specific_paths
  • uv-auth::middleware::tests::test_text_store_miss_does_not_mask_another_path
  • uv-auth::store::tests::test_more_specific_match_wins_over_less_specific_ambiguity
  • uv-auth::store::tests::test_prefix_matching_respects_path_boundaries

Removed:

  • uv-auth::keyring::tests::fetch_http_scheme_host_no_cross_scheme
  • uv-auth::keyring::tests::fetch_url
  • uv-auth::keyring::tests::fetch_url_no_auth
  • uv-auth::keyring::tests::fetch_url_no_match
  • uv-auth::keyring::tests::fetch_url_no_username
  • uv-auth::keyring::tests::fetch_url_username
  • uv-auth::keyring::tests::fetch_url_username_no_match
  • uv-auth::keyring::tests::fetch_url_with_empty_username
uv-auth::native_macos: +5 / -0

Added:

  • uv-auth::native_macos::native_store_does_not_migrate_http_legacy_host_credentials
  • uv-auth::native_macos::native_store_keeps_overlapping_legacy_password_when_adding_an_account
  • uv-auth::native_macos::native_store_migrates_https_legacy_host_credentials
  • uv-auth::native_macos::native_store_migrates_overlapping_legacy_password_in_place
  • uv-auth::native_macos::native_store_removes_overlapping_legacy_password

Removed: none

uv-auth::native_windows: +1 / -0

Added:

  • uv-auth::native_windows::native_store_enumerates_many_credentials_in_one_realm

Removed: none

uv-keyring: +2 / -0

Added:

  • uv-keyring::windows::tests::test_enumerate_rejects_non_literal_prefix
  • uv-keyring::windows::tests::test_enumerate_target_prefix

Removed: none

uv::it: +5 / -0

Added:

  • uv::it::auth::native_auth_installs_without_username_in_index_url
  • uv::it::auth::native_auth_lock_directory_ignores_credentials_override
  • uv::it::auth::native_auth_logout_is_service_scoped
  • uv::it::auth::native_auth_multiple_users
  • uv::it::auth::native_auth_uses_path_specific_credentials_in_one_client

Removed: none

Comment thread crates/uv-auth/src/keyring.rs Resolved
Comment thread crates/uv-auth/src/keyring.rs Resolved
Comment thread crates/uv-auth/src/keyring.rs Resolved
Comment thread crates/uv-auth/src/keyring.rs Resolved
Comment thread crates/uv-auth/src/keyring.rs Resolved
Comment thread crates/uv-auth/src/keyring.rs Resolved
Comment thread crates/uv-auth/src/keyring.rs Resolved
Comment thread crates/uv-auth/src/keyring.rs Resolved
Comment thread crates/uv-auth/src/keyring.rs Resolved
@zanieb
zanieb force-pushed the zb/native-auth-as-json branch from 1f465dc to 9d7f18b Compare June 11, 2026 04:32
Comment thread crates/uv-auth/src/keyring/native.rs Resolved
@zanieb
zanieb force-pushed the zb/native-auth-as-json branch from 30f18cf to 3ab1130 Compare October 5, 2026 14:36
zanieb added a commit that referenced this pull request Oct 7, 2026
Auth login accepts `localhost` and `127.0.0.1` over HTTP but rejects the
equivalent IPv6 loopback `http://[::1]:...`. Recognize `::1` as local
without relaxing the localhost-only security policy introduced in
[uv#15755](#15755); this shares the
native-auth surface being rewritten in
[uv#18907](#18907).

Co-authored-by: Zanie Blue <[email protected]>

This branch was previously deployed

1 inactive deployment
automations — 2de331ff Deployed Oct 7, 2026 by zanieb via review / security review #49907
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.

5 participants