mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-06 04:58:50 +00:00
* SQL: Redact credentials in connection exceptions (#58650) This commit adds the functionality to redact the credentials from the exceptions generated when a connection attempt fails, preventing them from leaking into logs, console history etc. There are a few causes that can lead to failed connections. The most challenging to deal with is a malformed connection string. The redaction tries to get around it by modifying the URI to a parsable state, so that the redaction can be applied reliably. If there's no reliability guarantee, the redaction will bluntly replace the entire connection string and the user informed about the option to modify it so that the redaction won't apply. (This is done by using a caplitalized scheme, which is legal, but otherwise never used in practice.) The commit fixes a couple of other issues with the URI parser: - it allows an empty hostname, or even entire connection string (as per the existing documentation); - it reduces the editing of the connection string in the exception messages (so that the user easier recognize their input); - it uses the default URI as source for the scheme and hostname. (cherry picked from commit a0bd5929d0658c4fed44404e0c4d78eac88222fd) * Implement String#repeat(), unavailable in Java8 Implement a client.StringUtils#repeatString() as a replacement for String#repeat(), unavailable in Java8.