geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vfor...@apache.org
Subject incubator-geode git commit: GEODE-503: Addresses config passwords written to logs
Date Thu, 10 Dec 2015 22:18:59 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/develop 34eb0fe44 -> 11c62f232


GEODE-503: Addresses config passwords written to logs

Prevents configuration passwords from being written to log files
for keystores used by SSL or any config parameter with the
keyword password in its name.

Adds unit test to validate AbstractConfigJUnitTest


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/11c62f23
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/11c62f23
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/11c62f23

Branch: refs/heads/develop
Commit: 11c62f232014d4c93cf3c625b31b1a3139613818
Parents: 34eb0fe
Author: Vince Ford <vford13@apache.org>
Authored: Thu Dec 10 11:01:13 2015 -0800
Committer: Vince Ford <vford13@apache.org>
Committed: Thu Dec 10 11:46:46 2015 -0800

----------------------------------------------------------------------
 .../gemfire/internal/AbstractConfig.java        |   4 -
 .../internal/AbstractConfigJUnitTest.java       | 114 +++++++++++++++++++
 2 files changed, 114 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11c62f23/gemfire-core/src/main/java/com/gemstone/gemfire/internal/AbstractConfig.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/AbstractConfig.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/AbstractConfig.java
index 2f2f0f7..ddf2970 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/AbstractConfig.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/AbstractConfig.java
@@ -204,10 +204,6 @@ public abstract class AbstractConfig implements Config {
   }
   
   private boolean okToDisplayPropertyValue(String attName) {
-    if (AbstractDistributionConfig.isWellKnownAttribute(attName)) {
-      // it is always ok to display the well know attributes
-      return true;
-    }
     if (attName.startsWith(DistributionConfig.SECURITY_PREFIX_NAME)) {
       return false;
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11c62f23/gemfire-core/src/test/java/com/gemstone/gemfire/internal/AbstractConfigJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/AbstractConfigJUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/AbstractConfigJUnitTest.java
new file mode 100644
index 0000000..80c92e6
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/AbstractConfigJUnitTest.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal;
+
+import static org.junit.Assert.*;
+
+import org.apache.logging.log4j.Logger;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
+import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Map;
+import java.util.Properties;
+import junit.framework.TestCase;
+import org.junit.experimental.categories.Category;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class AbstractConfigJUnitTest extends TestCase  {
+
+	@Test
+	public void testDisplayPropertyValue(){
+		AbstractConfigTestClass actc=new AbstractConfigTestClass();
+        Method method=null;
+        try{
+            method=actc.getClass().getSuperclass().getDeclaredMethod("okToDisplayPropertyValue",String.class);
+            method.setAccessible(true);
+            assertFalse((Boolean) method.invoke(actc, "password"));
+            assertFalse((Boolean)method.invoke(actc,"cluster-ssl-truststore-password"));
+            assertTrue((Boolean) method.invoke(actc, "cluster-ssl-enabled"));
+            assertFalse((Boolean)method.invoke(actc,"gateway-ssl-truststore-password"));
+            assertFalse((Boolean)method.invoke(actc,"server-ssl-keystore-password"));
+            assertTrue((Boolean) method.invoke(actc, "ssl-enabled"));
+            assertTrue((Boolean)method.invoke(actc,"conserve-sockets"));
+            assertFalse((Boolean)method.invoke(actc,"javax.net.ssl.keyStorePassword"));
+            assertFalse((Boolean)method.invoke(actc,"javax.net.ssl.keyStoreType"));
+            assertFalse((Boolean)method.invoke(actc,"sysprop-value"));
+        } catch (NoSuchMethodException e) {
+            e.printStackTrace();
+        } catch (InvocationTargetException e) {
+            e.printStackTrace();
+        } catch (IllegalAccessException e) {
+            e.printStackTrace();
+        } catch(Exception e){
+            e.printStackTrace();
+        }
+    }
+
+}
+
+class AbstractConfigTestClass extends AbstractConfig{
+
+
+	@Override
+	protected Map getAttDescMap() {
+		return null;
+	}
+
+	@Override
+	protected Map<String, ConfigSource> getAttSourceMap() {
+		return null;
+	}
+
+	@Override
+	public Object getAttributeObject(String attName) {
+		return null;
+	}
+
+	@Override
+	public void setAttributeObject(String attName, Object attValue, ConfigSource source) {
+
+	}
+
+	@Override
+	public boolean isAttributeModifiable(String attName) {
+		return false;
+	}
+
+	@Override
+	public Class getAttributeType(String attName) {
+		return null;
+	}
+
+	@Override
+	public String[] getAttributeNames() {
+		return new String[0];
+	}
+
+	@Override
+	public String[] getSpecificAttributeNames() {
+		return new String[0];
+	}
+}
+


Mime
View raw message