Skip to content

Use SafeUrl in authentication helpers - #2771

Closed
zaniebot wants to merge 1 commit into
zaniebot/safe-url-audit-20261015from
zaniebot/safe-url-auth-20261015
Closed

zaniebot wants to merge 1 commit into
zaniebot/safe-url-audit-20261015from
zaniebot/safe-url-auth-20261015

Conversation

@zaniebot

@zaniebot zaniebot commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Several authentication helpers accept raw url::Url, making it easy to bypass the redacted formatting provided by SafeUrl. Use SafeUrl for credential extraction, index lookup, realm comparison, and endpoint matching, adapting URLs at reqwest boundaries.

Add SafeUrl::into_unsafe_url for APIs that require the underlying URL. Configured endpoint URLs use url::Url parsing, which accepts URLs that SafeUrl::parse would reject.

Stacked on #2767 (astral-sh#22601).

@zaniebot
zaniebot deployed to automations October 15, 2026 18:18 — with GitHub Actions Active
@astral-automations-bot astral-automations-bot Bot added the internal A refactor or improvement that is not user-facing label Oct 15, 2026
@zanieb
zanieb marked this pull request as ready for review October 15, 2026 18:20
@astral-automations-bot

Copy link
Copy Markdown

Promoted to #22602.

@codspeed

codspeed Bot commented Oct 15, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ 8 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

✅ 69 untouched benchmarks
⏩ 35 skipped benchmarks1


Comparing zaniebot/safe-url-auth-20261015 (246dedd) with zaniebot/safe-url-audit-20261015 (7c2c27a)

Open in CodSpeed

Footnotes

  1. 35 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 pushed a commit to astral-sh/uv that referenced this pull request Oct 16, 2026
`SafeUrl::parse` rejects some ambiguous credentials that
`url::Url::parse` accepts, so callers that need the latter's parsing
behavior use `url::Url` directly. Add `SafeUrl::parse_relaxed` and use
it for configured endpoints, proxy URLs, and file URL parsing. The
method returns `url::ParseError` for invalid URLs and skips the
ambiguous-credentials check. Credentials interpreted as part of a path
or fragment are not redacted when formatted.

Stacked on astral-sh#2771 (#22602).

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

This branch was successfully deployed

1 active deployment
automations — 246dedd9 Deployed Oct 15, 2026 by zaniebot via review-code-quality / code quality review #10419
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal A refactor or improvement that is not user-facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants