Skip to content

Add SafeUrl::parse_relaxed - #22612

Merged
zanieb merged 1 commit into
zaniebot/safe-url-auth-20261015from
zaniebot/safe-url-parser-20261015
Oct 16, 2026
Merged

zanieb merged 1 commit into
zaniebot/safe-url-auth-20261015from
zaniebot/safe-url-parser-20261015

Conversation

@astral-automations-bot

Copy link
Copy Markdown
Contributor

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).

@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
⏩ 54 skipped benchmarks1


Comparing zaniebot/safe-url-parser-20261015 (03aa0b7) with zaniebot/safe-url-auth-20261015 (6dc8fe0)

Open in CodSpeed

Footnotes

  1. 54 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 zaniebot/safe-url-parser-20261015 branch from 9cba159 to 03aa0b7 Compare October 16, 2026 13:59
@zanieb
zanieb merged commit d058ed8 into main Oct 16, 2026
147 of 150 checks passed
@zanieb
zanieb deleted the zaniebot/safe-url-parser-20261015 branch October 16, 2026 15:16
zanieb pushed a commit that referenced this pull request Oct 16, 2026
Return `Cow<SafeUrl<P>>` from `without_credentials()` so removing
sensitive userinfo retains the serialization policy and redacted
formatting. Serialization and archive metadata retain complete query
strings, and keyring URL targets use explicit string access.

Stacked on #22612.

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

This branch was previously deployed

1 inactive deployment
automations — 03aa0b7e Deployed Oct 16, 2026 by zanieb via review / security review #51337
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