We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When removing the port RequestValidator.validate incorrectly decodes the path, query, and fragment.
RequestValidator.validate
e.g.
https://someurl.com:443/somepath?param1=client%3AAnonymous
is converted to
https://someurl.com/somepath?param1=client:Anonymous
https://github.com/twilio/twilio-java/blob/main/src/main/java/com/twilio/security/RequestValidator.java#L145-L147
A suggestion is to consider using getRawPath, getRawQuery, and getRawFragment instead.
getRawPath
getRawQuery
getRawFragment
validate
import java.net.URI; import java.util.HashMap; import com.twilio.security.RequestValidator; ... String url1 = "https://someurl.com/somepath?param1=client%3AAnonymous"; String url2 = "https://someurl.com:443/somepath?param1=client%3AAnonymous"; String signature = "PM+bjB+ITJ9a3LIYStKWOTMZMlU="; RequestValidator r= new RequestValidator("1234567890"); System.out.println("valid without port?: " + r.validate(url1, new HashMap<>(), signature)); System.out.println("valid with port?: " + r.validate(url2, new HashMap<>(), signature));
valid without port?: true valid with port?: false
The text was updated successfully, but these errors were encountered:
This issue has been added to our internal backlog to be prioritized. Pull requests and +1s on the issue summary will help it move up the backlog.
Sorry, something went wrong.
Has this issue been worked upon or is it resolved ?
I would like to work on this @eshanholtz .
@eshanholtz Hello, is it possible to review this PR please? Thanks
Successfully merging a pull request may close this issue.
Issue Summary
When removing the port
RequestValidator.validate
incorrectly decodes the path, query, and fragment.e.g.
is converted to
https://github.com/twilio/twilio-java/blob/main/src/main/java/com/twilio/security/RequestValidator.java#L145-L147
A suggestion is to consider using
getRawPath
,getRawQuery
, andgetRawFragment
instead.Steps to Reproduce
validate
output should be the same for both URLs.Code Snippet
Exception/Log
Technical details:
The text was updated successfully, but these errors were encountered: