This is an automated email from the ASF dual-hosted git repository.
heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git
The following commit(s) were added to refs/heads/master by this push:
new d0a1c61 sanitizer doesn't hash null values so unset is preserved in
output
d0a1c61 is described below
commit d0a1c61b5676a9f7863668548dff5af67390b9f4
Author: Alex Heneveld <[email protected]>
AuthorDate: Thu Sep 16 19:38:49 2021 +0100
sanitizer doesn't hash null values so unset is preserved in output
---
core/src/main/java/org/apache/brooklyn/core/config/Sanitizer.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/core/src/main/java/org/apache/brooklyn/core/config/Sanitizer.java
b/core/src/main/java/org/apache/brooklyn/core/config/Sanitizer.java
index f340a37..418fc5b 100644
--- a/core/src/main/java/org/apache/brooklyn/core/config/Sanitizer.java
+++ b/core/src/main/java/org/apache/brooklyn/core/config/Sanitizer.java
@@ -134,20 +134,21 @@ public final class Sanitizer {
public static final Predicate<Object> IS_SECRET_PREDICATE = new
IsSecretPredicate();
public static Object suppressIfSecret(Object key, Object value) {
- if (Sanitizer.IS_SECRET_PREDICATE.apply(key)) {
+ if (value!=null && Sanitizer.IS_SECRET_PREDICATE.apply(key)) {
return suppress(value);
}
return value;
}
public static String suppress(Object value) {
+ if (value==null) return null;
// only include the first few chars so that malicious observers can't
uniquely brute-force discover the source
String md5Checksum = Strings.maxlen(Streams.getMd5Checksum(new
ByteArrayInputStream(("" + value).getBytes())), 8);
return "<suppressed> (MD5 hash: " + md5Checksum + ")";
}
public static String suppressIfSecret(Object key, String value) {
- if (Sanitizer.IS_SECRET_PREDICATE.apply(key)) {
+ if (value!=null && Sanitizer.IS_SECRET_PREDICATE.apply(key)) {
return suppress(value);
}
return value;