Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f053ef8

Browse filesBrowse files
committed
Trim "\x00" from a decoded Docker Registry password
Signed-off-by: Dmytro Nosan <dimanosan@gmail.com>
1 parent c6045c3 commit f053ef8
Copy full SHA for f053ef8

File tree

Expand file treeCollapse file tree

2 files changed

+8
-3
lines changed
Filter options
  • spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src
Expand file treeCollapse file tree

2 files changed

+8
-3
lines changed

‎spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/configuration/DockerConfigurationMetadata.java

Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/configuration/DockerConfigurationMetadata.java
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,11 @@ static final class Auth extends MappedObject {
219219
Auth(JsonNode node) {
220220
super(node, MethodHandles.lookup());
221221
String auth = valueAt("/auth", String.class);
222-
if (StringUtils.hasText(auth)) {
222+
if (StringUtils.hasLength(auth)) {
223223
String[] parts = new String(Base64.getDecoder().decode(auth)).split(":", 2);
224224
Assert.state(parts.length == 2, "Malformed auth in docker configuration metadata");
225225
this.username = parts[0];
226-
this.password = parts[1];
226+
this.password = trim(parts[1], Character.MIN_VALUE);
227227
}
228228
else {
229229
this.username = valueAt("/username", String.class);
@@ -244,6 +244,11 @@ String getEmail() {
244244
return this.email;
245245
}
246246

247+
private static String trim(String source, char character) {
248+
source = StringUtils.trimLeadingCharacter(source, character);
249+
return StringUtils.trimTrailingCharacter(source, character);
250+
}
251+
247252
}
248253

249254
static final class DockerContext extends MappedObject {

‎spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/resources/org/springframework/boot/buildpack/platform/docker/configuration/with-auth/config.json

Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/resources/org/springframework/boot/buildpack/platform/docker/configuration/with-auth/config.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"auths": {
33
"https://index.docker.io/v1/": {
4-
"auth": "dXNlcm5hbWU6cGFzc3dvcmQ=",
4+
"auth": "dXNlcm5hbWU6AHBhc3N3b3JkAA==",
55
"email": "test@gmail.com"
66
},
77
"custom-registry.example.com": {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.