[jboss-cvs] JBossAS SVN: r79325 - in branches/JBPAPP_4_2_0_GA_CP/system/src/main/org/jboss: system and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Oct 9 21:41:08 EDT 2008
Author: mmoyses
Date: 2008-10-09 21:41:07 -0400 (Thu, 09 Oct 2008)
New Revision: 79325
Modified:
branches/JBPAPP_4_2_0_GA_CP/system/src/main/org/jboss/deployment/XSLSubDeployer.java
branches/JBPAPP_4_2_0_GA_CP/system/src/main/org/jboss/system/ServiceConfigurator.java
Log:
JBPAPP-1277: mask passwords in the log
Modified: branches/JBPAPP_4_2_0_GA_CP/system/src/main/org/jboss/deployment/XSLSubDeployer.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/system/src/main/org/jboss/deployment/XSLSubDeployer.java 2008-10-10 01:33:18 UTC (rev 79324)
+++ branches/JBPAPP_4_2_0_GA_CP/system/src/main/org/jboss/deployment/XSLSubDeployer.java 2008-10-10 01:41:07 UTC (rev 79325)
@@ -173,10 +173,15 @@
trans.transform(s, r);
di.document = (Document) r.getNode();
- log.debug("transformed into doc: " + di.document);
if (log.isDebugEnabled())
{
+ log.debug("transformed into doc: " + di.document);
String docStr = DOMWriter.printNode(di.document, true);
+ int index = docStr.toLowerCase().indexOf("password");
+ if (index != -1)
+ {
+ docStr = maskPasswords(docStr, index);
+ }
log.debug("transformed into doc: " + docStr);
}
}
@@ -239,4 +244,17 @@
throw new DeploymentException("Could not create document builder for dd", pce);
}
}
+
+ private String maskPasswords(String original, int index)
+ {
+ StringBuilder sb = new StringBuilder(original);
+ int startPasswdStringIndex = sb.indexOf(">", index);
+ int endPasswdStringIndex = sb.indexOf("<", startPasswdStringIndex);
+ sb.replace(startPasswdStringIndex + 1, endPasswdStringIndex, "****");
+ String modified = sb.toString();
+ index = modified.toLowerCase().indexOf("password", startPasswdStringIndex);
+ if (index != -1)
+ return maskPasswords(modified, index);
+ return modified;
+ }
}
Modified: branches/JBPAPP_4_2_0_GA_CP/system/src/main/org/jboss/system/ServiceConfigurator.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/system/src/main/org/jboss/system/ServiceConfigurator.java 2008-10-10 01:33:18 UTC (rev 79324)
+++ branches/JBPAPP_4_2_0_GA_CP/system/src/main/org/jboss/system/ServiceConfigurator.java 2008-10-10 01:41:07 UTC (rev 79325)
@@ -328,7 +328,13 @@
else
value = parseTextSerialData(attr, cl, element, replace, trim);
- log.debug(attributeName + " set to " + value + " in " + objectName);
+ if (log.isDebugEnabled())
+ {
+ Object outputValue = value;
+ if (attributeName.toLowerCase().indexOf("password") != -1)
+ outputValue = "****";
+ log.debug(attributeName + " set to " + outputValue + " in " + objectName);
+ }
setAttribute(objectName, new Attribute(attributeName, value));
}//if has children
More information about the jboss-cvs-commits
mailing list