-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fixed:a minor issue change #3428
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR aims to address issues with JDBC URL sanitization by improving URL decoding and adding extra validation for H2 JDBC URLs.
- Adds URL decoding and handles decoding errors gracefully.
- Enhances H2 URL verification with additional regex checks for malicious parameters.
if (!url.matches("^jdbc:[a-zA-Z0-9]+://[^\\s]+$")) { | ||
throw new IllegalArgumentException("Invalid JDBC URL format"); | ||
// url format check - potentially adjust regex based on H2 specifics if needed | ||
if (jdbcProtocol.getPlatform() != null && jdbcProtocol.getPlatform().equalsIgnoreCase("h2")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The modifications to the H2 URL (stored in the variable h2Url) are never propagated back to the returned URL. Consider reassigning cleanedUrl to the processed h2Url after the H2-specific checks to ensure the normalization is effective.
Copilot uses AI. Check for mistakes.
// url format check - potentially adjust regex based on H2 specifics if needed | ||
if (jdbcProtocol.getPlatform() != null && jdbcProtocol.getPlatform().equalsIgnoreCase("h2")) { | ||
String h2Url = url; | ||
// Uniformly handle invisible characters (e.g., \u00A0), replacing them with spaces | ||
h2Url = h2Url.replaceAll("[\\x00-\\x1F\\x7F\\xA0]", " "); | ||
// Convert to lowercase | ||
h2Url = h2Url.toLowerCase(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible that other JDBC drivers, not just H2, could have this issue as well?
Fix a small problem.