fix(trino): sanitize bracketed userinfo and URL-decode credentials - #2472
Conversation
|
Warning Review limit reached
Next review available in: 57 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughTrino connection URL parsing now sanitizes brackets in userinfo before parsing, preserves literal plus signs during decoding, and adds tests for bracketed passwords with regular and IPv6 hosts. ChangesTrino URL parsing
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The shared CI failure here ( |
d7ee523 to
5a16599
Compare
|
Done — rebased onto latest |
Raw '[' / ']' in trino:// credentials raise ValueError from urlparse's IPv6 netloc check. Escape only the userinfo segment (preserving real IPv6 hosts), then unquote username/password/catalog/schema so both the escaped brackets and ordinary percent-encoded reserved characters land as the intended strings. unquote (not unquote_plus) keeps literal '+'. Move the pure URL-parser regressions into tests/unit/test_trino_parser.py so the Docker-free test-unit CI job covers them.
5a16599 to
db604db
Compare
Summary
[/]in Trino URL userinfo beforeurlparseso bracketed passwords no longer raise ValueError on IPv6 netloc checks.[::1]) intact and continue URL-decoding credentials/catalog/schema withunquote(notunquote_plus) so literal+is preserved.tests/unit/test_trino_parser.pyso thetest-unitCI job covers them (CodeRabbit nitpick).Motivation
Follows / completes #2435.
Passwords containing raw brackets in
trino://connection URLs crashurllib.parse.urlparsebecause it treats any bare[/]in netloc as IPv6 markers. This is a small, MySQL-style sanitizer limited to the userinfo segment.Verification
_parse_trino_url:trino://user:p[a]ss@host:8080/catalog/schema→ passwordp[a]sstrino://user:p[a]ss@[::1]:8080/catalog/schema→ host::1, passwordp[a]ss+preservedmain.--lockedmaturin failures across unit/postgres/mysql/ui/memory (infra/stale, shared with other open PRs), not trino-logic failures.Notes
#2455 closed after a force-push mishap; this is a clean single-commit recreate on current
mainwith the CodeRabbit nitpick applied.Summary by CodeRabbit
[/]), ensuring they no longer break parsing and are retained correctly.+characters in credentials and decodes%-escapes as expected.[::1]) even when the password contains bracket characters.