From 3b35ca0ac0a000c044cffe3b52f7d8116b4b3258 Mon Sep 17 00:00:00 2001 From: frantuma Date: Mon, 18 Nov 2024 20:45:36 +0100 Subject: [PATCH] refs #2126 - change safe-url-resolver package --- modules/swagger-parser-safe-url-resolver/README.md | 10 +++++----- .../parser/urlresolver/PermittedUrlsChecker.java | 10 +++++----- .../urlresolver/exceptions/HostDeniedException.java | 2 +- .../parser/urlresolver/matchers/UrlPatternMatcher.java | 4 ++-- .../parser/urlresolver/models/ResolvedUrl.java | 2 +- .../{v3 => }/parser/urlresolver/utils/NetUtils.java | 2 +- .../parser/urlresolver/PermittedUrlsCheckerTest.java | 8 ++++---- .../urlresolver/matchers/UrlPatternMatcherTest.java | 2 +- .../parser/urlresolver/utils/NetUtilsTest.java | 2 +- .../src/main/java/io/swagger/parser/ResolverCache.java | 4 ++-- 10 files changed, 23 insertions(+), 23 deletions(-) rename modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/{v3 => }/parser/urlresolver/PermittedUrlsChecker.java (92%) rename modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/{v3 => }/parser/urlresolver/exceptions/HostDeniedException.java (81%) rename modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/{v3 => }/parser/urlresolver/matchers/UrlPatternMatcher.java (94%) rename modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/{v3 => }/parser/urlresolver/models/ResolvedUrl.java (93%) rename modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/{v3 => }/parser/urlresolver/utils/NetUtils.java (98%) rename modules/swagger-parser-safe-url-resolver/src/test/java/io/swagger/{v3 => }/parser/urlresolver/PermittedUrlsCheckerTest.java (98%) rename modules/swagger-parser-safe-url-resolver/src/test/java/io/swagger/{v3 => }/parser/urlresolver/matchers/UrlPatternMatcherTest.java (99%) rename modules/swagger-parser-safe-url-resolver/src/test/java/io/swagger/{v3 => }/parser/urlresolver/utils/NetUtilsTest.java (98%) diff --git a/modules/swagger-parser-safe-url-resolver/README.md b/modules/swagger-parser-safe-url-resolver/README.md index d6bbc29462..916c9bbac4 100644 --- a/modules/swagger-parser-safe-url-resolver/README.md +++ b/modules/swagger-parser-safe-url-resolver/README.md @@ -23,19 +23,19 @@ This behavior can also be customized with the allowlist and denylist in the cons Add the following to you `pom.xml` file under `dependencies` ```xml - io.swagger.parser.v3 + io.swagger swagger-parser-safe-url-resolver // version of swagger-parser being used - 2.1.14 + ${swagger-parser-v1-version} ``` ## Example usage ```java -import io.swagger.v3.parser.urlresolver.PermittedUrlsChecker; -import io.swagger.v3.parser.urlresolver.exceptions.HostDeniedException; -import io.swagger.v3.parser.urlresolver.models.ResolvedUrl; +import io.swagger.parser.urlresolver.PermittedUrlsChecker; +import io.swagger.parser.urlresolver.exceptions.HostDeniedException; +import io.swagger.parser.urlresolver.models.ResolvedUrl; import java.util.List; diff --git a/modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/v3/parser/urlresolver/PermittedUrlsChecker.java b/modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/parser/urlresolver/PermittedUrlsChecker.java similarity index 92% rename from modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/v3/parser/urlresolver/PermittedUrlsChecker.java rename to modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/parser/urlresolver/PermittedUrlsChecker.java index 7fb5ca2b50..34ee401f81 100644 --- a/modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/v3/parser/urlresolver/PermittedUrlsChecker.java +++ b/modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/parser/urlresolver/PermittedUrlsChecker.java @@ -1,9 +1,9 @@ -package io.swagger.v3.parser.urlresolver; +package io.swagger.parser.urlresolver; -import io.swagger.v3.parser.urlresolver.exceptions.HostDeniedException; -import io.swagger.v3.parser.urlresolver.matchers.UrlPatternMatcher; -import io.swagger.v3.parser.urlresolver.models.ResolvedUrl; -import io.swagger.v3.parser.urlresolver.utils.NetUtils; +import io.swagger.parser.urlresolver.exceptions.HostDeniedException; +import io.swagger.parser.urlresolver.matchers.UrlPatternMatcher; +import io.swagger.parser.urlresolver.models.ResolvedUrl; +import io.swagger.parser.urlresolver.utils.NetUtils; import java.net.InetAddress; import java.net.MalformedURLException; diff --git a/modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/v3/parser/urlresolver/exceptions/HostDeniedException.java b/modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/parser/urlresolver/exceptions/HostDeniedException.java similarity index 81% rename from modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/v3/parser/urlresolver/exceptions/HostDeniedException.java rename to modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/parser/urlresolver/exceptions/HostDeniedException.java index ed402001f0..d7c34e054e 100644 --- a/modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/v3/parser/urlresolver/exceptions/HostDeniedException.java +++ b/modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/parser/urlresolver/exceptions/HostDeniedException.java @@ -1,4 +1,4 @@ -package io.swagger.v3.parser.urlresolver.exceptions; +package io.swagger.parser.urlresolver.exceptions; public class HostDeniedException extends Exception { public HostDeniedException(String message) { diff --git a/modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/v3/parser/urlresolver/matchers/UrlPatternMatcher.java b/modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/parser/urlresolver/matchers/UrlPatternMatcher.java similarity index 94% rename from modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/v3/parser/urlresolver/matchers/UrlPatternMatcher.java rename to modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/parser/urlresolver/matchers/UrlPatternMatcher.java index a0c70fcc2e..2348ecf7ce 100644 --- a/modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/v3/parser/urlresolver/matchers/UrlPatternMatcher.java +++ b/modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/parser/urlresolver/matchers/UrlPatternMatcher.java @@ -1,6 +1,6 @@ -package io.swagger.v3.parser.urlresolver.matchers; +package io.swagger.parser.urlresolver.matchers; -import io.swagger.v3.parser.urlresolver.utils.NetUtils; +import io.swagger.parser.urlresolver.utils.NetUtils; import java.net.IDN; import java.net.MalformedURLException; diff --git a/modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/v3/parser/urlresolver/models/ResolvedUrl.java b/modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/parser/urlresolver/models/ResolvedUrl.java similarity index 93% rename from modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/v3/parser/urlresolver/models/ResolvedUrl.java rename to modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/parser/urlresolver/models/ResolvedUrl.java index b5c9bf39c4..b7fa7218f7 100644 --- a/modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/v3/parser/urlresolver/models/ResolvedUrl.java +++ b/modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/parser/urlresolver/models/ResolvedUrl.java @@ -1,4 +1,4 @@ -package io.swagger.v3.parser.urlresolver.models; +package io.swagger.parser.urlresolver.models; public class ResolvedUrl { diff --git a/modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/v3/parser/urlresolver/utils/NetUtils.java b/modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/parser/urlresolver/utils/NetUtils.java similarity index 98% rename from modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/v3/parser/urlresolver/utils/NetUtils.java rename to modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/parser/urlresolver/utils/NetUtils.java index 7aa7088c77..c8f179c986 100644 --- a/modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/v3/parser/urlresolver/utils/NetUtils.java +++ b/modules/swagger-parser-safe-url-resolver/src/main/java/io/swagger/parser/urlresolver/utils/NetUtils.java @@ -1,4 +1,4 @@ -package io.swagger.v3.parser.urlresolver.utils; +package io.swagger.parser.urlresolver.utils; import java.net.Inet4Address; import java.net.Inet6Address; diff --git a/modules/swagger-parser-safe-url-resolver/src/test/java/io/swagger/v3/parser/urlresolver/PermittedUrlsCheckerTest.java b/modules/swagger-parser-safe-url-resolver/src/test/java/io/swagger/parser/urlresolver/PermittedUrlsCheckerTest.java similarity index 98% rename from modules/swagger-parser-safe-url-resolver/src/test/java/io/swagger/v3/parser/urlresolver/PermittedUrlsCheckerTest.java rename to modules/swagger-parser-safe-url-resolver/src/test/java/io/swagger/parser/urlresolver/PermittedUrlsCheckerTest.java index 4625cd719b..e87b0ca1be 100644 --- a/modules/swagger-parser-safe-url-resolver/src/test/java/io/swagger/v3/parser/urlresolver/PermittedUrlsCheckerTest.java +++ b/modules/swagger-parser-safe-url-resolver/src/test/java/io/swagger/parser/urlresolver/PermittedUrlsCheckerTest.java @@ -1,8 +1,8 @@ -package io.swagger.v3.parser.urlresolver; +package io.swagger.parser.urlresolver; -import io.swagger.v3.parser.urlresolver.exceptions.HostDeniedException; -import io.swagger.v3.parser.urlresolver.models.ResolvedUrl; -import io.swagger.v3.parser.urlresolver.utils.NetUtils; +import io.swagger.parser.urlresolver.exceptions.HostDeniedException; +import io.swagger.parser.urlresolver.models.ResolvedUrl; +import io.swagger.parser.urlresolver.utils.NetUtils; import mockit.*; import org.testng.Assert; import org.testng.annotations.BeforeMethod; diff --git a/modules/swagger-parser-safe-url-resolver/src/test/java/io/swagger/v3/parser/urlresolver/matchers/UrlPatternMatcherTest.java b/modules/swagger-parser-safe-url-resolver/src/test/java/io/swagger/parser/urlresolver/matchers/UrlPatternMatcherTest.java similarity index 99% rename from modules/swagger-parser-safe-url-resolver/src/test/java/io/swagger/v3/parser/urlresolver/matchers/UrlPatternMatcherTest.java rename to modules/swagger-parser-safe-url-resolver/src/test/java/io/swagger/parser/urlresolver/matchers/UrlPatternMatcherTest.java index bce4a3e2cd..1ff79bd38a 100644 --- a/modules/swagger-parser-safe-url-resolver/src/test/java/io/swagger/v3/parser/urlresolver/matchers/UrlPatternMatcherTest.java +++ b/modules/swagger-parser-safe-url-resolver/src/test/java/io/swagger/parser/urlresolver/matchers/UrlPatternMatcherTest.java @@ -1,4 +1,4 @@ -package io.swagger.v3.parser.urlresolver.matchers; +package io.swagger.parser.urlresolver.matchers; import org.testng.Assert; import org.testng.annotations.Test; diff --git a/modules/swagger-parser-safe-url-resolver/src/test/java/io/swagger/v3/parser/urlresolver/utils/NetUtilsTest.java b/modules/swagger-parser-safe-url-resolver/src/test/java/io/swagger/parser/urlresolver/utils/NetUtilsTest.java similarity index 98% rename from modules/swagger-parser-safe-url-resolver/src/test/java/io/swagger/v3/parser/urlresolver/utils/NetUtilsTest.java rename to modules/swagger-parser-safe-url-resolver/src/test/java/io/swagger/parser/urlresolver/utils/NetUtilsTest.java index 6f533e85f6..7e7cea3773 100644 --- a/modules/swagger-parser-safe-url-resolver/src/test/java/io/swagger/v3/parser/urlresolver/utils/NetUtilsTest.java +++ b/modules/swagger-parser-safe-url-resolver/src/test/java/io/swagger/parser/urlresolver/utils/NetUtilsTest.java @@ -1,4 +1,4 @@ -package io.swagger.v3.parser.urlresolver.utils; +package io.swagger.parser.urlresolver.utils; import org.testng.Assert; import org.testng.annotations.Test; diff --git a/modules/swagger-parser/src/main/java/io/swagger/parser/ResolverCache.java b/modules/swagger-parser/src/main/java/io/swagger/parser/ResolverCache.java index 2593a88454..2012fe5de0 100644 --- a/modules/swagger-parser/src/main/java/io/swagger/parser/ResolverCache.java +++ b/modules/swagger-parser/src/main/java/io/swagger/parser/ResolverCache.java @@ -14,8 +14,8 @@ import io.swagger.models.refs.RefFormat; import io.swagger.models.refs.RefType; import io.swagger.parser.util.*; -import io.swagger.v3.parser.urlresolver.PermittedUrlsChecker; -import io.swagger.v3.parser.urlresolver.exceptions.HostDeniedException; +import io.swagger.parser.urlresolver.PermittedUrlsChecker; +import io.swagger.parser.urlresolver.exceptions.HostDeniedException; import org.apache.commons.lang3.StringUtils; import java.io.File;