-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fix #5041: adding raw methods #5064
Conversation
* @param uri must start with / if relative | ||
* @return the response, or null if a 404 code | ||
*/ | ||
default String raw(String uri) { |
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.
If it didn't entail a security issue I'd suggest to use URI
as the parameter type instead.
} else if (payload != null) { | ||
body = Serialization.asJson(payload); | ||
} | ||
HttpRequest request = httpClient.newHttpRequestBuilder().uri(uri).method(method, JSON, body).build(); |
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.
in relation to my previous comment about security.
In which cases do we might want to perform a request to a non-relative URL?
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.
@shawkins, I'm going to merge as it is, but I think it's important to clarify this point. If there's no clear case, we might want to limit this to access only cluster-scoped URIs in order to prevent sending sensitive data to other locations.
SonarCloud Quality Gate failed. |
Description
Fix #5041 with very simple raw method.
Some alternatives / additional work:
Any scenario beyond this - requiring the manipulation of headers for example - we can direct the user to use HttpClient.
Type of change
test, version modification, documentation, etc.)
Checklist