-
Notifications
You must be signed in to change notification settings - Fork 397
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
@W-8522881@ Invalidate input URL if it contains special characters #534
Conversation
features/src/main/scala/com/salesforce/op/features/types/Text.scala
Outdated
Show resolved
Hide resolved
@@ -181,11 +182,11 @@ class URL(value: Option[String]) extends Text(value){ | |||
/** | |||
* Extracts url domain, i.e. 'salesforce.com', 'data.com' etc. | |||
*/ | |||
def domain: Option[String] = value map (new java.net.URL(_).getHost) | |||
def domain: Option[String] = value map (s => new java.net.URL(new URI(s, false).toString).getHost) |
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.
I would rather make it a parameter with a default value, e.g.
/**
* Extracts url domain, i.e. 'salesforce.com', 'data.com' etc.
*
* @param escaped true if URI character sequence is in escaped form. false otherwise.
*/
def domain(escaped: Boolean = false): Option[String] = value map (s => new java.net.URL(new URI(s, escaped).toString).getHost)
I still don't see an exception:
|
Looks like a JDK related issue, with |
Codecov Report
@@ Coverage Diff @@
## master #534 +/- ##
===========================================
+ Coverage 58.44% 86.77% +28.33%
===========================================
Files 347 347
Lines 12019 12019
Branches 389 394 +5
===========================================
+ Hits 7024 10430 +3406
+ Misses 4995 1589 -3406
Continue to review full report at Codecov.
|
it looks like it was a CVE patch: http://hg.openjdk.java.net/jdk-updates/jdk11u/rev/2c5fa7382e75 |
instead of working around the security patch I suggest we simply return None for illegal URI. |
@gerashegalov that might be hiding the problem under the carpet. None would be indistinguishable from a |
I am not convinced that replacing the URL parsing library is an acceptable solution in this case. |
@tovbinm I traced to this change in jdk, and also the reason it is been added. Line http://hg.openjdk.java.net/jdk-updates/jdk11u/rev/2c5fa7382e75#l3.39 declared there is a CRLF concern has been masked out. |
@winterslu +1 |
This PR in the original form with escaping was "sweeping the problem under the rug" @tovbinm |
note that implementation no longer matches the PR description |
@crupley @gerashegalov To merge and close this PR, i have created an issue (feature request) #539 to log additional works that would handle string/url input in this bug, by replacing special characters with standard form. |
Thank you. |
Due to latest java.net.URL security constrain, we invalidate URL containing special characters, for example '@', this issue should be addressed globally and properly by normalizing special characters into single form.