fix(trino): URL-decode credentials and identifiers from connection URL#2435
fix(trino): URL-decode credentials and identifiers from connection URL#2435Bartok9 wants to merge 1 commit into
Conversation
_parse_trino_url passed parsed.username/password and the catalog/schema path parts to the connect kwargs raw. urlparse leaves percent-encoded characters in userinfo and path, so a credential or identifier containing a reserved character (@ / : ?) — which MUST be percent-encoded in the URL — reached Trino as the literal %40 etc. Decode with unquote (not unquote_plus so a literal + is preserved), matching the mssql/mysql/clickhouse/oracle connectors.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThe Trino connector's ChangesTrino URL Decoding
Estimated code review effort: 1 (Trivial) | ~5 minutes 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 |
Summary
_parse_trino_urlnowunquote()s the username, password, catalog, and schema parsed out of the connection URL.Motivation
_parse_trino_url(incore/wren/src/wren/connector/trino.py) parsed atrino://user:pass@host:port/catalog/schemaURL and putparsed.username/parsed.password/ the catalog+schema path parts straight into the connect kwargs.urllib.parse.urlparseleaves percent-encoded characters in the userinfo and path. Credentials and identifiers can contain reserved characters (@,/,:,?) that must be percent-encoded for the URL to parse — so a password likep@ss/word(...:p%40ss%2Fword@...) reached Trino as the literalp%40ss%2Fword, and a catalog namedcat/alog(cat%2Falog) was mis-parsed.The mssql, mysql, clickhouse, and oracle connectors already
unquote()these components. This brings Trino in line.unquote(notunquote_plus) is used so a literal+in a credential is preserved.Verification
Real output on current
upstream/main(fix reverted, tests present):With the fix applied:
+is preserved.core/**).Summary by CodeRabbit
Bug Fixes
+characters in credentials instead of treating them as spaces.Tests
+characters in credentials remain intact.