From 2fb4895cacef2de7233e5d86cbf72d3ad1501a93 Mon Sep 17 00:00:00 2001 From: Jeremy Long Date: Fri, 1 Dec 2023 09:24:34 -0500 Subject: [PATCH] fix: resolve proxy auth issue resolves #86 --- .../jeremylong/openvulnerability/client/epss/EpssDataFeed.java | 3 ++- .../client/ghsa/GitHubSecurityAdvisoryClient.java | 2 +- .../jeremylong/openvulnerability/client/kev/KevDataFeed.java | 3 ++- .../openvulnerability/client/nvd/RateLimitedClient.java | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/open-vulnerability-clients/src/main/java/io/github/jeremylong/openvulnerability/client/epss/EpssDataFeed.java b/open-vulnerability-clients/src/main/java/io/github/jeremylong/openvulnerability/client/epss/EpssDataFeed.java index 5632a3d8..21d16e2e 100644 --- a/open-vulnerability-clients/src/main/java/io/github/jeremylong/openvulnerability/client/epss/EpssDataFeed.java +++ b/open-vulnerability-clients/src/main/java/io/github/jeremylong/openvulnerability/client/epss/EpssDataFeed.java @@ -50,7 +50,8 @@ public List download() { List list = null; HttpGet request = new HttpGet(downloadUrl); SystemDefaultRoutePlanner planner = new SystemDefaultRoutePlanner(ProxySelector.getDefault()); - try (CloseableHttpClient client = HttpClientBuilder.create().setRoutePlanner(planner).build()) { + try (CloseableHttpClient client = HttpClientBuilder.create().setRoutePlanner(planner).useSystemProperties() + .build()) { list = client.execute(request, new EpssResponseHandler()); } catch (IOException e) { e.printStackTrace(); diff --git a/open-vulnerability-clients/src/main/java/io/github/jeremylong/openvulnerability/client/ghsa/GitHubSecurityAdvisoryClient.java b/open-vulnerability-clients/src/main/java/io/github/jeremylong/openvulnerability/client/ghsa/GitHubSecurityAdvisoryClient.java index 021f4de8..47c5eb32 100644 --- a/open-vulnerability-clients/src/main/java/io/github/jeremylong/openvulnerability/client/ghsa/GitHubSecurityAdvisoryClient.java +++ b/open-vulnerability-clients/src/main/java/io/github/jeremylong/openvulnerability/client/ghsa/GitHubSecurityAdvisoryClient.java @@ -158,7 +158,7 @@ public GitHubSecurityAdvisoryClient(String githubToken, String endpoint) { cwesTemplate = loadMustacheTemplate(CWES_TEMPLATE); SystemDefaultRoutePlanner planner = new SystemDefaultRoutePlanner(ProxySelector.getDefault()); - httpClient = HttpAsyncClients.custom().setRoutePlanner(planner).build(); + httpClient = HttpAsyncClients.custom().setRoutePlanner(planner).useSystemProperties().build(); httpClient.start(); objectMapper = new ObjectMapper(); objectMapper.registerModule(new JavaTimeModule()); diff --git a/open-vulnerability-clients/src/main/java/io/github/jeremylong/openvulnerability/client/kev/KevDataFeed.java b/open-vulnerability-clients/src/main/java/io/github/jeremylong/openvulnerability/client/kev/KevDataFeed.java index 7e6458c5..e5b37a42 100644 --- a/open-vulnerability-clients/src/main/java/io/github/jeremylong/openvulnerability/client/kev/KevDataFeed.java +++ b/open-vulnerability-clients/src/main/java/io/github/jeremylong/openvulnerability/client/kev/KevDataFeed.java @@ -58,7 +58,8 @@ public KevCatalog download() { HttpGet request = new HttpGet(downloadUrl); SystemDefaultRoutePlanner planner = new SystemDefaultRoutePlanner(ProxySelector.getDefault()); String json; - try (CloseableHttpClient client = HttpClientBuilder.create().setRoutePlanner(planner).build()) { + try (CloseableHttpClient client = HttpClientBuilder.create().setRoutePlanner(planner).useSystemProperties() + .build()) { json = client.execute(request, new BasicHttpClientResponseHandler()); } catch (IOException e) { throw new KevException("Unable to download the Known Exploitable Vulnerability Catalog", e); diff --git a/open-vulnerability-clients/src/main/java/io/github/jeremylong/openvulnerability/client/nvd/RateLimitedClient.java b/open-vulnerability-clients/src/main/java/io/github/jeremylong/openvulnerability/client/nvd/RateLimitedClient.java index f6af98d2..a9591678 100644 --- a/open-vulnerability-clients/src/main/java/io/github/jeremylong/openvulnerability/client/nvd/RateLimitedClient.java +++ b/open-vulnerability-clients/src/main/java/io/github/jeremylong/openvulnerability/client/nvd/RateLimitedClient.java @@ -125,7 +125,8 @@ class RateLimitedClient implements AutoCloseable { LOG.debug("rate limited call delay: {}", delay); NvdApiRetryStrategy retryStrategy = new NvdApiRetryStrategy(maxRetries, minimumDelay); SystemDefaultRoutePlanner planner = new SystemDefaultRoutePlanner(ProxySelector.getDefault()); - client = HttpAsyncClients.custom().setRoutePlanner(planner).setRetryStrategy(retryStrategy).build(); + client = HttpAsyncClients.custom().setRoutePlanner(planner).setRetryStrategy(retryStrategy) + .useSystemProperties().build(); client.start(); }