Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
fd5d6ef3
Commit
fd5d6ef3
authored
Jun 18, 2015
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
205c86f5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
12 deletions
+18
-12
Sanitizer.java
.../org/springframework/boot/actuate/endpoint/Sanitizer.java
+3
-2
EnvironmentEndpointTests.java
...ework/boot/actuate/endpoint/EnvironmentEndpointTests.java
+13
-8
appendix-application-properties.adoc
...cs/src/main/asciidoc/appendix-application-properties.adoc
+2
-2
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/Sanitizer.java
View file @
fd5d6ef3
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -26,6 +26,7 @@ import org.springframework.util.Assert;
...
@@ -26,6 +26,7 @@ import org.springframework.util.Assert;
* @author Christian Dupuis
* @author Christian Dupuis
* @author Toshiaki Maki
* @author Toshiaki Maki
* @author Phillip Webb
* @author Phillip Webb
* @author Nicolas Lejeune
*/
*/
class
Sanitizer
{
class
Sanitizer
{
...
@@ -34,7 +35,7 @@ class Sanitizer {
...
@@ -34,7 +35,7 @@ class Sanitizer {
private
Pattern
[]
keysToSanitize
;
private
Pattern
[]
keysToSanitize
;
public
Sanitizer
()
{
public
Sanitizer
()
{
setKeysToSanitize
(
new
String
[]
{
"password"
,
"secret"
,
"key"
,
"vcap_services"
,
".*credentials.*"
}
);
setKeysToSanitize
(
"password"
,
"secret"
,
"key"
,
".*credentials.*"
,
"vcap_services"
);
}
}
/**
/**
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpointTests.java
View file @
fd5d6ef3
...
@@ -37,6 +37,8 @@ import static org.junit.Assert.assertThat;
...
@@ -37,6 +37,8 @@ import static org.junit.Assert.assertThat;
*
*
* @author Phillip Webb
* @author Phillip Webb
* @author Christian Dupuis
* @author Christian Dupuis
* @author Nicolas Lejeune
* @author Stephane Nicoll
*/
*/
public
class
EnvironmentEndpointTests
extends
AbstractEndpointTests
<
EnvironmentEndpoint
>
{
public
class
EnvironmentEndpointTests
extends
AbstractEndpointTests
<
EnvironmentEndpoint
>
{
...
@@ -69,7 +71,8 @@ public class EnvironmentEndpointTests extends AbstractEndpointTests<EnvironmentE
...
@@ -69,7 +71,8 @@ public class EnvironmentEndpointTests extends AbstractEndpointTests<EnvironmentE
System
.
setProperty
(
"dbPassword"
,
"123456"
);
System
.
setProperty
(
"dbPassword"
,
"123456"
);
System
.
setProperty
(
"apiKey"
,
"123456"
);
System
.
setProperty
(
"apiKey"
,
"123456"
);
System
.
setProperty
(
"mySecret"
,
"123456"
);
System
.
setProperty
(
"mySecret"
,
"123456"
);
System
.
setProperty
(
"vcap_services"
,
"123456"
);
System
.
setProperty
(
"myCredentials"
,
"123456"
);
System
.
setProperty
(
"VCAP_SERVICES"
,
"123456"
);
EnvironmentEndpoint
report
=
getEndpointBean
();
EnvironmentEndpoint
report
=
getEndpointBean
();
Map
<
String
,
Object
>
env
=
report
.
invoke
();
Map
<
String
,
Object
>
env
=
report
.
invoke
();
assertEquals
(
"******"
,
assertEquals
(
"******"
,
...
@@ -79,26 +82,28 @@ public class EnvironmentEndpointTests extends AbstractEndpointTests<EnvironmentE
...
@@ -79,26 +82,28 @@ public class EnvironmentEndpointTests extends AbstractEndpointTests<EnvironmentE
assertEquals
(
"******"
,
assertEquals
(
"******"
,
((
Map
<
String
,
Object
>)
env
.
get
(
"systemProperties"
)).
get
(
"mySecret"
));
((
Map
<
String
,
Object
>)
env
.
get
(
"systemProperties"
)).
get
(
"mySecret"
));
assertEquals
(
"******"
,
assertEquals
(
"******"
,
((
Map
<
String
,
Object
>)
env
.
get
(
"systemProperties"
)).
get
(
"vcap_services"
));
((
Map
<
String
,
Object
>)
env
.
get
(
"systemProperties"
)).
get
(
"myCredentials"
));
assertEquals
(
"******"
,
((
Map
<
String
,
Object
>)
env
.
get
(
"systemProperties"
)).
get
(
"VCAP_SERVICES"
));
}
}
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
@Test
@Test
public
void
testKeySanitizationCredentialsPattern
()
throws
Exception
{
public
void
testKeySanitizationCredentialsPattern
()
throws
Exception
{
System
.
setProperty
(
"
vcap
.services.amqp-free.credentials.uri"
,
"123456"
);
System
.
setProperty
(
"
my
.services.amqp-free.credentials.uri"
,
"123456"
);
System
.
setProperty
(
"credentials.http_api_uri"
,
"123456"
);
System
.
setProperty
(
"credentials.http_api_uri"
,
"123456"
);
System
.
setProperty
(
"
vcap
.services.cleardb-free.credentials"
,
"123456"
);
System
.
setProperty
(
"
my
.services.cleardb-free.credentials"
,
"123456"
);
System
.
setProperty
(
"
vcap
.mycredentials.uri"
,
"123456"
);
System
.
setProperty
(
"
foo
.mycredentials.uri"
,
"123456"
);
EnvironmentEndpoint
report
=
getEndpointBean
();
EnvironmentEndpoint
report
=
getEndpointBean
();
Map
<
String
,
Object
>
env
=
report
.
invoke
();
Map
<
String
,
Object
>
env
=
report
.
invoke
();
assertEquals
(
"******"
,
assertEquals
(
"******"
,
((
Map
<
String
,
Object
>)
env
.
get
(
"systemProperties"
)).
get
(
"
vcap
.services.amqp-free.credentials.uri"
));
((
Map
<
String
,
Object
>)
env
.
get
(
"systemProperties"
)).
get
(
"
my
.services.amqp-free.credentials.uri"
));
assertEquals
(
"******"
,
assertEquals
(
"******"
,
((
Map
<
String
,
Object
>)
env
.
get
(
"systemProperties"
)).
get
(
"credentials.http_api_uri"
));
((
Map
<
String
,
Object
>)
env
.
get
(
"systemProperties"
)).
get
(
"credentials.http_api_uri"
));
assertEquals
(
"******"
,
assertEquals
(
"******"
,
((
Map
<
String
,
Object
>)
env
.
get
(
"systemProperties"
)).
get
(
"
vcap
.services.cleardb-free.credentials"
));
((
Map
<
String
,
Object
>)
env
.
get
(
"systemProperties"
)).
get
(
"
my
.services.cleardb-free.credentials"
));
assertEquals
(
"******"
,
assertEquals
(
"******"
,
((
Map
<
String
,
Object
>)
env
.
get
(
"systemProperties"
)).
get
(
"
vcap
.mycredentials.uri"
));
((
Map
<
String
,
Object
>)
env
.
get
(
"systemProperties"
)).
get
(
"
foo
.mycredentials.uri"
));
}
}
...
...
spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
View file @
fd5d6ef3
...
@@ -607,7 +607,7 @@ content into your application; rather pick only the properties that you need.
...
@@ -607,7 +607,7 @@ content into your application; rather pick only the properties that you need.
endpoints.configprops.id=configprops
endpoints.configprops.id=configprops
endpoints.configprops.sensitive=true
endpoints.configprops.sensitive=true
endpoints.configprops.enabled=true
endpoints.configprops.enabled=true
endpoints.configprops.keys-to-sanitize=password,secret,key # suffix or regex
endpoints.configprops.keys-to-sanitize=password,secret,key
,.*credentials.*,vcap_services
# suffix or regex
endpoints.dump.id=dump
endpoints.dump.id=dump
endpoints.dump.sensitive=true
endpoints.dump.sensitive=true
endpoints.dump.enabled=true
endpoints.dump.enabled=true
...
@@ -615,7 +615,7 @@ content into your application; rather pick only the properties that you need.
...
@@ -615,7 +615,7 @@ content into your application; rather pick only the properties that you need.
endpoints.env.id=env
endpoints.env.id=env
endpoints.env.sensitive=true
endpoints.env.sensitive=true
endpoints.env.enabled=true
endpoints.env.enabled=true
endpoints.env.keys-to-sanitize=password,secret,key # suffix or regex
endpoints.env.keys-to-sanitize=password,secret,key
,.*credentials.*,vcap_services
# suffix or regex
endpoints.health.id=health
endpoints.health.id=health
endpoints.health.sensitive=true
endpoints.health.sensitive=true
endpoints.health.enabled=true
endpoints.health.enabled=true
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment