From c6d86493fa6918d4dfa317539afae1a0393739c7 Mon Sep 17 00:00:00 2001 From: buildmaster Date: Tue, 16 Apr 2019 20:09:00 +0000 Subject: [PATCH] Going back to snapshots --- README.adoc | 2 +- docs/pom.xml | 2 +- pom.xml | 6 ++-- spring-cloud-config-client/pom.xml | 2 +- spring-cloud-config-dependencies/pom.xml | 4 +-- spring-cloud-config-monitor/pom.xml | 4 +-- spring-cloud-config-sample/pom.xml | 2 +- spring-cloud-config-server/pom.xml | 2 +- .../resource/GenericResourceRepository.java | 30 +++++++++---------- .../GenericResourceRepositoryTests.java | 6 ++-- spring-cloud-starter-config/pom.xml | 4 +-- 11 files changed, 30 insertions(+), 34 deletions(-) diff --git a/README.adoc b/README.adoc index 48ab1254..d525e0f9 100644 --- a/README.adoc +++ b/README.adoc @@ -257,7 +257,7 @@ credentials and you already have those. The projects that require middleware generally include a `docker-compose.yml`, so consider using -https://docs.docker.com/compose/[Docker Compose] to run the middeware servers +https://compose.docker.io/[Docker Compose] to run the middeware servers in Docker containers. See the README in the https://github.com/spring-cloud-samples/scripts[scripts demo repository] for specific instructions about the common cases of mongo, diff --git a/docs/pom.xml b/docs/pom.xml index e59da90b..e38023e3 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -8,7 +8,7 @@ org.springframework.cloud spring-cloud-config - 2.1.2.RELEASE + 2.1.2.BUILD-SNAPSHOT .. diff --git a/pom.xml b/pom.xml index 153b9f49..f2374126 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.springframework.cloud spring-cloud-config - 2.1.2.RELEASE + 2.1.2.BUILD-SNAPSHOT pom Spring Cloud Config Spring Cloud Config @@ -13,7 +13,7 @@ org.springframework.cloud spring-cloud-build - 2.1.3.RELEASE + 2.1.4.BUILD-SNAPSHOT @@ -27,7 +27,7 @@ config - 2.1.1.RELEASE + 2.1.2.BUILD-SNAPSHOT true true diff --git a/spring-cloud-config-client/pom.xml b/spring-cloud-config-client/pom.xml index 483fa4c8..39f2fd8f 100644 --- a/spring-cloud-config-client/pom.xml +++ b/spring-cloud-config-client/pom.xml @@ -10,7 +10,7 @@ org.springframework.cloud spring-cloud-config - 2.1.2.RELEASE + 2.1.2.BUILD-SNAPSHOT .. diff --git a/spring-cloud-config-dependencies/pom.xml b/spring-cloud-config-dependencies/pom.xml index 533d17ba..a35a07c3 100644 --- a/spring-cloud-config-dependencies/pom.xml +++ b/spring-cloud-config-dependencies/pom.xml @@ -6,11 +6,11 @@ spring-cloud-dependencies-parent org.springframework.cloud - 2.1.3.RELEASE + 2.1.4.BUILD-SNAPSHOT spring-cloud-config-dependencies - 2.1.2.RELEASE + 2.1.2.BUILD-SNAPSHOT pom spring-cloud-config-dependencies Spring Cloud Config Dependencies diff --git a/spring-cloud-config-monitor/pom.xml b/spring-cloud-config-monitor/pom.xml index 7909aeb2..60c70932 100644 --- a/spring-cloud-config-monitor/pom.xml +++ b/spring-cloud-config-monitor/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-config - 2.1.2.RELEASE + 2.1.2.BUILD-SNAPSHOT .. spring-cloud-config-monitor @@ -14,7 +14,7 @@ Spring Cloud Config Monitor ${basedir}/../.. - 2.1.1.RELEASE + 2.1.1.BUILD-SNAPSHOT diff --git a/spring-cloud-config-sample/pom.xml b/spring-cloud-config-sample/pom.xml index 3cdaa2ca..a818f9cf 100644 --- a/spring-cloud-config-sample/pom.xml +++ b/spring-cloud-config-sample/pom.xml @@ -13,7 +13,7 @@ org.springframework.cloud spring-cloud-config - 2.1.2.RELEASE + 2.1.2.BUILD-SNAPSHOT .. diff --git a/spring-cloud-config-server/pom.xml b/spring-cloud-config-server/pom.xml index 5de20aab..a2a053f1 100644 --- a/spring-cloud-config-server/pom.xml +++ b/spring-cloud-config-server/pom.xml @@ -13,7 +13,7 @@ org.springframework.cloud spring-cloud-config - 2.1.2.RELEASE + 2.1.2.BUILD-SNAPSHOT .. diff --git a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/resource/GenericResourceRepository.java b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/resource/GenericResourceRepository.java index 47c035ad..e354554b 100644 --- a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/resource/GenericResourceRepository.java +++ b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/resource/GenericResourceRepository.java @@ -64,7 +64,7 @@ public class GenericResourceRepository String[] locations = this.service.getLocations(application, profile, label) .getLocations(); try { - for (int i = locations.length; i-- > 0;) { + for (int i = locations.length; i-- > 0; ) { String location = locations[i]; for (String local : getProfilePaths(profile, path)) { if (!isInvalidPath(local) && !isInvalidEncodedPath(local)) { @@ -116,8 +116,7 @@ public class GenericResourceRepository private boolean isInvalidEncodedPath(String path) { if (path.contains("%")) { try { - // Use URLDecoder (vs UriUtils) to preserve potentially decoded UTF-8 - // chars + // Use URLDecoder (vs UriUtils) to preserve potentially decoded UTF-8 chars String decodedPath = URLDecoder.decode(path, "UTF-8"); if (isInvalidPath(decodedPath)) { return true; @@ -136,13 +135,13 @@ public class GenericResourceRepository /** * Process the given resource path. - *

- * The default implementation replaces: + *

The default implementation replaces: *

    *
  • Backslash with forward slash. *
  • Duplicate occurrences of slash with a single slash. - *
  • Any combination of leading slash and control characters (00-1F and 7F) with a - * single "/" or "". For example {@code " / // foo/bar"} becomes {@code "/foo/bar"}. + *
  • Any combination of leading slash and control characters (00-1F and 7F) + * with a single "/" or "". For example {@code " / // foo/bar"} + * becomes {@code "/foo/bar"}. *
* @since 3.2.12 */ @@ -152,6 +151,7 @@ public class GenericResourceRepository return cleanLeadingSlash(path); } + private String cleanDuplicateSlashes(String path) { StringBuilder sb = null; char prev = 0; @@ -175,6 +175,7 @@ public class GenericResourceRepository return sb != null ? sb.toString() : path; } + private String cleanLeadingSlash(String path) { boolean slash = false; for (int i = 0; i < path.length(); i++) { @@ -191,6 +192,7 @@ public class GenericResourceRepository return (slash ? "/" : ""); } + /** * Identifies invalid resource paths. By default rejects: *
    @@ -200,10 +202,9 @@ public class GenericResourceRepository *
  • Paths that represent a {@link org.springframework.util.ResourceUtils#isUrl * valid URL} or would represent one after the leading slash is removed. *
- *

- * Note: this method assumes that leading, duplicate '/' or control - * characters (e.g. white space) have been trimmed so that the path starts predictably - * with a single '/' or does not have one. + *

Note: this method assumes that leading, duplicate '/' + * or control characters (e.g. white space) have been trimmed so that the + * path starts predictably with a single '/' or does not have one. * @param path the path to validate * @return {@code true} if the path is invalid, {@code false} otherwise * @since 3.0.6 @@ -219,20 +220,17 @@ public class GenericResourceRepository String relativePath = (path.charAt(0) == '/' ? path.substring(1) : path); if (ResourceUtils.isUrl(relativePath) || relativePath.startsWith("url:")) { if (logger.isWarnEnabled()) { - logger.warn( - "Path represents URL or has \"url:\" prefix: [" + path + "]"); + logger.warn("Path represents URL or has \"url:\" prefix: [" + path + "]"); } return true; } } if (path.contains("..") && StringUtils.cleanPath(path).contains("../")) { if (logger.isWarnEnabled()) { - logger.warn("Path contains \"../\" after call to StringUtils#cleanPath: [" - + path + "]"); + logger.warn("Path contains \"../\" after call to StringUtils#cleanPath: [" + path + "]"); } return true; } return false; } - } diff --git a/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/resource/GenericResourceRepositoryTests.java b/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/resource/GenericResourceRepositoryTests.java index a5594882..51c4b0f8 100644 --- a/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/resource/GenericResourceRepositoryTests.java +++ b/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/resource/GenericResourceRepositoryTests.java @@ -98,11 +98,9 @@ public class GenericResourceRepositoryTests { @Test public void invalidPath() { this.exception.expect(NoSuchResourceException.class); - this.nativeRepository - .setSearchLocations("file:./src/test/resources/test/{profile}"); + this.nativeRepository.setSearchLocations("file:./src/test/resources/test/{profile}"); this.repository.findOne("blah", "local", "master", "..%2F..%2Fdata-jdbc.sql"); - this.output.expect(containsString( - "Path contains \"../\" after call to StringUtils#cleanPath")); + this.output.expect(containsString("Path contains \"../\" after call to StringUtils#cleanPath")); } } diff --git a/spring-cloud-starter-config/pom.xml b/spring-cloud-starter-config/pom.xml index dd0ff43b..d9667ae1 100644 --- a/spring-cloud-starter-config/pom.xml +++ b/spring-cloud-starter-config/pom.xml @@ -6,10 +6,10 @@ org.springframework.cloud spring-cloud-config - 2.1.2.RELEASE + 2.1.2.BUILD-SNAPSHOT spring-cloud-starter-config - 2.1.2.RELEASE + 2.1.2.BUILD-SNAPSHOT spring-cloud-starter-config Spring Cloud Starter https://projects.spring.io/spring-cloud