Skip to content

Reject query strings in Client.base_url - #1395

Closed
Kludex wants to merge 1 commit into
mainfrom
reject-base-url-query
Closed

Kludex wants to merge 1 commit into
mainfrom
reject-base-url-query

Conversation

@Kludex

@Kludex Kludex commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Raise ValueError in BaseClient.base_url (used by both Client and AsyncClient on init and assignment) when base_url contains a query string, pointing callers to params=....

Previously _enforce_trailing_slash() and _merge_url() appended onto URL.raw_path (which includes ?query), silently producing malformed URLs such as https://example.com/api?key=k/items or dropping relative path segments when params= was passed. Checking b"?" in base_url.raw_path also catches trailing empty queries like https://example.com/api? while still allowing percent-encoded %3F in paths.

Closes #1236

Session: pi --session 01a24058-cc48-76fc-a013-84da8cb42ccf

View guided diff

@veria-ai

veria-ai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

PR overview

No security issues were found in this pull request.

Reviews

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-04T12:31:56.221621Z 7366be2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codspeed

codspeed Bot commented Dec 4, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 18 untouched benchmarks
⏩ 7 skipped benchmarks1


Comparing reject-base-url-query (7366be2) with main (9e06d74)

Open in CodSpeed

Footnotes

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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

View guided diff | Re-trigger cubic

@Kludex Kludex closed this Dec 4, 2026
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.

base_url with a query string produces malformed request URLs

1 participant