New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SQL: improve URL parsing error messages for JDBC connection #56474
Comments
Pinging @elastic/es-ql (:Query Languages/SQL) |
I can handle this, please assign it to me to avoid double work. |
Redacting the passwords out of the exception messages can be tricky. The above provided example is raised in two cases:
In the former case - and other few cases, like invalid property name or value - we could safely redact out the credentials. But in the latter - and in general, as there are 3-4 hot spots where we dump the URI - this can't be done reliably since we can't know what's broken, w/o reimplementing a best-effort URI parser. In easiest case we can redact the string between first (unescaped) The safest alternative I see would be to never log the original URI, but just the And a compromise mix might be using a different schema to get the desired behavior: using |
@nikoncode, many thanks for the offer. I will take over this issue. |
What's a valid scenario for For debugging purposes, I still want the URL to be logged somehow and not hidden in its entirety. To be able to control the obfuscation, maybe we should consider creating our own URL parser. This would:
@costin thoughts? |
I meant it as a typo, a misconfiguration.
Correct. Or something "easy" like
We could even use it as a fallback or as a front-end for |
We can take baby steps in improving the improving the existing situation. That is have a bit more understanding about the error code and use that inside the message.
At the end of the day, this is about improving the user experience and cleaning security a bit. |
The URL can still contain the credentials, since
The logging of parts or the entire URL only happens on URL parsing failure. In case the parsing succeeds we only log if authentication failed. Which simplifies a bit the situation, since we only need to consider parsing failure. Thanks for the ideas, though, I'll try to come up with a simple extension to at least hint where the parsing jams and take it from there. |
If the url the jdbc driver is using to connect to Elasticsearch is failing to parse, an error message of the form
Invalid URL [jdbc:es://localhost:9200/?user=xyz&password=abc], format should be [jdbc:es://[http|https]?[host[:port]]*/[prefix]*[?[option=value]&]*]
is generated. The sensitive data needs to be obfuscated.The text was updated successfully, but these errors were encountered: