wangyum opened a new issue, #7316:
URL: https://github.com/apache/kyuubi/issues/7316
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
### Search before asking
- [x] I have searched in the [issues](https://github.com/apache/kyuubi/issues?q=is%3Aissue) and found no similar issues.
### Describe the bug
## Description
The `Utils.parsePropertyFromUrl()` method incorrectly includes query string parameters in the returned value when parsing JDBC URLs. This causes inconsistent behavior compared to `Utils.extractURLComponents()` and leads to
authentication failures in beeline.
## Problem
For a JDBC URL like:
jdbc:hive2://host:10012/db;auth=JWT?kyuubi.session.cluster=hermes
- `parsePropertyFromUrl(url, "auth")` returns: `"JWT?kyuubi.session.cluster=clusterA"` ❌
- `extractURLComponents(url, props).getSessionVars().get("auth")` returns: `"JWT"` ✅
These two methods should return the same value, but they don't.
## Impact
This bug causes **HTTP 401 authentication failures** when using beeline with JWT authentication:
```bash
bin/beeline -u "jdbc:hive2://host:10012/db;transportMode=http;httpPath=cliservice;ssl=true;auth=JWT?kyuubi.session.cluster=clusterA"
Error:
org.apache.kyuubi.shaded.thrift.transport.TTransportException: HTTP Response code: 401
The bug affects any code path that uses parsePropertyFromUrl() to extract authentication parameters from JDBC URLs with query strings.
Root Cause
The parsePropertyFromUrl() method (Utils.java:567-575) splits by semicolons but doesn't handle the ? query string delimiter:
public static String parsePropertyFromUrl(final String url, final String key) {
String[] tokens = url.split(";");
for (String token : tokens) {
if (token.trim().startsWith(key.trim() + "=")) {
return token.trim().substring((key.trim() + "=").length()); // ❌ Returns "JWT?kyuubi.session.cluster=clusterA"
}
}
return null;
}
Meanwhile, extractURLComponents() correctly uses URI.getPath() which stops at the ? delimiter.
### Affects Version(s)
master
### Kyuubi Server Log Output
```logtalk
```
### Kyuubi Engine Log Output
```logtalk
```
### Kyuubi Server Configurations
```yaml
```
### Kyuubi Engine Configurations
```yaml
```
### Additional context
_No response_
### Are you willing to submit PR?
- [x] Yes. I would be willing to submit a PR with guidance from the Kyuubi community to fix.
- [ ] No. I cannot submit a PR at this time.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
github-actions[bot] commented on issue #7316: URL: https://github.com/apache/kyuubi/issues/7316#issuecomment-3816089129 Hello @wangyum, Thanks for finding the time to report the issue! We really appreciate the community's efforts to improve Apache Kyuubi. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org For queries about this service, please contact Infrastructure at: users@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org For additional commands, e-mail: notifications-help@kyuubi.apache.org