Skip to content

Use SafeUrl in authentication helpers - #22602

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

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

Conversation

@astral-automations-bot

@astral-automations-bot astral-automations-bot Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

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 #22601.

@codspeed

codspeed Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 7.49%

⚠️ 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

❌ 2 regressed benchmarks
✅ 67 untouched benchmarks
⏩ 54 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ ⚠️ Simulation discover_workspace_from_all_members 141.5 ms 156 ms -9.33%
❌ WallTime git_fetch_cold_precise[sampleproject] 36.2 ms 38.3 ms -5.62%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing zaniebot/safe-url-auth-20261015 (6dc8fe0) with zaniebot/safe-url-audit-20261015 (7c2c27a)2

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

  2. No successful run was found on zaniebot/safe-url-audit-20261015 (e4fe652) during the generation of this report, so 986060b was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@zanieb
zanieb force-pushed the zaniebot/safe-url-auth-20261015 branch from 274ce6c to 6dc8fe0 Compare October 16, 2026 13:59
@zanieb
zanieb merged commit a43f5fd into main Oct 16, 2026
63 of 64 checks passed
@zanieb
zanieb deleted the zaniebot/safe-url-auth-20261015 branch October 16, 2026 15:16
zanieb pushed a commit 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 previously deployed

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