feat(jdbc): enforce strict JDBC URL parsing and sync DataSource properties#4107
Conversation
There was a problem hiding this comment.
Code Review
This pull request enhances the robustness of JDBC URL parsing through stricter validation, refactored logic, and synchronization of DataSource properties. However, the new parsing logic introduces a connection string injection vulnerability due to unescaped delimiters in property values and insufficient validation for sensitive properties like LogPath. This flaw could enable path traversal or the overriding of security-sensitive connection settings. It is recommended to implement proper escaping for property values and add validation for security-critical properties during URL parsing.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request significantly improves the JDBC driver's connection string parsing by introducing stricter validation for property names, preventing silent failures, and correctly URL-encoding property values. It also synchronizes DataSource properties with BigQueryConnection for enhanced feature parity. However, a potential information exposure vulnerability exists: the parseUrl method could leak sensitive data in SQLException messages if a secret is accidentally provided as a property key, as the raw key is included in error messages. Additionally, there is a minor suggestion to reduce code duplication.
There was a problem hiding this comment.
hm, ok. No need to change it in this PR, but I think we should get rid of parseStringProperty handling default values. We already have defaultValue() available in various property maps (e.g. link)
I don't see a lot of benefit in using map to map upper-to-camel case.. We can just normalize keys and always use upper case instead.

b/429272203
This PR refactors the JDBC connection string parsing logic to be stricter and more robust, preventing silent failures due to typos. It also synchronizes
DataSourceproperties withBigQueryConnectionto ensure full feature parity.