Skip to content
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

#21415 blocking remote calls to private subnets #21427

Merged
merged 3 commits into from Jan 7, 2022

Conversation

wezell
Copy link
Contributor

@wezell wezell commented Dec 15, 2021

No description provided.

@erickgonzalez erickgonzalez linked an issue Jan 4, 2022 that may be closed by this pull request
Copy link
Contributor

@nollymar nollymar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic in CircuitBreakerUrl.java and XmlTool.java should have tests

}

@Test
public void test_xmltool_using_private_ip_should_throw_an_exception() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc

}
}

@Test

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc

setRoot(reader.read(url));


if(IPUtils.isIpPrivateSubnet(url.getHost()) && !Config.getBooleanProperty("ALLOW_ACCESS_TO_PRIVATE_SUBNETS", false)){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should use a util class for this logic, maybe in IPUtils

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably in IPUtils

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would encapsulate the Config call in a Lazy

@nollymar nollymar merged commit 0b62547 into release-22.01 Jan 7, 2022
@@ -193,6 +194,11 @@ public void doOut(final HttpServletResponse response) throws IOException {
.setConnectionRequestTimeout(Math.toIntExact(this.timeoutMs))
.setSocketTimeout(Math.toIntExact(this.timeoutMs)).build();
try (CloseableHttpClient httpclient = HttpClientBuilder.create().setDefaultRequestConfig(config).build()) {

if(IPUtils.isIpPrivateSubnet(this.request.getURI().getHost()) && !Config.getBooleanProperty("ALLOW_ACCESS_TO_PRIVATE_SUBNETS", false)){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would encapsulate the Config call in a Lazy

@wezell wezell deleted the issue-21415-xmltool branch September 19, 2022 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prevent XMLTool from fetching embedded entities
6 participants